[magics] 01/01: upstream 2.29.2
Alastair McKinstry
mckinstry at moszumanska.debian.org
Sat Oct 29 17:17:43 UTC 2016
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to tag upstream/2.29.2
in repository magics.
commit 9bbbd29e5c8bd5ffa69835bf9b8a532bc3e26c7a
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Thu Jul 7 20:52:35 2016 +0100
upstream 2.29.2
---
.gitignore | 1 +
AUTHORS | 24 +-
CMakeFiles/cmake.check_cache | 1 -
CMakeLists.txt | 17 +-
NOTICE | 24 +
Testing/Temporary/CTestCostData.txt | 1 -
VERSION.cmake | 12 +-
apps/MagMLInterpretor/json.cc | 10 +
apps/metgram/10_days_metgram_a3.xml | 10 +
apps/metgram/10_days_wave_epsgram_a3.xml | 10 +
apps/metgram/anna.pl | 8 +
apps/metgram/efiserver.pl | 8 +
apps/metgram/eps.xml | 10 +
apps/metgram/eps10.xml | 10 +
apps/metgram/eps10_a3.xml | 10 +
apps/metgram/eps15.xml | 10 +
apps/metgram/eps15_a3.xml | 10 +
apps/metgram/epsserver.pl | 8 +
apps/metgram/epswave.xml | 10 +
apps/metgram/epswind.xml | 10 +
apps/metgram/magplusserver.pl | 8 +
apps/metgram/metgram.xml | 10 +
apps/metgram/metgramx.cc | 10 +
apps/metgram/metview_metgramserver.pl | 8 +
apps/metgram/multi_metgrams.xml | 10 +
apps/metgram/multi_metgrams_page1.xml | 10 +
apps/metgram/multi_metgrams_page2.xml | 10 +
apps/metgram/multi_metgrams_page3.xml | 10 +
apps/metgram/multi_metgrams_page4.xml | 10 +
apps/metgram/templates/10_days_epsgram.xml | 10 +
apps/metgram/templates/10_days_epsgram_a3.xml | 10 +
apps/metgram/templates/10_days_metgram.xml | 10 +
apps/metgram/templates/10_days_wave_epsgram.xml | 10 +
apps/metgram/templates/15_days_epsgram.xml | 10 +
apps/metgram/templates/15_days_epsgram_a3.xml | 10 +
.../templates/15_days_with_clim_epsgram.xml | 10 +
apps/metgram/templates/efi_distribution.xml | 10 +
apps/metgram/templates/new_efi_distribution.xml | 10 +
apps/metgram/tigge_epsgram.xml | 10 +
apps/metgram/wave10.xml | 10 +
apps/metgram/wave10_a3.xml | 10 +
bin/CMakeLists.txt | 4 +-
bin/ecbuild | 32 +-
cmake/CheckFortranSourceCompiles.cmake | 8 +-
cmake/FindADSM.cmake | 2 +-
cmake/FindAEC.cmake | 2 +-
cmake/FindAIO.cmake | 2 +-
cmake/FindArmadillo.cmake | 7 +-
cmake/FindCMath.cmake | 15 +-
cmake/FindCairo.cmake | 5 +-
cmake/FindDl.cmake | 7 +-
cmake/FindEMOS.cmake | 2 +-
cmake/FindFDB.cmake | 2 +-
cmake/FindGeoTIFF.cmake | 5 +-
cmake/FindHPSS.cmake | 2 +-
cmake/FindLEX.cmake | 2 +-
cmake/FindLegacyFDB.cmake | 35 -
cmake/FindLibGFortran.cmake | 23 +-
cmake/FindLibIFort.cmake | 7 +-
cmake/FindMKL.cmake | 2 +-
cmake/FindNDBM.cmake | 2 +-
cmake/FindNetCDF.cmake | 46 +-
cmake/FindNetCDF3.cmake | 7 +-
cmake/FindODB.cmake | 2 +-
cmake/FindOpenCL.cmake | 7 +-
cmake/FindOpenJPEG.cmake | 2 +-
cmake/FindPGIFortran.cmake | 11 +-
cmake/FindPango.cmake | 22 +-
cmake/FindPangoCairo.cmake | 32 +-
cmake/FindProj4.cmake | 12 +-
cmake/FindREADLINE.cmake | 6 +-
cmake/FindRPCGEN.cmake | 2 +-
cmake/FindRealtime.cmake | 8 +-
cmake/FindSZip.cmake | 2 +-
cmake/FindTrilinos.cmake | 2 +-
cmake/FindViennaCL.cmake | 7 +-
cmake/FindXLFortranLibs.cmake | 8 +-
cmake/FindYACC.cmake | 2 +-
cmake/Findgrib_api.cmake | 44 +-
cmake/Findodb_api.cmake | 2 +-
cmake/Findspot.cmake | 2 +-
cmake/VERSION.cmake | 6 +-
cmake/compiler_flags/Clang_C.cmake | 13 +
cmake/compiler_flags/Clang_CXX.cmake | 13 +
cmake/compiler_flags/Cray_C.cmake | 14 +
cmake/compiler_flags/Cray_CXX.cmake | 14 +
cmake/compiler_flags/Cray_Fortran.cmake | 15 +
cmake/compiler_flags/GNU_C.cmake | 18 +
cmake/compiler_flags/GNU_CXX.cmake | 18 +
cmake/compiler_flags/GNU_Fortran.cmake | 21 +
cmake/compiler_flags/Intel_C.cmake | 13 +
cmake/compiler_flags/Intel_CXX.cmake | 13 +
cmake/compiler_flags/Intel_Fortran.cmake | 14 +
cmake/compiler_flags/PGI_C.cmake | 11 +
cmake/compiler_flags/PGI_CXX.cmake | 11 +
cmake/compiler_flags/PGI_Fortran.cmake | 11 +
cmake/contrib/FindFFTW.cmake | 193 +-
cmake/contrib/FindNetCDF4.cmake | 41 +-
cmake/contrib/GetGitRevisionDescription.cmake.in | 6 +-
cmake/ecbuild_add_c_flags.cmake | 60 +-
cmake/ecbuild_add_cxx11_flags.cmake | 2 +-
cmake/ecbuild_add_cxx_flags.cmake | 60 +-
cmake/ecbuild_add_executable.cmake | 168 +-
cmake/ecbuild_add_extra_search_paths.cmake | 12 +-
cmake/ecbuild_add_fortran_flags.cmake | 62 +-
cmake/ecbuild_add_library.cmake | 151 +-
cmake/ecbuild_add_option.cmake | 75 +-
cmake/ecbuild_add_persistent.cmake | 20 +-
cmake/ecbuild_add_resources.cmake | 6 +-
cmake/ecbuild_add_test.cmake | 81 +-
cmake/ecbuild_append_to_rpath.cmake | 4 +-
cmake/ecbuild_bundle.cmake | 42 +-
cmake/ecbuild_cache.cmake | 2 +-
cmake/ecbuild_check_c_source_return.cmake | 12 +-
cmake/ecbuild_check_compiler.cmake | 9 +-
cmake/ecbuild_check_cxx11.cmake | 17 +-
cmake/ecbuild_check_cxx_source_return.cmake | 56 +-
cmake/ecbuild_check_fortran_source_return.cmake | 14 +-
cmake/ecbuild_check_functions.cmake | 16 +-
cmake/ecbuild_check_os.cmake | 87 +-
cmake/ecbuild_compiler_flags.cmake | 97 +
cmake/ecbuild_config.h.in | 2 +-
cmake/ecbuild_debug_var.cmake | 47 -
cmake/ecbuild_declare_project.cmake | 34 +-
cmake/ecbuild_define_build_types.cmake | 82 +-
cmake/ecbuild_define_libs_and_execs_target.cmake | 29 +
...get.cmake => ecbuild_define_links_target.cmake} | 10 +-
cmake/ecbuild_define_options.cmake | 12 +-
cmake/ecbuild_define_paths.cmake | 2 +-
cmake/ecbuild_dont_pack.cmake | 6 +-
cmake/ecbuild_download_resource.cmake | 6 +-
cmake/ecbuild_echo_targets.cmake | 24 +-
cmake/ecbuild_enable_fortran.cmake | 15 +-
cmake/ecbuild_features.cmake | 55 +-
cmake/ecbuild_find_fortranlibs.cmake | 14 +-
cmake/ecbuild_find_lexyacc.cmake | 20 +-
cmake/ecbuild_find_mpi.cmake | 14 +-
cmake/ecbuild_find_omp.cmake | 11 +-
cmake/ecbuild_find_package.cmake | 36 +-
cmake/ecbuild_find_perl.cmake | 6 +-
cmake/ecbuild_find_python.cmake | 140 +-
cmake/ecbuild_generate_config_headers.cmake | 4 +-
cmake/ecbuild_generate_fortran_interfaces.cmake | 143 +
cmake/ecbuild_generate_rpc.cmake | 10 +-
cmake/ecbuild_generate_yy.cmake | 40 +-
cmake/ecbuild_get_cxx11_flags.cmake | 4 +-
cmake/ecbuild_get_date.cmake | 6 +-
cmake/ecbuild_get_resources.cmake | 20 +-
cmake/ecbuild_get_test_data.cmake | 44 +-
cmake/ecbuild_git.cmake | 55 +-
cmake/ecbuild_install_project.cmake | 87 +-
cmake/ecbuild_list_add_pattern.cmake | 102 +
cmake/ecbuild_list_exclude_pattern.cmake | 88 +
cmake/ecbuild_list_extra_search_paths.cmake | 12 +-
cmake/ecbuild_list_macros.cmake | 40 +-
cmake/ecbuild_log.cmake | 169 +-
cmake/ecbuild_pkgconfig.cmake | 6 +-
cmake/ecbuild_policies.cmake | 10 +-
cmake/ecbuild_print_summary.cmake | 66 +-
cmake/ecbuild_project_files.cmake | 12 +-
cmake/ecbuild_remove_fortran_flags.cmake | 61 +
cmake/ecbuild_requires_macro_version.cmake | 4 +-
cmake/ecbuild_separate_sources.cmake | 16 +-
cmake/ecbuild_setup_test_framework.cmake | 10 +-
cmake/ecbuild_source_flags.cmake | 30 +
cmake/ecbuild_system.cmake | 80 +-
cmake/ecbuild_use_package.cmake | 39 +-
cmake/ecbuild_version.h.in | 2 +-
cmake/ecbuild_warn_unused_files.cmake | 28 +-
cmake/fcm-make-interfaces.cfg | 31 +
cmake/gen_source_flags.py | 84 +
cmake/include/ecbuild/boost_test_framework.h | 2 +-
cmake/project-config.cmake.in | 49 +-
cmake/sg.pl | 2 +-
fc_type.grib | Bin 4284160 -> 0 bytes
project_summary.cmake | 8 +
python/Magics/Magics_interface.cc | 10 +
python/Magics/macro.py | 8 +
python/Magics/metgram.py | 8 +
share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake | 67 +-
share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake | 59 +-
share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake | 63 +-
share/magics/centre.xml | 10 +
share/magics/efi/Africa_All32parameters_0.js | 10 +
share/magics/efi/Africa_All32parameters_1.js | 10 +
share/magics/efi/Africa_All32parameters_2.js | 10 +
share/magics/efi/Africa_All32parameters_3.js | 10 +
share/magics/efi/Africa_All32parameters_4.js | 10 +
share/magics/efi/Africa_All32parameters_5.js | 10 +
share/magics/efi/Asia_All32parameters_0.js | 10 +
share/magics/efi/Asia_All32parameters_1.js | 10 +
share/magics/efi/Asia_All32parameters_2.js | 10 +
share/magics/efi/Asia_All32parameters_3.js | 10 +
share/magics/efi/Asia_All32parameters_4.js | 10 +
share/magics/efi/Asia_All32parameters_5.js | 10 +
share/magics/efi/Australia_All32parameters_0.js | 10 +
share/magics/efi/Australia_All32parameters_1.js | 10 +
share/magics/efi/Australia_All32parameters_2.js | 10 +
share/magics/efi/Australia_All32parameters_3.js | 10 +
share/magics/efi/Australia_All32parameters_4.js | 10 +
share/magics/efi/Australia_All32parameters_5.js | 10 +
share/magics/efi/Europe_All32parameters_0.js | 10 +
share/magics/efi/Europe_All32parameters_1.js | 10 +
share/magics/efi/Europe_All32parameters_2.js | 10 +
share/magics/efi/Europe_All32parameters_3.js | 10 +
share/magics/efi/Europe_All32parameters_4.js | 10 +
share/magics/efi/Europe_All32parameters_5.js | 10 +
share/magics/efi/Global_All32parameters_0.js | 10 +
share/magics/efi/Global_All32parameters_1.js | 10 +
share/magics/efi/Global_All32parameters_2.js | 10 +
share/magics/efi/Global_All32parameters_3.js | 10 +
share/magics/efi/Global_All32parameters_4.js | 10 +
share/magics/efi/Global_All32parameters_5.js | 10 +
.../magics/efi/North32America_All32parameters_0.js | 10 +
.../magics/efi/North32America_All32parameters_1.js | 10 +
.../magics/efi/North32America_All32parameters_2.js | 10 +
.../magics/efi/North32America_All32parameters_3.js | 10 +
.../magics/efi/North32America_All32parameters_4.js | 10 +
.../magics/efi/North32America_All32parameters_5.js | 10 +
.../magics/efi/South32America_All32parameters_0.js | 10 +
.../magics/efi/South32America_All32parameters_1.js | 10 +
.../magics/efi/South32America_All32parameters_2.js | 10 +
.../magics/efi/South32America_All32parameters_3.js | 10 +
.../magics/efi/South32America_All32parameters_4.js | 10 +
.../magics/efi/South32America_All32parameters_5.js | 10 +
share/magics/efi/efi_template.js | 10 +
share/magics/level.xml | 10 +
share/magics/satellite.xml | 10 +
share/magics/table_128.xml | 17 +
share/magics/table_129.xml | 10 +
share/magics/table_130.xml | 10 +
share/magics/table_131.xml | 10 +
share/magics/table_132.xml | 10 +
share/magics/table_140.xml | 10 +
share/magics/table_150.xml | 10 +
share/magics/table_151.xml | 10 +
share/magics/table_160.xml | 10 +
share/magics/table_162.xml | 10 +
share/magics/table_170.xml | 10 +
share/magics/table_171.xml | 10 +
share/magics/table_172.xml | 10 +
share/magics/table_173.xml | 10 +
share/magics/table_174.xml | 10 +
share/magics/table_175.xml | 10 +
share/magics/table_180.xml | 10 +
share/magics/table_190.xml | 10 +
share/magics/table_2.xml | 10 +
share/magics/table_200.xml | 10 +
share/magics/table_210.xml | 10 +
share/magics/table_254.xml | 10 +
share/magics/table_260.xml | 10 +
share/magics/title_template.xml | 10 +
share/magics/type.xml | 10 +
share/magics/web/magics.js | 10 +
src/CMakeLists.txt | 5 +-
src/MagicsDouble.cc | 49 +-
src/MagicsSingle.cc | 26 +-
src/VectorOfPointers.h | 26 +-
src/basic/BasicGraphicsObject.cc | 26 +-
src/basic/BasicGraphicsObject.h | 26 +-
src/basic/BasicSceneObject.cc | 26 +-
src/basic/BasicSceneObject.h | 26 +-
src/basic/BasicSceneVisitor.cc | 10 +
src/basic/BasicSceneVisitor.h | 10 +
src/basic/DataConverter.cc | 10 +
src/basic/DataConverter.h | 10 +
src/basic/DisplayManager.cc | 26 +-
src/basic/DisplayManager.h | 26 +-
src/basic/FortranMagics.cc | 26 +-
src/basic/FortranMagics.h | 26 +-
src/basic/HistoVisitor.cc | 26 +-
src/basic/HistoVisitor.h | 26 +-
src/basic/ImportObjectHandler.cc | 10 +
src/basic/ImportObjectHandler.h | 10 +
src/basic/Layer.cc | 26 +-
src/basic/Layer.h | 26 +-
src/basic/LayoutManager.cc | 10 +
src/basic/LayoutManager.h | 10 +
src/basic/LegendVisitor.cc | 31 +-
src/basic/LegendVisitor.h | 49 +-
src/basic/MagicsEvent.h | 10 +
src/basic/MagicsObserver.h | 10 +
src/basic/MagnifierVisitor.cc | 10 +
src/basic/MagnifierVisitor.h | 10 +
src/basic/MultiVisdef.cc | 10 +
src/basic/MultiVisdef.h | 10 +
src/basic/ParameterSettings.cc | 26 +-
src/basic/ParameterSettings.h | 26 +-
src/basic/PreviewVisitor.cc | 26 +-
src/basic/PreviewVisitor.h | 26 +-
src/basic/RootSceneNode.cc | 26 +-
src/basic/RootSceneNode.h | 26 +-
src/basic/SceneNode.cc | 26 +-
src/basic/SceneNode.h | 26 +-
src/basic/SceneVisitor.cc | 10 +
src/basic/SceneVisitor.h | 10 +
src/basic/TagHandler.cc | 10 +
src/basic/TagHandler.h | 10 +
src/basic/TextVisitor.cc | 26 +-
src/basic/TextVisitor.h | 26 +-
src/basic/ViewNode.cc | 26 +-
src/basic/ViewNode.h | 26 +-
src/basic/Visdef.h | 26 +-
src/basic/VisualAction.cc | 26 +-
src/basic/VisualAction.h | 26 +-
src/basic/WebFormat.cc | 26 +-
src/basic/WebFormat.h | 26 +-
src/basic/XmlMagics.cc | 26 +-
src/basic/XmlMagics.h | 26 +-
src/common/AnimationRules.cc | 10 +
src/common/AnimationRules.h | 10 +
src/common/Arrow.h | 26 +-
src/common/ArrowProperties.cc | 26 +-
src/common/ArrowProperties.h | 26 +-
src/common/AutoLock.h | 26 +-
src/common/AutoLocker.cc | 26 +-
src/common/AutomaticPlotManager.cc | 26 +-
src/common/AutomaticPlotManager.h | 26 +-
src/common/BackgroundColour.h | 26 +-
src/common/BaseParameter.cc | 26 +-
src/common/BaseParameter.h | 26 +-
src/common/BasePointsHandler.cc | 26 +-
src/common/BasePointsHandler.h | 26 +-
src/common/BinaryObject.cc | 10 +
src/common/BinaryObject.h | 10 +
src/common/CMakeLists.txt | 2 +-
src/common/CartesianTransformation.cc | 26 +-
src/common/CartesianTransformation.h | 26 +-
src/common/Clipper.h | 26 +-
src/common/Colour.cc | 26 +-
src/common/Colour.h | 26 +-
src/common/ColourTable.cc | 26 +-
src/common/ColourTable.h | 26 +-
src/common/ColourTableDefinition.h | 26 +-
src/common/ColourTableDefinitionCompute.cc | 26 +-
src/common/ColourTableDefinitionCompute.h | 26 +-
src/common/ColourTableDefinitionComputeInterface.h | 26 +-
src/common/ColourTableDefinitionList.cc | 26 +-
src/common/ColourTableDefinitionList.h | 26 +-
src/common/ColourTableDefinitionListInterface.h | 26 +-
src/common/Coordinate.cc | 26 +-
src/common/Coordinate.h | 26 +-
src/common/CustomisedPoint.h | 26 +-
src/common/Data.cc | 26 +-
src/common/Data.h | 26 +-
src/common/DataStats.cc | 26 +-
src/common/DataStats.h | 27 +-
src/common/Decoder.h | 26 +-
src/common/Dimension.cc | 26 +-
src/common/Dimension.h | 26 +-
src/common/DriverStatic.cc | 26 +-
src/common/DriverStatic.h | 26 +-
src/common/Factory.cc | 26 +-
src/common/Factory.h | 26 +-
src/common/Flag.cc | 26 +-
src/common/Flag.h | 26 +-
src/common/Frame.cc | 26 +-
src/common/Frame.h | 26 +-
src/common/FrameBase.cc | 26 +-
src/common/FrameBase.h | 26 +-
src/common/FrameLoop.cc | 10 +
src/common/FrameLoop.h | 10 +
src/common/FullPaperPoint.h | 26 +-
src/common/GeoPoint.h | 26 +-
src/common/GeoRectangularProjection.cc | 28 +-
src/common/GeoRectangularProjection.h | 28 +-
src/common/GribInterpretor.h | 28 +-
src/common/HeightTableDefinition.h | 26 +-
src/common/Image.h | 26 +-
src/common/ImageProperties.h | 26 +-
src/common/ImportObject.cc | 26 +-
src/common/ImportObject.h | 26 +-
src/common/InteractiveSet.cc | 26 +-
src/common/InteractiveSet.h | 26 +-
src/common/IntervalMap.h | 26 +-
src/common/Label.cc | 26 +-
src/common/Label.h | 26 +-
src/common/Layout.cc | 26 +-
src/common/Layout.h | 26 +-
src/common/LevelTableDefinition.h | 26 +-
src/common/LogoPlotting.cc | 26 +-
src/common/LogoPlotting.h | 26 +-
src/common/LogoPlottingBase.h | 26 +-
src/common/MagException.cc | 26 +-
src/common/MagException.h | 26 +-
src/common/MagExceptions.cc | 26 +-
src/common/MagExceptions.h | 26 +-
src/common/MagFont.cc | 26 +-
src/common/MagFont.h | 26 +-
src/common/MagLog.cc | 26 +-
src/common/MagLog.h | 26 +-
src/common/MagTranslator.h | 26 +-
src/common/MagicsCalls.cc | 26 +-
src/common/MagicsFormat.cc | 26 +-
src/common/MagicsFormat.h | 33 +-
src/common/MagicsParameter.cc | 26 +-
src/common/MagicsParameter.h | 26 +-
src/common/MagicsSingleton.h | 27 +-
src/common/MagicsThreads.cc | 26 +-
src/common/MagicsThreads.h | 26 +-
src/common/Matrix.cc | 28 +-
src/common/Matrix.h | 26 +-
src/common/MatrixHandler.h | 26 +-
src/common/MetaData.cc | 26 +-
src/common/MetaData.h | 26 +-
src/common/Mutex.cc | 26 +-
src/common/Mutex.h | 26 +-
src/common/MutexCond.cc | 26 +-
src/common/MutexCond.h | 42 +-
src/common/Node.cc | 26 +-
src/common/Node.h | 26 +-
src/common/OutputFactory.cc | 26 +-
src/common/OutputFactory.h | 26 +-
src/common/OutputHandler.cc | 26 +-
src/common/OutputHandler.h | 26 +-
src/common/PageID.cc | 26 +-
src/common/PageID.h | 26 +-
src/common/PageIDBase.h | 26 +-
src/common/PaperDimension.h | 26 +-
src/common/PaperPoint.h | 26 +-
src/common/ParameterManager.cc | 26 +-
src/common/ParameterManager.h | 26 +-
src/common/Path.h | 26 +-
src/common/PlotManager.cc | 26 +-
src/common/PlotManager.h | 26 +-
src/common/PointsHandler.cc | 26 +-
src/common/PointsHandler.h | 26 +-
src/common/PolarStereographicProjection.cc | 30 +-
src/common/PolarStereographicProjection.h | 28 +-
src/common/PolyCoast.h | 27 +-
src/common/Polyline.cc | 28 +-
src/common/Polyline.h | 26 +-
src/common/ProgressObject.cc | 26 +-
src/common/ProgressObject.h | 26 +-
src/common/ProgressTask.cc | 26 +-
src/common/ProgressTask.h | 26 +-
src/common/Proj4Projection.cc | 28 +-
src/common/Proj4Projection.h | 28 +-
src/common/RasterData.cc | 26 +-
src/common/RasterData.h | 26 +-
src/common/SatelliteProjection.cc | 366 -
src/common/SatelliteProjection.h | 142 -
src/common/SciMethods.cc | 28 +-
src/common/SciMethods.h | 28 +-
src/common/Seconds.cc | 29 +-
src/common/Seconds.h | 26 +-
src/common/Static.cc | 26 +-
src/common/Static.h | 26 +-
src/common/Symbol.cc | 26 +-
src/common/Symbol.h | 26 +-
src/common/SymbolItem.cc | 10 +
src/common/SymbolItem.h | 12 +
src/common/TableDefinition.h | 26 +-
src/common/TableDefinitionCompute.cc | 26 +-
src/common/TableDefinitionCompute.h | 26 +-
src/common/TableDefinitionComputeInterface.h | 26 +-
src/common/TableDefinitionList.cc | 26 +-
src/common/TableDefinitionList.h | 26 +-
src/common/TableDefinitionListInterface.h | 26 +-
src/common/Task.cc | 26 +-
src/common/Task.h | 26 +-
src/common/TaylorProjection.cc | 28 +-
src/common/TaylorProjection.h | 28 +-
src/common/Tephigram.cc | 28 +-
src/common/Tephigram.h | 28 +-
src/common/Text.cc | 26 +-
src/common/Text.h | 26 +-
src/common/Thread.cc | 26 +-
src/common/Thread.h | 26 +-
src/common/ThreadControler.cc | 26 +-
src/common/ThreadControler.h | 26 +-
src/common/ThreadSingleton.cc | 26 +-
src/common/ThreadSingleton.h | 26 +-
src/common/Timer.cc | 26 +-
src/common/Timer.h | 26 +-
src/common/Tokenizer.cc | 26 +-
src/common/Tokenizer.h | 26 +-
src/common/Transformation.cc | 21 +-
src/common/Transformation.h | 28 +-
src/common/UserPoint.h | 26 +-
src/common/Visualiser.h | 26 +-
src/common/XCoordinate.h | 26 +-
src/common/XmlNode.cc | 26 +-
src/common/XmlNode.h | 26 +-
src/common/XmlReader.cc | 26 +-
src/common/XmlReader.h | 26 +-
src/common/XmlTree.cc | 26 +-
src/common/XmlTree.h | 26 +-
src/common/YCoordinate.h | 26 +-
src/common/aix.h | 26 +-
src/common/linux.h | 26 +-
src/common/machine.h | 0
src/common/magics_api.h | 26 +-
src/common/marsmachine.h | 26 +-
src/decoders/BinningObject.cc | 10 +
src/decoders/BinningObject.h | 10 +
src/decoders/BoxPlotDecoder.cc | 26 +-
src/decoders/BoxPlotDecoder.h | 26 +-
src/decoders/ClassicMtgDecoder.cc | 37 +-
src/decoders/ClassicMtgDecoder.h | 26 +-
src/decoders/Date.cc | 27 +-
src/decoders/DateTime.cc | 27 +-
src/decoders/DateTime.h | 26 +-
src/decoders/EfiLegendEntry.h | 27 +-
src/decoders/EpsBufr.cc | 27 +-
src/decoders/EpsBufr.h | 26 +-
src/decoders/EpsXmlInput.cc | 27 +-
src/decoders/EpsXmlInput.h | 26 +-
src/decoders/EpsgramDecoder.cc | 29 +-
src/decoders/EpsgramDecoder.h | 26 +-
src/decoders/GeoPointsDecoder.cc | 26 +-
src/decoders/GeoPointsDecoder.h | 26 +-
src/decoders/Grib | 0
src/decoders/GribAddressMode.h | 26 +-
src/decoders/GribDecoder.cc | 26 +-
src/decoders/GribDecoder.h | 26 +-
src/decoders/GribInterpretor.h | 26 +-
src/decoders/GribLoopStep.cc | 27 +-
src/decoders/GribLoopStep.h | 27 +-
src/decoders/GribRegularInterpretor.cc | 72 +-
src/decoders/GribRegularInterpretor.h | 26 +-
src/decoders/GribSatelliteInterpretor.cc | 371 +-
src/decoders/GribSatelliteInterpretor.h | 58 +-
src/decoders/ImportAction.h | 26 +-
src/decoders/InputData.cc | 26 +-
src/decoders/InputData.h | 26 +-
src/decoders/InputMatrix.cc | 26 +-
src/decoders/InputMatrix.h | 26 +-
src/decoders/InputMatrixInterpretor.cc | 29 +-
src/decoders/InputMatrixInterpretor.h | 26 +-
src/decoders/LandgramDecoder.cc | 26 +-
src/decoders/LandgramDecoder.h | 26 +-
src/decoders/LocalTable.cc | 26 +-
src/decoders/LocalTable.h | 26 +-
src/decoders/MapGenDecoder.cc | 26 +-
src/decoders/MapGenDecoder.h | 26 +-
src/decoders/MatrixTestDecoder.cc | 26 +-
src/decoders/MatrixTestDecoder.h | 26 +-
src/decoders/Netcdf.cc | 26 +-
src/decoders/Netcdf.h | 26 +-
src/decoders/NetcdfConvention.cc | 26 +-
src/decoders/NetcdfConvention.h | 26 +-
src/decoders/NetcdfDecoder.cc | 26 +-
src/decoders/NetcdfDecoder.h | 26 +-
src/decoders/NetcdfGeoMatrixInterpretor.cc | 39 +-
src/decoders/NetcdfGeoMatrixInterpretor.h | 26 +-
src/decoders/NetcdfGeopointsInterpretor.cc | 26 +-
src/decoders/NetcdfGeopointsInterpretor.h | 26 +-
src/decoders/NetcdfInterpretor.cc | 26 +-
src/decoders/NetcdfInterpretor.h | 26 +-
src/decoders/NetcdfMarsConvention.cc | 26 +-
src/decoders/NetcdfMarsConvention.h | 26 +-
src/decoders/NetcdfMatrixInterpretor.cc | 26 +-
src/decoders/NetcdfMatrixInterpretor.h | 26 +-
src/decoders/NetcdfOrcaInterpretor.cc | 59 +-
src/decoders/NetcdfOrcaInterpretor.h | 26 +-
src/decoders/NetcdfVectorInterpretor.cc | 26 +-
src/decoders/NetcdfVectorInterpretor.h | 26 +-
src/decoders/ObsDecoder.cc | 26 +-
src/decoders/ObsDecoder.h | 26 +-
src/decoders/ObsStatDecoder.cc | 26 +-
src/decoders/ObsStatDecoder.h | 26 +-
src/decoders/ShapeDecoder.cc | 26 +-
src/decoders/ShapeDecoder.h | 26 +-
src/decoders/SimplePolylineInput.cc | 26 +-
src/decoders/SimplePolylineInput.h | 26 +-
src/decoders/SymbolInput.h | 26 +-
src/decoders/TableDecoder.cc | 26 +-
src/decoders/TableDecoder.h | 26 +-
src/decoders/ThinningMethod.cc | 10 +
src/decoders/ThinningMethod.h | 10 +
src/decoders/Time.cc | 26 +-
src/decoders/TitleField.cc | 26 +-
src/decoders/TitleField.h | 26 +-
src/decoders/TitleMetaField.cc | 26 +-
src/decoders/TitleMetaField.h | 26 +-
src/decoders/TitleStringField.cc | 26 +-
src/decoders/TitleStringField.h | 26 +-
src/decoders/TitleTemplate.cc | 26 +-
src/decoders/TitleTemplate.h | 26 +-
src/decoders/WindMode.cc | 26 +-
src/decoders/WindMode.h | 26 +-
src/decoders/XYList.cc | 26 +-
src/decoders/XYList.h | 26 +-
src/drivers/BaseDriver.cc | 37 +-
src/drivers/BaseDriver.h | 28 +-
src/drivers/BaseDriverImages.h | 28 +-
src/drivers/BaseDriverSymbols.h | 29 +-
src/drivers/BaseDriverWind.h | 28 +-
src/drivers/BinaryDriver.cc | 28 +-
src/drivers/BinaryDriver.h | 28 +-
src/drivers/CairoDriver.cc | 28 +-
src/drivers/CairoDriver.h | 28 +-
src/drivers/DriverManager.cc | 26 +-
src/drivers/DriverManager.h | 26 +-
src/drivers/GDDriver.cc | 28 +-
src/drivers/GDDriver.h | 28 +-
src/drivers/GeoJsonDriver.cc | 34 +-
src/drivers/GeoJsonDriver.h | 28 +-
src/drivers/KMLDriver.cc | 34 +-
src/drivers/KMLDriver.h | 28 +-
src/drivers/MgQ/MgQ.h | 28 +-
src/drivers/MgQ/MgQDriverObject.h | 28 +-
src/drivers/MgQ/MgQHistoItem.cc | 28 +-
src/drivers/MgQ/MgQHistoItem.h | 28 +-
src/drivers/MgQ/MgQLayerItem.cc | 28 +-
src/drivers/MgQ/MgQLayerItem.h | 28 +-
src/drivers/MgQ/MgQLayoutItem.cc | 28 +-
src/drivers/MgQ/MgQLayoutItem.h | 28 +-
src/drivers/MgQ/MgQPathItem.cc | 28 +-
src/drivers/MgQ/MgQPathItem.h | 28 +-
src/drivers/MgQ/MgQPattern.cc | 28 +-
src/drivers/MgQ/MgQPattern.h | 28 +-
src/drivers/MgQ/MgQPixmapItem.cc | 28 +-
src/drivers/MgQ/MgQPixmapItem.h | 28 +-
src/drivers/MgQ/MgQPlotScene.cc | 28 +-
src/drivers/MgQ/MgQPlotScene.h | 28 +-
src/drivers/MgQ/MgQPolylineSetItem.cc | 28 +-
src/drivers/MgQ/MgQPolylineSetItem.h | 28 +-
src/drivers/MgQ/MgQRootItem.h | 28 +-
src/drivers/MgQ/MgQScene.cc | 28 +-
src/drivers/MgQ/MgQScene.h | 28 +-
src/drivers/MgQ/MgQSceneCacheItem.cc | 28 +-
src/drivers/MgQ/MgQSceneCacheItem.h | 28 +-
src/drivers/MgQ/MgQSceneItem.cc | 28 +-
src/drivers/MgQ/MgQSceneItem.h | 28 +-
src/drivers/MgQ/MgQStepItem.cc | 28 +-
src/drivers/MgQ/MgQStepItem.h | 28 +-
src/drivers/MgQ/MgQStepMetaData.cc | 28 +-
src/drivers/MgQ/MgQStepMetaData.h | 28 +-
src/drivers/MgQ/MgQSymbol.cc | 28 +-
src/drivers/MgQ/MgQSymbol.h | 28 +-
src/drivers/MgQ/MgQTextItem.cc | 28 +-
src/drivers/MgQ/MgQTextItem.h | 28 +-
src/drivers/MingDriver.cc | 568 --
src/drivers/MingDriver.h | 132 -
src/drivers/PostScriptDriver.cc | 54 +-
src/drivers/PostScriptDriver.h | 32 +-
src/drivers/QtDriver.cc | 28 +-
src/drivers/QtDriver.h | 28 +-
src/drivers/SVGDriver.cc | 35 +-
src/drivers/SVGDriver.h | 28 +-
src/drivers/SelectionMode.cc | 35 +-
src/drivers/SelectionMode.h | 29 +-
src/drivers/System.h | 28 +-
src/eckit_readers/TableReader.cc | 23 +-
src/eckit_readers/TableReader.h | 22 +-
src/libMagWrapper/MagPlus.cc | 10 +
src/libMagWrapper/MagPlus.h | 10 +
src/libMagWrapper/MagRequest.h | 10 +
src/magics.h | 34 +-
src/magics_ecmwf_log.h | 26 +-
src/oda/ODACalls.cc | 27 +-
src/oda/OdaDecoder.cc | 26 +-
src/oda/OdaDecoder.h | 26 +-
src/params/Akima474Method.xml | 10 +
src/params/Akima760Method.xml | 10 +
src/params/Akima761Method.xml | 10 +
src/params/ArrowPlotting.xml | 10 +
src/params/AutomaticContourMethod.xml | 10 +
src/params/AutomaticPlotManager.xml | 10 +
src/params/Axis.xml | 10 +
src/params/AxisMethod.xml | 10 +
src/params/Bar.xml | 10 +
src/params/BaseDriver.xml | 10 +
src/params/BinaryDriver.xml | 10 +
src/params/BinaryObject.xml | 10 +
src/params/BinningObject.xml | 10 +
src/params/BothValuePlotMethod.xml | 10 +
src/params/Boundaries.xml | 10 +
src/params/BoxPlotBox.xml | 10 +
src/params/BoxPlotBoxBorder.xml | 10 +
src/params/BoxPlotDecoder.xml | 10 +
src/params/BoxPlotMedian.xml | 10 +
src/params/BoxPlotVisualiser.xml | 10 +
src/params/BoxPlotWhiskerBorder.xml | 10 +
src/params/BoxPlotWhiskerBox.xml | 10 +
src/params/BoxPlotWhiskerLine.xml | 10 +
src/params/CairoDriver.xml | 10 +
src/params/CalculateColourTechnique.xml | 10 +
src/params/CalculateHeightTechnique.xml | 10 +
src/params/CalmIndicator.xml | 10 +
src/params/CartesianTransformation.xml | 10 +
src/params/CdfGraph.xml | 10 +
src/params/CellShading.xml | 10 +
src/params/CircleOriginMarker.xml | 10 +
src/params/Cities.xml | 10 +
src/params/ClassicMtgDecoder.xml | 10 +
src/params/CoastPlotting.xml | 10 +
src/params/Coastlines.xml | 10 +
src/params/ColourTechnique.xml | 10 +
src/params/ContinuousLegendMethod.xml | 10 +
src/params/Contour.xml | 10 +
src/params/ContourMethod.xml | 10 +
src/params/CountSelectionType.xml | 10 +
src/params/Curve.xml | 10 +
src/params/CurveArea.xml | 10 +
src/params/DateAxisMethod.xml | 10 +
src/params/DateGribLoopStep.xml | 10 +
src/params/DotGraphShadeStyle.xml | 10 +
src/params/DotOriginMarker.xml | 10 +
src/params/DotPolyShadingMethod.xml | 10 +
src/params/DumpShading.xml | 10 +
src/params/DumpShadingWrapper.xml | 10 +
src/params/EfiDataDecoder.xml | 10 +
src/params/EfiGraph.xml | 10 +
src/params/EfiJSon.xml | 10 +
src/params/EfigramDecoder.xml | 10 +
src/params/EpsBufr.xml | 10 +
src/params/EpsCloud.xml | 10 +
src/params/EpsDirection.xml | 10 +
src/params/EpsGraph.xml | 10 +
src/params/EpsPlume.xml | 10 +
src/params/EpsShade.xml | 10 +
src/params/EpsWave.xml | 10 +
src/params/EpsWind.xml | 10 +
src/params/EpsXmlInput.xml | 10 +
src/params/EpsgramDecoder.xml | 10 +
src/params/EquidistantTableMode.xml | 10 +
src/params/FixedTableMode.xml | 10 +
src/params/FlagPlotting.xml | 10 +
src/params/FortranRootSceneNode.xml | 10 +
src/params/FortranSceneNode.xml | 10 +
src/params/FortranViewNode.xml | 10 +
src/params/GDDriver.xml | 10 +
src/params/GenericSQLDecoder.xml | 10 +
src/params/GeoJSon.xml | 10 +
src/params/GeoJsonDriver.xml | 10 +
src/params/GeoPointsDecoder.xml | 10 +
src/params/GeoRectangularProjection.xml | 10 +
src/params/Graph.xml | 10 +
src/params/GraphArrow.xml | 10 +
src/params/GraphFlag.xml | 10 +
src/params/GraphPlotting.xml | 10 +
src/params/GraphShade.xml | 10 +
src/params/GraphShadeStyle.xml | 10 +
src/params/GribAddressByteMode.xml | 10 +
src/params/GribAddressMode.xml | 10 +
src/params/GribAddressRecordMode.xml | 10 +
src/params/GribDecoder.xml | 10 +
src/params/GribLoop.xml | 10 +
src/params/GribLoopStep.xml | 10 +
src/params/GridPlotting.xml | 10 +
src/params/GridShading.xml | 10 +
src/params/HatchGraphShadeStyle.xml | 10 +
src/params/HatchPolyShadingMethod.xml | 10 +
src/params/HeightTechnique.xml | 10 +
src/params/HiLo.xml | 10 +
src/params/HiLoBase.xml | 10 +
src/params/HiLoBoth.xml | 10 +
src/params/HiLoMarker.xml | 10 +
src/params/HiLoMarkerBase.xml | 10 +
src/params/HiLoNumber.xml | 10 +
src/params/HiLoTechnique.xml | 10 +
src/params/HiLoText.xml | 10 +
src/params/HighHiLo.xml | 10 +
src/params/Histogram.xml | 10 +
src/params/HistogramLegendMethod.xml | 10 +
src/params/HyperAxisMethod.xml | 10 +
src/params/ImageCalculateColourTechnique.xml | 10 +
src/params/ImageListColourTechnique.xml | 10 +
src/params/ImagePlotting.xml | 10 +
src/params/ImportAction.xml | 10 +
src/params/ImportObjectHandler.xml | 10 +
src/params/ImportPlot.xml | 10 +
src/params/InputData.xml | 10 +
src/params/InputMatrix.xml | 10 +
src/params/InputMatrixIrregularInterpretor.xml | 10 +
src/params/InputMatrixRegularInterpretor.xml | 10 +
src/params/IntervalSelectionType.xml | 10 +
src/params/IsoHighlight.xml | 10 +
src/params/IsoLabel.xml | 10 +
src/params/IsoPlot.xml | 10 +
src/params/IsoShading.xml | 10 +
src/params/KMLDriver.xml | 10 +
src/params/LabelPlotting.xml | 10 +
src/params/LandgramBox.xml | 10 +
src/params/LandgramDecoder.xml | 10 +
src/params/LegendMethod.xml | 10 +
src/params/LegendVisitor.xml | 10 +
src/params/LevelListSelectionType.xml | 10 +
src/params/LevelSelection.xml | 10 +
src/params/ListColourTechnique.xml | 10 +
src/params/ListHeightTechnique.xml | 10 +
src/params/LogarithmicAxisMethod.xml | 10 +
src/params/LogoPlotting.xml | 10 +
src/params/LookupTableMode.xml | 10 +
src/params/LowHiLo.xml | 10 +
src/params/MagnifierVisitor.xml | 10 +
src/params/MapGenDecoder.xml | 10 +
src/params/MarkerShadingTechnique.xml | 10 +
src/params/MarkerValuePlotMethod.xml | 10 +
src/params/MercatorProjection.xml | 10 +
src/params/MetaData.xml | 10 +
src/params/MetgramBar.xml | 10 +
src/params/MetgramCurve.xml | 10 +
src/params/MetgramFlags.xml | 10 +
src/params/MetgramGraph.xml | 10 +
src/params/MingDriver.xml | 10 +
src/params/MvRootSceneNode.xml | 10 +
src/params/NetcdfDecoder.xml | 10 +
src/params/NetcdfGeoMatrixInterpretor.xml | 10 +
src/params/NetcdfGeoPolarMatrixInterpretor.xml | 10 +
src/params/NetcdfGeoVectorInterpretor.xml | 10 +
src/params/NetcdfGeopointsInterpretor.xml | 10 +
src/params/NetcdfInterpretor.xml | 10 +
src/params/NetcdfMatrixInterpretor.xml | 10 +
src/params/NetcdfOrcaInterpretor.xml | 10 +
src/params/NetcdfVectorInterpretor.xml | 10 +
src/params/NetcdfXYpointsInterpretor.xml | 10 +
src/params/NoBinningObject.xml | 10 +
src/params/NoBoundaries.xml | 10 +
src/params/NoBoxPlotBoxBorder.xml | 10 +
src/params/NoBoxPlotMedian.xml | 10 +
src/params/NoCalmIndicator.xml | 10 +
src/params/NoCities.xml | 10 +
src/params/NoCoastPlotting.xml | 10 +
src/params/NoGraphShade.xml | 10 +
src/params/NoGridPlotting.xml | 10 +
src/params/NoHiLo.xml | 10 +
src/params/NoHiLoMarker.xml | 10 +
src/params/NoIsoHighlight.xml | 10 +
src/params/NoIsoLabel.xml | 10 +
src/params/NoIsoPlot.xml | 10 +
src/params/NoIsoShading.xml | 10 +
src/params/NoLabelPlotting.xml | 10 +
src/params/NoLegendNode.xml | 10 +
src/params/NoLegendVisitor.xml | 10 +
src/params/NoLogoPloting.xml | 10 +
src/params/NoLogoPlotting.xml | 10 +
src/params/NoMagnifierVisitor.xml | 10 +
src/params/NoOriginMarker.xml | 10 +
src/params/NoOutLayerTechnique.xml | 10 +
src/params/NoPageID.xml | 10 +
src/params/NoPreviewVisitor.xml | 10 +
src/params/NoTitle.xml | 10 +
src/params/NoValuePlot.xml | 10 +
src/params/ObsCloud.xml | 10 +
src/params/ObsDecoder.xml | 10 +
src/params/ObsDemoItem2.xml | 10 +
src/params/ObsDewPoint.xml | 10 +
src/params/ObsJSon.xml | 10 +
src/params/ObsPlotting.xml | 10 +
src/params/ObsStatDecoder.xml | 10 +
src/params/ObsTable.xml | 10 +
src/params/OdaGeoDecoder.xml | 10 +
src/params/OdaXYDecoder.xml | 10 +
src/params/OdbDecoder.xml | 10 +
src/params/OriginMarker.xml | 10 +
src/params/OutputHandler.xml | 10 +
src/params/PageID.xml | 10 +
src/params/ParamGribLoopStep.xml | 10 +
src/params/PolarStereographicProjection.xml | 10 +
src/params/PolyShadingMethod.xml | 10 +
src/params/PolyShadingTechnique.xml | 10 +
src/params/PositionListAxisMethod.xml | 10 +
src/params/PostScriptDriver.xml | 10 +
src/params/PpmDecoder.xml | 10 +
src/params/PreviewVisitor.xml | 10 +
src/params/Proj4Bonne.xml | 10 +
src/params/Proj4Collignon.xml | 10 +
src/params/Proj4EPSG32661.xml | 10 +
src/params/Proj4EPSG3857.xml | 10 +
src/params/Proj4EPSG4326.xml | 10 +
src/params/Proj4Efas.xml | 10 +
src/params/Proj4Geos.xml | 10 +
src/params/Proj4Geose.xml | 10 +
src/params/Proj4Geosw.xml | 10 +
src/params/Proj4Goode.xml | 10 +
src/params/Proj4Google.xml | 10 +
src/params/Proj4Lambert.xml | 10 +
src/params/Proj4LambertNorthAtlantic.xml | 10 +
src/params/Proj4Meteosat0.xml | 10 +
src/params/Proj4Meteosat145.xml | 10 +
src/params/Proj4Meteosat57.xml | 10 +
src/params/Proj4Mollweide.xml | 10 +
src/params/Proj4PolarNorth.xml | 10 +
src/params/Proj4Projection.xml | 10 +
src/params/Proj4Robinson.xml | 10 +
src/params/QtDriver.xml | 10 +
src/params/SDWindMode.xml | 10 +
src/params/SVGDriver.xml | 10 +
src/params/SampleContourMethod.xml | 10 +
src/params/SelectionMode.xml | 10 +
src/params/ShadingTechnique.xml | 10 +
src/params/ShapeDecoder.xml | 10 +
src/params/SimpleOutLayerTechnique.xml | 10 +
src/params/SimplePolyline.xml | 10 +
src/params/SimplePolylineInput.xml | 10 +
src/params/Streamlines.xml | 10 +
src/params/SymbolAdvancedTableMode.xml | 10 +
src/params/SymbolIndividualMode.xml | 10 +
src/params/SymbolInput.xml | 10 +
src/params/SymbolMode.xml | 10 +
src/params/SymbolPlotting.xml | 10 +
src/params/SymbolTableMode.xml | 10 +
src/params/TableDecoder.xml | 10 +
src/params/TaylorGrid.xml | 10 +
src/params/TaylorProjection.xml | 10 +
src/params/TephiGrid.xml | 10 +
src/params/TephiInfo.xml | 10 +
src/params/Tephigram.xml | 10 +
src/params/TextVisitor.xml | 10 +
src/params/Title.xml | 10 +
src/params/TitleBase.xml | 10 +
src/params/TitleTemplate.xml | 10 +
src/params/Transformation.xml | 10 +
src/params/UVWindMode.xml | 10 +
src/params/UserLogoPlotting.xml | 10 +
src/params/VDWindMode.xml | 10 +
src/params/ValuePlot.xml | 10 +
src/params/ValuePlotBase.xml | 10 +
src/params/ValuePlotMethod.xml | 10 +
src/params/Wind.xml | 10 +
src/params/WindMode.xml | 10 +
src/params/WindPlotting.xml | 10 +
src/params/WrepJSon.xml | 10 +
src/params/WrepRootNode.xml | 10 +
src/params/XCoordinate.xml | 10 +
src/params/XDateCoordinate.xml | 10 +
src/params/XHyperCoordinate.xml | 10 +
src/params/XLogarithmicCoordinate.xml | 10 +
src/params/XRegularCoordinate.xml | 10 +
src/params/XYList.xml | 10 +
src/params/XmlBasicNode.xml | 10 +
src/params/XmlBox.xml | 10 +
src/params/XmlLegendNode.xml | 10 +
src/params/XmlPage.xml | 10 +
src/params/XmlRootNode.xml | 10 +
src/params/XmlSceneNode.xml | 10 +
src/params/XmlSubPage.xml | 10 +
src/params/XmlViewNode.xml | 10 +
src/params/YCoordinate.xml | 10 +
src/params/YDateCoordinate.xml | 10 +
src/params/YHyperCoordinate.xml | 10 +
src/params/YLogarithmicCoordinate.xml | 10 +
src/params/YRegularCoordinate.xml | 10 +
src/params/todo.xml | 10 +
src/terralib/CMakeLists.txt | 133 +-
src/terralib/jpeg/ijl.h | 1513 ---
src/terralib/jpeg/jpeg.h | 95 -
src/terralib/kernel/Gra_algo.h | 195 -
src/terralib/kernel/TeAbstractFactory.h | 145 -
src/terralib/kernel/TeAbstractTheme.cpp | 1255 ---
src/terralib/kernel/TeAbstractTheme.h | 673 --
src/terralib/kernel/TeAffineGT.cpp | 211 -
src/terralib/kernel/TeAffineGT.h | 94 -
src/terralib/kernel/TeAffineGTFactory.cpp | 48 -
src/terralib/kernel/TeAffineGTFactory.h | 71 -
src/terralib/kernel/TeAgnostic.cpp | 14 -
src/terralib/kernel/TeAgnostic.h | 395 -
src/terralib/kernel/TeAkimaInterpolator.cpp | 1067 ---
src/terralib/kernel/TeAsciiFile.cpp | 363 -
src/terralib/kernel/TeAsciiFile.h | 132 -
src/terralib/kernel/TeAssertions.h | 35 -
src/terralib/kernel/TeAttribute.h | 174 -
src/terralib/kernel/TeBaseSTInstance.h | 552 --
src/terralib/kernel/TeBaseSTInstanceSet.h | 1212 ---
src/terralib/kernel/TeBlockLoader.cpp | 171 -
src/terralib/kernel/TeBlockLoader.h | 95 -
src/terralib/kernel/TeBox.cpp | 32 +-
src/terralib/kernel/TeBox.h | 32 +-
src/terralib/kernel/TeBufferRegion.cpp | 1073 ---
src/terralib/kernel/TeBufferRegion.h | 156 -
src/terralib/kernel/TeCentroid.cpp | 416 -
src/terralib/kernel/TeCommunicator.h | 413 -
src/terralib/kernel/TeComposite.h | 32 +-
src/terralib/kernel/TeConsoleErrorMessage.cpp | 29 -
src/terralib/kernel/TeConsoleErrorMessage.h | 62 -
src/terralib/kernel/TeCoord2D.h | 32 +-
src/terralib/kernel/TeCounted.h | 32 +-
src/terralib/kernel/TeDBConnection.cpp | 619 --
src/terralib/kernel/TeDBConnection.h | 207 -
src/terralib/kernel/TeDBConnectionsPool.cpp | 403 -
src/terralib/kernel/TeDBConnectionsPool.h | 210 -
src/terralib/kernel/TeDataTypes.h | 32 +-
src/terralib/kernel/TeDatabase.cpp | 9712 --------------------
src/terralib/kernel/TeDatabase.h | 1695 ----
src/terralib/kernel/TeDatabaseFactory.h | 59 -
src/terralib/kernel/TeDatabaseFactoryParams.cpp | 77 -
src/terralib/kernel/TeDatabaseFactoryParams.h | 71 -
src/terralib/kernel/TeDatum.cpp | 32 +-
src/terralib/kernel/TeDatum.h | 32 +-
src/terralib/kernel/TeDecoder.h | 214 -
src/terralib/kernel/TeDecoderASCIIGrid.cpp | 416 -
src/terralib/kernel/TeDecoderASCIIGrid.h | 97 -
src/terralib/kernel/TeDecoderDatabase.cpp | 534 --
src/terralib/kernel/TeDecoderDatabase.h | 158 -
src/terralib/kernel/TeDecoderFile.cpp | 361 -
src/terralib/kernel/TeDecoderFile.h | 84 -
src/terralib/kernel/TeDecoderJPEG.cpp | 233 -
src/terralib/kernel/TeDecoderJPEG.h | 81 -
src/terralib/kernel/TeDecoderMemory.cpp | 591 --
src/terralib/kernel/TeDecoderMemory.h | 279 -
src/terralib/kernel/TeDecoderMemoryMap.cpp | 430 -
src/terralib/kernel/TeDecoderMemoryMap.h | 94 -
src/terralib/kernel/TeDecoderSPR.cpp | 399 -
src/terralib/kernel/TeDecoderSPR.h | 80 -
src/terralib/kernel/TeDecoderSmartMem.cpp | 539 --
src/terralib/kernel/TeDecoderSmartMem.h | 382 -
src/terralib/kernel/TeDecoderTIFF.cpp | 1214 ---
src/terralib/kernel/TeDecoderTIFF.h | 185 -
src/terralib/kernel/TeDecoderVirtualMemory.cpp | 473 -
src/terralib/kernel/TeDecoderVirtualMemory.h | 241 -
src/terralib/kernel/TeDefines.h | 32 +-
src/terralib/kernel/TeErrorLog.cpp | 91 +-
src/terralib/kernel/TeErrorLog.h | 32 +-
src/terralib/kernel/TeErrorMessage.cpp | 33 -
src/terralib/kernel/TeErrorMessage.h | 110 -
src/terralib/kernel/TeException.cpp | 30 +-
src/terralib/kernel/TeException.h | 32 +-
src/terralib/kernel/TeExternalTheme.cpp | 1447 ---
src/terralib/kernel/TeExternalTheme.h | 422 -
src/terralib/kernel/TeFactory.h | 145 -
src/terralib/kernel/TeFragmentation.cpp | 666 --
src/terralib/kernel/TeFragmentation.h | 61 -
src/terralib/kernel/TeGTFactory.cpp | 32 -
src/terralib/kernel/TeGTFactory.h | 78 -
src/terralib/kernel/TeGTParams.cpp | 86 -
src/terralib/kernel/TeGTParams.h | 186 -
src/terralib/kernel/TeGeometricTransformation.cpp | 637 --
src/terralib/kernel/TeGeometricTransformation.h | 322 -
src/terralib/kernel/TeGeometry.cpp | 32 +-
src/terralib/kernel/TeGeometry.h | 33 +-
src/terralib/kernel/TeGeometryAlgorithms.cpp | 2834 ------
src/terralib/kernel/TeGeometryAlgorithms.h | 1019 --
src/terralib/kernel/TeGroupingAlgorithms.cpp | 112 -
src/terralib/kernel/TeGroupingAlgorithms.h | 281 -
src/terralib/kernel/TeImportRaster.cpp | 687 --
src/terralib/kernel/TeImportRaster.h | 105 -
src/terralib/kernel/TeInitRasterDecoders.cpp | 80 -
src/terralib/kernel/TeInitRasterDecoders.h | 37 -
src/terralib/kernel/TeIntersector.cpp | 1056 ---
src/terralib/kernel/TeIntersector.h | 214 -
src/terralib/kernel/TeKdTree.h | 1190 ---
src/terralib/kernel/TeLayer.cpp | 1243 ---
src/terralib/kernel/TeLayer.h | 432 -
src/terralib/kernel/TeLegendEntry.cpp | 174 -
src/terralib/kernel/TeLegendEntry.h | 168 -
src/terralib/kernel/TeMappedMemory.cpp | 415 -
src/terralib/kernel/TeMappedMemory.h | 232 -
src/terralib/kernel/TeMatrix.cpp | 1540 ----
src/terralib/kernel/TeMatrix.h | 198 -
src/terralib/kernel/TeMeasure.h | 32 +-
src/terralib/kernel/TeMetaModelCache.cpp | 40 -
src/terralib/kernel/TeMetaModelCache.h | 118 -
src/terralib/kernel/TeMultiContainer.h | 625 --
src/terralib/kernel/TeMultiGeometry.cpp | 31 +-
src/terralib/kernel/TeMultiGeometry.h | 32 +-
src/terralib/kernel/TeMutex.cpp | 59 -
src/terralib/kernel/TeMutex.h | 179 -
src/terralib/kernel/TeNeighbours.cpp | 221 -
src/terralib/kernel/TeNeighbours.h | 207 -
src/terralib/kernel/TeNetwork.cpp | 578 --
src/terralib/kernel/TeNetwork.h | 160 -
src/terralib/kernel/TeOverlay.cpp | 763 --
src/terralib/kernel/TeOverlay.h | 214 -
src/terralib/kernel/TeOverlayUtils.cpp | 1222 ---
src/terralib/kernel/TeOverlayUtils.h | 172 -
src/terralib/kernel/TePieBar.h | 317 -
src/terralib/kernel/TePrecision.h | 32 +-
src/terralib/kernel/TeProgress.cpp | 37 -
src/terralib/kernel/TeProgress.h | 67 -
src/terralib/kernel/TeProgressBase.h | 76 -
src/terralib/kernel/TeProject.cpp | 291 -
src/terralib/kernel/TeProject.h | 176 -
src/terralib/kernel/TeProjection.cpp | 31 +-
src/terralib/kernel/TeProjection.h | 32 +-
src/terralib/kernel/TeProjectiveGT.cpp | 571 --
src/terralib/kernel/TeProjectiveGT.h | 118 -
src/terralib/kernel/TeProjectiveGTFactory.cpp | 49 -
src/terralib/kernel/TeProjectiveGTFactory.h | 67 -
src/terralib/kernel/TePrototype.h | 83 -
.../kernel/TeProxMatrixConstructionStrategy.cpp | 922 --
.../kernel/TeProxMatrixConstructionStrategy.h | 491 -
src/terralib/kernel/TeProxMatrixImplementation.cpp | 498 -
src/terralib/kernel/TeProxMatrixImplementation.h | 215 -
src/terralib/kernel/TeProxMatrixSlicingStrategy.h | 113 -
src/terralib/kernel/TeProxMatrixStrategies.cpp | 296 -
src/terralib/kernel/TeProxMatrixWeightsStrategy.h | 168 -
src/terralib/kernel/TeQuerier.cpp | 204 -
src/terralib/kernel/TeQuerier.h | 154 -
src/terralib/kernel/TeQuerierDB.cpp | 536 --
src/terralib/kernel/TeQuerierDB.h | 122 -
src/terralib/kernel/TeQuerierDBStr1.cpp | 1174 ---
src/terralib/kernel/TeQuerierDBStr1.h | 123 -
src/terralib/kernel/TeQuerierDBStr2.cpp | 350 -
src/terralib/kernel/TeQuerierDBStr2.h | 106 -
src/terralib/kernel/TeQuerierDBStr3.cpp | 421 -
src/terralib/kernel/TeQuerierDBStr3.h | 112 -
src/terralib/kernel/TeQuerierImpl.cpp | 144 -
src/terralib/kernel/TeQuerierImpl.h | 122 -
src/terralib/kernel/TeQuerierParams.cpp | 286 -
src/terralib/kernel/TeQuerierParams.h | 233 -
src/terralib/kernel/TeRTree.h | 980 --
src/terralib/kernel/TeRaster.cpp | 1049 ---
src/terralib/kernel/TeRaster.h | 525 --
src/terralib/kernel/TeRasterMemManager.cpp | 404 -
src/terralib/kernel/TeRasterMemManager.h | 240 -
src/terralib/kernel/TeRasterParams.cpp | 877 --
src/terralib/kernel/TeRasterParams.h | 500 -
src/terralib/kernel/TeRasterRemap.cpp | 697 --
src/terralib/kernel/TeRasterRemap.h | 131 -
src/terralib/kernel/TeRasterTransform.cpp | 136 -
src/terralib/kernel/TeRasterTransform.h | 357 -
src/terralib/kernel/TeRedBlackTree.h | 763 --
src/terralib/kernel/TeRepresentation.cpp | 34 -
src/terralib/kernel/TeRepresentation.h | 78 -
src/terralib/kernel/TeSTEFunctionsDB.h | 432 -
src/terralib/kernel/TeSTElementSet.cpp | 256 -
src/terralib/kernel/TeSTElementSet.h | 125 -
src/terralib/kernel/TeSTEvent.cpp | 207 -
src/terralib/kernel/TeSTEvent.h | 132 -
src/terralib/kernel/TeSTInstance.cpp | 353 -
src/terralib/kernel/TeSTInstance.h | 174 -
src/terralib/kernel/TeSharedPtr.h | 435 -
src/terralib/kernel/TeSingleton.h | 32 +-
src/terralib/kernel/TeSlice.h | 77 -
src/terralib/kernel/TeSparseMatrix.h | 274 -
src/terralib/kernel/TeSpatialOperations.cpp | 1660 ----
src/terralib/kernel/TeSpatialOperations.h | 283 -
src/terralib/kernel/TeStatistics.h | 664 --
src/terralib/kernel/TeStdFile.cpp | 60 -
src/terralib/kernel/TeStdFile.h | 84 -
src/terralib/kernel/TeTable.cpp | 376 -
src/terralib/kernel/TeTable.h | 393 -
src/terralib/kernel/TeTemporalSeries.cpp | 290 -
src/terralib/kernel/TeTemporalSeries.h | 192 -
src/terralib/kernel/TeTheme.cpp | 2493 -----
src/terralib/kernel/TeTheme.h | 443 -
src/terralib/kernel/TeThread.cpp | 263 -
src/terralib/kernel/TeThread.h | 157 -
src/terralib/kernel/TeThreadDatatypes.h | 59 -
src/terralib/kernel/TeThreadFunctor.cpp | 56 -
src/terralib/kernel/TeThreadFunctor.h | 116 -
src/terralib/kernel/TeThreadParameters.h | 40 -
src/terralib/kernel/TeThreadSignal.cpp | 192 -
src/terralib/kernel/TeThreadSignal.h | 141 -
src/terralib/kernel/TeTime.cpp | 631 --
src/terralib/kernel/TeTime.h | 153 -
src/terralib/kernel/TeTimeInterval.cpp | 181 -
src/terralib/kernel/TeTimeInterval.h | 169 -
src/terralib/kernel/TeTin.cpp | 1796 ----
src/terralib/kernel/TeTin.h | 445 -
src/terralib/kernel/TeUtils.cpp | 33 +-
src/terralib/kernel/TeUtils.h | 33 +-
src/terralib/kernel/TeVectorRemap.cpp | 160 -
src/terralib/kernel/TeVectorRemap.h | 86 -
src/terralib/kernel/TeView.h | 233 -
src/terralib/kernel/TeViewNode.cpp | 362 -
src/terralib/kernel/TeViewNode.h | 404 -
src/terralib/kernel/TeVisual.cpp | 258 -
src/terralib/kernel/TeVisual.h | 368 -
src/terralib/kernel/checkvec.h | 71 -
src/terralib/kernel/dynpq.h | 191 -
src/terralib/kernel/graph.h | 379 -
src/terralib/kernel/lexTemporal.cpp | 1927 ----
src/terralib/kernel/showseq.h | 23 -
src/terralib/kernel/yyTemporal.cpp | 495 -
src/terralib/kernel/yyTemporal.h | 35 -
src/terralib/utils/TeColorUtils.cpp | 780 --
src/terralib/utils/TeColorUtils.h | 92 -
src/terralib/utils/TeDatabaseUtils.cpp | 582 --
src/terralib/utils/TeDatabaseUtils.h | 167 -
src/terralib/utils/TeUpdateDBVersion.cpp | 1504 ---
src/terralib/utils/TeUpdateDBVersion.h | 60 -
src/terralib/utils/mtrand.cpp | 50 -
src/terralib/utils/mtrand.h | 153 -
src/visualisers/Akima474.cc | 26 +-
src/visualisers/Akima474Method.h | 26 +-
src/visualisers/Akima760.cc | 26 +-
src/visualisers/Akima760Method.cc | 26 +-
src/visualisers/Akima760Method.h | 26 +-
src/visualisers/Akima761.cc | 26 +-
src/visualisers/Akima761Method.cc | 26 +-
src/visualisers/Akima761Method.h | 26 +-
src/visualisers/ArrowPlotting.cc | 26 +-
src/visualisers/ArrowPlotting.h | 26 +-
src/visualisers/AutomaticContourMethod.h | 26 +-
src/visualisers/Axis.cc | 30 +-
src/visualisers/Axis.h | 26 +-
src/visualisers/AxisControl.cc | 26 +-
src/visualisers/AxisControl.h | 26 +-
src/visualisers/AxisGrid.cc | 26 +-
src/visualisers/AxisGrid.h | 26 +-
src/visualisers/AxisItem.cc | 26 +-
src/visualisers/AxisItem.h | 26 +-
src/visualisers/AxisLine.cc | 26 +-
src/visualisers/AxisLine.h | 26 +-
src/visualisers/AxisMethod.cc | 26 +-
src/visualisers/AxisMethod.h | 26 +-
src/visualisers/AxisMinorTick.cc | 26 +-
src/visualisers/AxisMinorTick.h | 26 +-
src/visualisers/AxisTick.cc | 26 +-
src/visualisers/AxisTick.h | 26 +-
src/visualisers/AxisTickLabelType.cc | 26 +-
src/visualisers/AxisTickLabelType.h | 26 +-
src/visualisers/AxisTip.cc | 10 +
src/visualisers/AxisTip.h | 10 +
src/visualisers/AxisType.cc | 26 +-
src/visualisers/AxisType.h | 26 +-
src/visualisers/Bar.cc | 26 +-
src/visualisers/Bar.h | 26 +-
src/visualisers/BothValuePlotMethod.h | 26 +-
src/visualisers/Boundaries.cc | 26 +-
src/visualisers/Boundaries.h | 26 +-
src/visualisers/BoxPlotBasicItem.h | 26 +-
src/visualisers/BoxPlotItem.cc | 26 +-
src/visualisers/BoxPlotItem.h | 26 +-
src/visualisers/BoxPlotVisualiser.cc | 26 +-
src/visualisers/BoxPlotVisualiser.h | 26 +-
src/visualisers/CalculateColourTechnique.cc | 26 +-
src/visualisers/CalculateColourTechnique.h | 26 +-
src/visualisers/CalmIndicator.h | 26 +-
src/visualisers/CellShading.cc | 26 +-
src/visualisers/CellShading.h | 26 +-
src/visualisers/Cities.cc | 26 +-
src/visualisers/Cities.h | 26 +-
src/visualisers/CoastPlotting.cc | 26 +-
src/visualisers/CoastPlotting.h | 26 +-
src/visualisers/Coastlines.cc | 26 +-
src/visualisers/Coastlines.h | 26 +-
src/visualisers/ColourSelection.cc | 26 +-
src/visualisers/ColourSelection.h | 26 +-
src/visualisers/ColourSelectionCount.cc | 26 +-
src/visualisers/ColourSelectionCount.h | 26 +-
src/visualisers/ColourSelectionList.cc | 26 +-
src/visualisers/ColourSelectionList.h | 26 +-
src/visualisers/ColourTechnique.cc | 26 +-
src/visualisers/ColourTechnique.h | 26 +-
src/visualisers/Contour.cc | 26 +-
src/visualisers/Contour.h | 26 +-
src/visualisers/ContourLibrary.cc | 10 +
src/visualisers/ContourLibrary.h | 10 +
src/visualisers/ContourMethod.h | 26 +-
src/visualisers/CountSelectionType.cc | 26 +-
src/visualisers/CountSelectionType.h | 26 +-
src/visualisers/Curve.cc | 26 +-
src/visualisers/Curve.h | 26 +-
src/visualisers/DateAxis.cc | 26 +-
src/visualisers/DateAxis.h | 26 +-
src/visualisers/DefinitionTable.h | 26 +-
src/visualisers/DefinitionTable.hcc | 26 +-
src/visualisers/DotPolyShadingMethod.h | 26 +-
src/visualisers/EpsForecastPlot.h | 26 +-
src/visualisers/EpsGraph.cc | 27 +-
src/visualisers/EpsGraph.h | 26 +-
src/visualisers/EquidistantTableMode.cc | 26 +-
src/visualisers/EquidistantTableMode.h | 26 +-
src/visualisers/Filter.cc | 26 +-
src/visualisers/Filter.h | 26 +-
src/visualisers/FlagPlotting.cc | 26 +-
src/visualisers/FlagPlotting.h | 26 +-
src/visualisers/FloatSelection.cc | 26 +-
src/visualisers/FloatSelection.h | 26 +-
src/visualisers/Graph.h | 26 +-
src/visualisers/GraphPlotting.cc | 26 +-
src/visualisers/GraphPlotting.h | 26 +-
src/visualisers/GraphShade.cc | 26 +-
src/visualisers/GraphShade.h | 26 +-
src/visualisers/GraphShadeStyle.cc | 26 +-
src/visualisers/GraphShadeStyle.h | 26 +-
src/visualisers/GribTables.h | 26 +-
src/visualisers/GridPlotting.cc | 26 +-
src/visualisers/GridPlotting.h | 26 +-
src/visualisers/HatchPolyShadingMethod.h | 26 +-
src/visualisers/HeightSelection.cc | 26 +-
src/visualisers/HeightSelection.h | 26 +-
src/visualisers/HeightSelectionCount.h | 26 +-
src/visualisers/HeightSelectionList.h | 26 +-
src/visualisers/HeightTechnique.cc | 26 +-
src/visualisers/HeightTechnique.h | 26 +-
src/visualisers/HiLo.cc | 26 +-
src/visualisers/HiLo.h | 26 +-
src/visualisers/HiLoBase.h | 26 +-
src/visualisers/HiLoBoth.h | 26 +-
src/visualisers/HiLoMarker.h | 26 +-
src/visualisers/HiLoMarkerBase.h | 26 +-
src/visualisers/HiLoNumber.h | 26 +-
src/visualisers/HiLoTechnique.h | 26 +-
src/visualisers/HiLoText.h | 26 +-
src/visualisers/HistoIndividualMode.h | 26 +-
src/visualisers/HistoMode.h | 26 +-
src/visualisers/HistoTableMode.h | 26 +-
src/visualisers/Histogram.cc | 26 +-
src/visualisers/Histogram.h | 26 +-
src/visualisers/ImageCalculateColourTechnique.h | 26 +-
src/visualisers/ImageListColourTechnique.h | 26 +-
src/visualisers/ImportPlot.h | 26 +-
src/visualisers/IntervalSelectionType.cc | 26 +-
src/visualisers/IntervalSelectionType.h | 26 +-
src/visualisers/Intervals.h | 26 +-
src/visualisers/IsoHelper.cc | 10 +
src/visualisers/IsoHelper.h | 10 +
src/visualisers/IsoHighlight.h | 26 +-
src/visualisers/IsoLabel.cc | 26 +-
src/visualisers/IsoLabel.h | 26 +-
src/visualisers/IsoPlot.cc | 41 +-
src/visualisers/IsoPlot.h | 26 +-
src/visualisers/IsoShading.cc | 26 +-
src/visualisers/IsoShading.h | 26 +-
src/visualisers/LabelPlotting.cc | 26 +-
src/visualisers/LabelPlotting.h | 26 +-
src/visualisers/LabelPlottingBase.h | 26 +-
src/visualisers/LegendMethod.cc | 48 +-
src/visualisers/LegendMethod.h | 26 +-
src/visualisers/LevelListSelectionType.cc | 26 +-
src/visualisers/LevelListSelectionType.h | 26 +-
src/visualisers/LevelSelection.cc | 26 +-
src/visualisers/LevelSelection.h | 26 +-
src/visualisers/LinearTableMode.cc | 26 +-
src/visualisers/LinearTableMode.h | 26 +-
src/visualisers/ListColourTechnique.cc | 26 +-
src/visualisers/ListColourTechnique.h | 26 +-
src/visualisers/LookupTableMode.cc | 26 +-
src/visualisers/LookupTableMode.h | 26 +-
src/visualisers/MarkerSelection.h | 26 +-
src/visualisers/MarkerSelectionCount.h | 26 +-
src/visualisers/MarkerSelectionList.h | 26 +-
src/visualisers/MarkerShadingTechnique.cc | 26 +-
src/visualisers/MarkerShadingTechnique.h | 26 +-
src/visualisers/MarkerValuePlotMethod.h | 26 +-
src/visualisers/MetgramGraph.cc | 26 +-
src/visualisers/MetgramGraph.h | 26 +-
src/visualisers/MetgramStyle.cc | 26 +-
src/visualisers/MetgramStyle.h | 26 +-
src/visualisers/NormalTableMode.cc | 26 +-
src/visualisers/NormalTableMode.h | 26 +-
src/visualisers/ObsItem.h | 26 +-
src/visualisers/ObsItemFamily.cc | 43 +-
src/visualisers/ObsItemFamily.h | 26 +-
src/visualisers/ObsPlotting.cc | 26 +-
src/visualisers/ObsPlotting.h | 26 +-
src/visualisers/ObsTable.cc | 26 +-
src/visualisers/ObsTable.h | 26 +-
src/visualisers/OriginMarker.h | 26 +-
src/visualisers/OutLayerTechnique.cc | 26 +-
src/visualisers/OutLayerTechnique.h | 26 +-
src/visualisers/PolyShadingMethod.cc | 26 +-
src/visualisers/PolyShadingMethod.h | 26 +-
src/visualisers/PolyShadingTechnique.cc | 26 +-
src/visualisers/PolyShadingTechnique.h | 26 +-
src/visualisers/SegmentJoiner.cc | 2 +-
src/visualisers/SegmentJoiner.h | 2 +-
src/visualisers/ShadingTechnique.h | 26 +-
src/visualisers/SimplePolylineVisualiser.cc | 26 +-
src/visualisers/SimplePolylineVisualiser.h | 26 +-
src/visualisers/Streamlines.cc | 28 +-
src/visualisers/Streamlines.h | 26 +-
src/visualisers/SymbolAdvancedTableMode.cc | 26 +-
src/visualisers/SymbolAdvancedTableMode.h | 26 +-
src/visualisers/SymbolMode.cc | 26 +-
src/visualisers/SymbolMode.h | 30 +-
src/visualisers/SymbolPlotting.cc | 26 +-
src/visualisers/SymbolPlotting.h | 26 +-
src/visualisers/TaylorGrid.cc | 26 +-
src/visualisers/TaylorGrid.h | 26 +-
src/visualisers/TephiGrid.cc | 26 +-
src/visualisers/TephiGrid.h | 26 +-
src/visualisers/TextOrientation.cc | 26 +-
src/visualisers/TextOrientation.h | 26 +-
src/visualisers/UserDate.cc | 26 +-
src/visualisers/UserDate.h | 26 +-
src/visualisers/ValuePlot.cc | 26 +-
src/visualisers/ValuePlot.h | 26 +-
src/visualisers/ValuePlotBase.h | 26 +-
src/visualisers/ValuePlotMethod.h | 26 +-
src/visualisers/VisDefInfo.cc | 10 +
src/visualisers/VisDefInfo.h | 26 +-
src/visualisers/Wind.cc | 26 +-
src/visualisers/Wind.h | 26 +-
src/visualisers/WindPlotting.cc | 26 +-
src/visualisers/WindPlotting.h | 26 +-
src/web/GeoJSon.cc | 40 +-
src/web/GeoJSon.h | 38 +-
src/web/MagConfig.cc | 40 +-
src/web/MagConfig.h | 37 +-
src/web/MagJSon.cc | 26 +-
src/web/MagJSon.h | 26 +-
src/web/ObsJSon.cc | 39 +-
src/web/ObsJSon.h | 26 +-
src/web/WrepJSon.cc | 39 +-
src/web/WrepJSon.h | 36 +-
src/web/json_spirit.vcproj | 213 -
test/bufr.f90 | 9 +
test/bufr.py | 8 +
test/cairo.f90 | 9 +
test/cairo.py | 8 +
test/coast.c | 10 +
test/coast.f90 | 9 +
test/coast.py | 8 +
test/grib.f90 | 9 +
test/grib.py | 8 +
test/odb.py | 8 +
tools/RPM_build_specs/emoslib/generateRPM.sh | 8 +
tools/axis2doc.py | 8 +
tools/beau.py | 8 +
tools/beautify-xml.py | 8 +
tools/generateDebugLibs.sh | 8 +
tools/magml2json.pl | 8 +
tools/mergexml.pl | 8 +
tools/metview.py | 8 +
tools/newbase.pl | 8 +
tools/newclass.pl | 8 +
tools/newdriver.pl | 8 +
tools/newfactory.pl | 8 +
tools/newprojection.pl | 8 +
tools/newtemplate.pl | 8 +
tools/xml2cc.pl | 8 +
tools/xml2cc_list.pl | 8 +
tools/xml2cc_new.pl | 8 +
tools/xml2doc.pl | 8 +
tools/xml2doc.py | 8 +
tools/xml2dtd.pl | 8 +
tools/xml2html.py | 8 +
tools/xml2icon.pl | 8 +
tools/xml2mv.pl | 8 +
tools/xml2mv.py | 8 +
tools/xml2odt.py | 8 +
tools/xml2odt.sh | 8 +
tools/xml2split.py | 8 +
utils/bufrgram.py | 8 +
utils/epsgrams.py | 8 +
utils/input/37.00_35.32_10u.json | 223 -
utils/input/37.00_35.32_10uv.json | 223 -
utils/input/37.00_35.32_10v.json | 156 -
utils/input/37.00_35.32_2t.json | 156 -
utils/input/37.00_35.32_cp.json | 156 -
utils/input/37.00_35.32_msl.json | 156 -
utils/input/37.00_35.32_r.json | 156 -
utils/input/37.00_35.32_t.json | 156 -
utils/input/37.00_35.32_tcc.json | 156 -
utils/input/41.30_10.50_10u.json | 225 -
utils/input/41.30_10.50_10v.json | 156 -
utils/input/41.30_10.50_2t.json | 156 -
utils/input/41.30_10.50_cp.json | 156 -
utils/input/41.30_10.50_msl.json | 156 -
utils/input/41.30_10.50_r.json | 156 -
utils/input/41.30_10.50_t.json | 156 -
utils/input/41.30_10.50_tcc.json | 156 -
utils/input/43.30_-8.50_10u.json | 156 -
utils/input/43.30_-8.50_10v.json | 156 -
utils/input/43.30_-8.50_2t.json | 156 -
utils/input/43.30_-8.50_cp.json | 156 -
utils/input/43.30_-8.50_msl.json | 156 -
utils/input/43.30_-8.50_r.json | 156 -
utils/input/43.30_-8.50_t.json | 156 -
utils/input/43.30_-8.50_tcc.json | 156 -
utils/input/GRA04190000042900001 | Bin 26400 -> 0 bytes
utils/input/adana.json | 12 -
utils/input/stations_classic.json | 19 -
utils/input/tempe.json | 156 -
utils/metgram.py | 8 +
utils/plumes.py | 8 +
version.sh | 32 -
1455 files changed, 13038 insertions(+), 107257 deletions(-)
diff --git a/.gitignore b/.gitignore
index 9fd6354..cca5fde 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*~
*.o
*.ps
+*.js
*.png
*.grib
*.grb
diff --git a/AUTHORS b/AUTHORS
index 39e765b..085675b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,11 +1,9 @@
-Authors of Magics++
-===================
-
-The main development of Magics++ is done through the
+Authors of Magics
+=================
- Meteorological Visualisation Section
+The main development of Magics is done through the
-at the
+ Development Section
European Centre for Medium-Range Weather Forecasts
(ECMWF - http://www.ecmwf.int )
@@ -19,17 +17,23 @@ Stephan Siemen
Fernando Ii
Iain Russell
Sandor Kertesz
-Peter Bispham
Past developers
===============
Vesa Karhila
+Peter Bispham
Thanks for contributions from:
==============================
-INPE/CPTEC for Terralib
-Carlos Valiente (contributions to configure scripts - magics.m4)
-Anne Fouilloux (first version of the swig Python interface)
+INPE/CPTEC for Terralib & Akima code
+
+Carlos Valiente (ECMWF, contributions to configure scripts - magics.m4)
+
+Anne Fouilloux (ECMWF, first version of the swig Python interface)
+
+Mark Rajnai (Hungarian Meteorological Service, for Streamlines)
+
+Alastair McKinstry (Debian/Ubuntu)
diff --git a/CMakeFiles/cmake.check_cache b/CMakeFiles/cmake.check_cache
deleted file mode 100644
index 3dccd73..0000000
--- a/CMakeFiles/cmake.check_cache
+++ /dev/null
@@ -1 +0,0 @@
-# This file is generated by cmake for dependency checking of the CMakeCache.txt file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f26bd92..007014f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,7 +40,19 @@ ecbuild_requires_macro_version( 1.9 )
###############################################################################
# some variables of this project
-ecbuild_use_package(PROJECT grib_api VERSION 1.14.6 REQUIRED)
+ecbuild_add_option( FEATURE ECCODES DESCRIPTION "" DEFAULT OFF )
+
+if( HAVE_ECCODES )
+ ecbuild_use_package( PROJECT eccodes VERSION 0.14 REQUIRED )
+ set( GRIB_API_INCLUDE_DIRS ${ECCODES_INCLUDE_DIRS} )
+ set( GRIB_API_LIBRARIES ${ECCODES_LIBRARIES} )
+ set( GRIB_API_DEFINITIONS ${ECCODES_DEFINITIONS} )
+ set( grib_api_BASE_DIR ${eccodes_BASE_DIR} )
+else()
+ ecbuild_use_package(PROJECT grib_api VERSION 1.14.6 REQUIRED)
+endif()
+
+
# grib_api is required for now
set( HAVE_GRIB 1 )
@@ -125,7 +137,7 @@ set( MAGICS_EXCEPTION "ON" )
set( MAGICS_SITE "ecmwf" )
set( MAGICS_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} )
-set( MAGICS_REFERENCE_VERSIONS "2.28.0" )
+set( MAGICS_REFERENCE_VERSIONS "2.29.1" )
set( MAGICS_HTML_ROOT "${CMAKE_BINARY_DIR}/regression/html")
file(MAKE_DIRECTORY ${MAGICS_HTML_ROOT} )
@@ -218,7 +230,6 @@ set( MAGICS_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/src/decoders
${CMAKE_CURRENT_SOURCE_DIR}/src/terralib
${CMAKE_CURRENT_SOURCE_DIR}/src/terralib/kernel
- ${CMAKE_CURRENT_SOURCE_DIR}/src/terralib/utils
${CMAKE_CURRENT_SOURCE_DIR}/src/libMagWrapper
${Boost_INCLUDE_DIRS} )
diff --git a/NOTICE b/NOTICE
index 44d7270..be77213 100644
--- a/NOTICE
+++ b/NOTICE
@@ -28,6 +28,30 @@ ECMWF has a close co-operation with INPE regarding the development of
visualisation software.
+CalcStreamlines
+===============
+
+/*
+ CalcStreamlines is a function for calculating streamlines for wind field
+
+ Copyright (C) 2010 Hungarian Meteorological Service
+
+ Author: Mark Rajnai (rajnai.m at met.hu)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+
shapelib
========
http://shapelib.maptools.org/license.html
diff --git a/Testing/Temporary/CTestCostData.txt b/Testing/Temporary/CTestCostData.txt
deleted file mode 100644
index ed97d53..0000000
--- a/Testing/Temporary/CTestCostData.txt
+++ /dev/null
@@ -1 +0,0 @@
----
diff --git a/VERSION.cmake b/VERSION.cmake
index f3b09a2..072254a 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -1,6 +1,14 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+set ( metabuilder_version 2.30.0 )
+set ( _version 2.30.0 )
-set ( metabuilder_version 2.29.0 )
-set ( _version 2.29.0 )
if ( MAGICS_BUILD )
set( ${PROJECT_NAME}_VERSION_STR "${_version}-${MAGICS_BUILD}" )
else ()
diff --git a/apps/MagMLInterpretor/json.cc b/apps/MagMLInterpretor/json.cc
index cc64cf0..a20c97a 100644
--- a/apps/MagMLInterpretor/json.cc
+++ b/apps/MagMLInterpretor/json.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#include <unistd.h>
#include <signal.h>
#include "WebFormat.h"
diff --git a/apps/metgram/10_days_metgram_a3.xml b/apps/metgram/10_days_metgram_a3.xml
index ead6485..8b5a456 100644
--- a/apps/metgram/10_days_metgram_a3.xml
+++ b/apps/metgram/10_days_metgram_a3.xml
@@ -1,4 +1,14 @@
<?xml version="1.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" format="a3" orientation="portrait">
<definition>
<metgram id="station"
diff --git a/apps/metgram/10_days_wave_epsgram_a3.xml b/apps/metgram/10_days_wave_epsgram_a3.xml
index 0bbdf01..e0289e1 100644
--- a/apps/metgram/10_days_wave_epsgram_a3.xml
+++ b/apps/metgram/10_days_wave_epsgram_a3.xml
@@ -1,4 +1,14 @@
<?xml version="1.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" format="a3" orientation="portrait">
<definition>
<epsgram id="eps_wave"
diff --git a/apps/metgram/anna.pl b/apps/metgram/anna.pl
index 1279344..c5f9f44 100755
--- a/apps/metgram/anna.pl
+++ b/apps/metgram/anna.pl
@@ -1,4 +1,12 @@
#!/webapps/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
##!/usr/local/bin/perl56
use strict;
diff --git a/apps/metgram/efiserver.pl b/apps/metgram/efiserver.pl
index 51e1c21..4765bc2 100755
--- a/apps/metgram/efiserver.pl
+++ b/apps/metgram/efiserver.pl
@@ -1,4 +1,12 @@
#!/webapps/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
##!/usr/local/bin/perl56
use strict;
diff --git a/apps/metgram/eps.xml b/apps/metgram/eps.xml
index cdad1fe..38ae7f3 100644
--- a/apps/metgram/eps.xml
+++ b/apps/metgram/eps.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<eps date='-1' time='1200' template='eps.template'
directory='/scratch/graphics/cgs/epsgram/new'>
<station name='Boulmer' latitude='55.42' longitude='-1.6'/>
diff --git a/apps/metgram/eps10.xml b/apps/metgram/eps10.xml
index c6620e7..931ab9b 100644
--- a/apps/metgram/eps10.xml
+++ b/apps/metgram/eps10.xml
@@ -1,5 +1,15 @@
<eps template='/tmp/cgs/perforce/mv4/apps/metgram/10_days_epsgram.xml' database='/scratch/graphics/cgs/efi/10_days/0001/2009042200' format='a4'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<station name='Reading' latitude='51.4' longitude='-1' height='48' psfile='Reading.ps'
diff --git a/apps/metgram/eps10_a3.xml b/apps/metgram/eps10_a3.xml
index 55a9c00..3d2a5e8 100644
--- a/apps/metgram/eps10_a3.xml
+++ b/apps/metgram/eps10_a3.xml
@@ -1,5 +1,15 @@
<eps template='10_days_epsgram_a3.xml' database='/vol/epsgram/data/spotbase/10_days/0001/latest' format='a3'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<station name='Reading' latitude='51.4' longitude='-1' height='48' psfile='Reading.ps'
diff --git a/apps/metgram/eps15.xml b/apps/metgram/eps15.xml
index 88e9b6e..1a91511 100644
--- a/apps/metgram/eps15.xml
+++ b/apps/metgram/eps15.xml
@@ -1,4 +1,14 @@
<eps template='/tmp/cgs/perforce/mv4/apps/metgram/15_days_epsgram.xml' database='/scratch/graphics/cgs/efi/15_days/0001/2009042200' format='a4'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<station name='Reading' latitude='51.4' longitude='-1' noheight='48'
psfile='eps15.ps'
pngfile='Reading15.png'
diff --git a/apps/metgram/eps15_a3.xml b/apps/metgram/eps15_a3.xml
index 5b86546..cbe1136 100644
--- a/apps/metgram/eps15_a3.xml
+++ b/apps/metgram/eps15_a3.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<eps template='15_days_epsgram_a3.xml'
database='/vol/epsgram/data/spotbase/15_days/0001/latest'
format='a3'>
diff --git a/apps/metgram/epsserver.pl b/apps/metgram/epsserver.pl
index 4271dfe..76b23b0 100755
--- a/apps/metgram/epsserver.pl
+++ b/apps/metgram/epsserver.pl
@@ -1,4 +1,12 @@
#!/webapps/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
##!/usr/local/bin/perl56
use strict;
diff --git a/apps/metgram/epswave.xml b/apps/metgram/epswave.xml
index 0fa3cfa..d216304 100644
--- a/apps/metgram/epswave.xml
+++ b/apps/metgram/epswave.xml
@@ -1,5 +1,15 @@
<eps template='/tmp/cgs/perforce/mv4/apps/metgram/10_days_wave_epsgram.xml' database='/scratch/graphics/cgs/efi/10_days_wave/0001/2009042200' format='a4'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<station name='hello' latitude='51.4' longitude='-10' psfile='epswave.ps'/>
diff --git a/apps/metgram/epswind.xml b/apps/metgram/epswind.xml
index d9eda83..932f558 100644
--- a/apps/metgram/epswind.xml
+++ b/apps/metgram/epswind.xml
@@ -1,5 +1,15 @@
<eps template='15_days_epsgram_with_wind.xml' database='/vol/epsgram/data/spotbase/15_days/0001/latest/epsdb' format='a4'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<station name='Reading' latitude='51.4' longitude='-1' height='48' psfile='reading.ps'
diff --git a/apps/metgram/magplusserver.pl b/apps/metgram/magplusserver.pl
index 1f71822..8756ec6 100755
--- a/apps/metgram/magplusserver.pl
+++ b/apps/metgram/magplusserver.pl
@@ -1,4 +1,12 @@
#!/webapps/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
##!/usr/local/bin/perl56
use strict;
diff --git a/apps/metgram/metgram.xml b/apps/metgram/metgram.xml
index 55069ab..ead5bee 100644
--- a/apps/metgram/metgram.xml
+++ b/apps/metgram/metgram.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<eps template='10_days_metgram' date='20100211' time='00'>
<station name='multi' lat='50' lon='-1' psfile='page1.ps'/>
diff --git a/apps/metgram/metgramx.cc b/apps/metgram/metgramx.cc
index ec15525..080b716 100644
--- a/apps/metgram/metgramx.cc
+++ b/apps/metgram/metgramx.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#include <iostream>
#include <XmlMagics.h>
diff --git a/apps/metgram/metview_metgramserver.pl b/apps/metgram/metview_metgramserver.pl
index 218f91c..c90d4eb 100755
--- a/apps/metgram/metview_metgramserver.pl
+++ b/apps/metgram/metview_metgramserver.pl
@@ -1,4 +1,12 @@
#!/webapps/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
##!/usr/local/bin/perl56
use strict;
diff --git a/apps/metgram/multi_metgrams.xml b/apps/metgram/multi_metgrams.xml
index bb58d7e..386371b 100644
--- a/apps/metgram/multi_metgrams.xml
+++ b/apps/metgram/multi_metgrams.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version='3' orientation='portrait' format='a3'>
<definition>
<metgram id="station1"
diff --git a/apps/metgram/multi_metgrams_page1.xml b/apps/metgram/multi_metgrams_page1.xml
index 58835c2..1042ba4 100644
--- a/apps/metgram/multi_metgrams_page1.xml
+++ b/apps/metgram/multi_metgrams_page1.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version='3' orientation='portrait' format='a3'>
<definition>
diff --git a/apps/metgram/multi_metgrams_page2.xml b/apps/metgram/multi_metgrams_page2.xml
index 1e2b704..ffce0df 100644
--- a/apps/metgram/multi_metgrams_page2.xml
+++ b/apps/metgram/multi_metgrams_page2.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version='3' orientation='portrait' format='a3'>
<definition>
<metgram id='station1'
diff --git a/apps/metgram/multi_metgrams_page3.xml b/apps/metgram/multi_metgrams_page3.xml
index 1ca4a9b..eb015f7 100644
--- a/apps/metgram/multi_metgrams_page3.xml
+++ b/apps/metgram/multi_metgrams_page3.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version='3' orientation='portrait' format='a3'>
<definition>
<metgram id='station1'
diff --git a/apps/metgram/multi_metgrams_page4.xml b/apps/metgram/multi_metgrams_page4.xml
index 98a602b..336f294 100644
--- a/apps/metgram/multi_metgrams_page4.xml
+++ b/apps/metgram/multi_metgrams_page4.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version='3' orientation='portrait' format='a3'>
<definition>
diff --git a/apps/metgram/templates/10_days_epsgram.xml b/apps/metgram/templates/10_days_epsgram.xml
index ac87e23..9e2bf8a 100644
--- a/apps/metgram/templates/10_days_epsgram.xml
+++ b/apps/metgram/templates/10_days_epsgram.xml
@@ -1,4 +1,14 @@
<?xml version="1.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" format="a4" orientation="portrait">
<definition>
diff --git a/apps/metgram/templates/10_days_epsgram_a3.xml b/apps/metgram/templates/10_days_epsgram_a3.xml
index a398279..a9b102f 100644
--- a/apps/metgram/templates/10_days_epsgram_a3.xml
+++ b/apps/metgram/templates/10_days_epsgram_a3.xml
@@ -1,4 +1,14 @@
<?xml version="1.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" format="a3" orientation="portrait">
<definition>
diff --git a/apps/metgram/templates/10_days_metgram.xml b/apps/metgram/templates/10_days_metgram.xml
index 8f7d464..76c2920 100644
--- a/apps/metgram/templates/10_days_metgram.xml
+++ b/apps/metgram/templates/10_days_metgram.xml
@@ -1,4 +1,14 @@
<?xml version="1.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" format="a4" orientation="portrait">
<definition>
<metgram id="station"
diff --git a/apps/metgram/templates/10_days_wave_epsgram.xml b/apps/metgram/templates/10_days_wave_epsgram.xml
index 6d52851..4074c29 100644
--- a/apps/metgram/templates/10_days_wave_epsgram.xml
+++ b/apps/metgram/templates/10_days_wave_epsgram.xml
@@ -1,4 +1,14 @@
<?xml version="1.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" format="a4" orientation="portrait">
<definition>
<epsgram id="eps_wave"
diff --git a/apps/metgram/templates/15_days_epsgram.xml b/apps/metgram/templates/15_days_epsgram.xml
index fd1990a..76f9459 100644
--- a/apps/metgram/templates/15_days_epsgram.xml
+++ b/apps/metgram/templates/15_days_epsgram.xml
@@ -1,4 +1,14 @@
<?xml version="1.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" format="a4" orientation="portrait">
<definition>
<epsgram id="eps"
diff --git a/apps/metgram/templates/15_days_epsgram_a3.xml b/apps/metgram/templates/15_days_epsgram_a3.xml
index d9fd0f9..583b120 100644
--- a/apps/metgram/templates/15_days_epsgram_a3.xml
+++ b/apps/metgram/templates/15_days_epsgram_a3.xml
@@ -1,4 +1,14 @@
<?xml version="1.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" format="a3" orientation="portrait">
<definition>
<epsgram id="eps"
diff --git a/apps/metgram/templates/15_days_with_clim_epsgram.xml b/apps/metgram/templates/15_days_with_clim_epsgram.xml
index 2123a73..75657b3 100644
--- a/apps/metgram/templates/15_days_with_clim_epsgram.xml
+++ b/apps/metgram/templates/15_days_with_clim_epsgram.xml
@@ -1,4 +1,14 @@
<?xml version="1.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" format="a4" orientation="portrait">
<definition>
<epsgram id="eps"
diff --git a/apps/metgram/templates/efi_distribution.xml b/apps/metgram/templates/efi_distribution.xml
index 22e056a..5c14542 100644
--- a/apps/metgram/templates/efi_distribution.xml
+++ b/apps/metgram/templates/efi_distribution.xml
@@ -1,4 +1,14 @@
<?xml version="2.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" orientation='portrait'>
<drivers>
<$ps/>
diff --git a/apps/metgram/templates/new_efi_distribution.xml b/apps/metgram/templates/new_efi_distribution.xml
index 60b9ccd..dc1ae1f 100755
--- a/apps/metgram/templates/new_efi_distribution.xml
+++ b/apps/metgram/templates/new_efi_distribution.xml
@@ -1,4 +1,14 @@
<?xml version="2.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="3.0" orientation='portrait'>
<drivers>
<$ps/>
diff --git a/apps/metgram/tigge_epsgram.xml b/apps/metgram/tigge_epsgram.xml
index e7a3559..6af0708 100644
--- a/apps/metgram/tigge_epsgram.xml
+++ b/apps/metgram/tigge_epsgram.xml
@@ -1,4 +1,14 @@
<?xml version="1.0"?>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics version="2.0">
<definition>
<epsgram id="station"
diff --git a/apps/metgram/wave10.xml b/apps/metgram/wave10.xml
index 26a0800..19d4fe5 100644
--- a/apps/metgram/wave10.xml
+++ b/apps/metgram/wave10.xml
@@ -1,5 +1,15 @@
<eps template='10_days_wave_epsgram.xml' database='/vol/epsgram/data/spotbase/10_days_wave/0001/latest' format='a4'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<station name='Sea' latitude='40' longitude='-20' psfile='Sea.ps'
diff --git a/apps/metgram/wave10_a3.xml b/apps/metgram/wave10_a3.xml
index b8a1912..946e76e 100644
--- a/apps/metgram/wave10_a3.xml
+++ b/apps/metgram/wave10_a3.xml
@@ -1,5 +1,15 @@
<eps template='10_days_wave_epsgram_a3.xml' database='/vol/epsgram/data/spotbase/10_days_wave/0001/latest' format='a4'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<station name='Sea' latitude='40' longitude='-20' psfile='Sea_a3.ps'
diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt
index 24a12cf..93cef4e 100644
--- a/bin/CMakeLists.txt
+++ b/bin/CMakeLists.txt
@@ -1,3 +1 @@
-if( ENABLE_INSTALL )
- install( PROGRAMS ecbuild DESTINATION ${INSTALL_BIN_DIR} )
-endif()
+install( PROGRAMS ecbuild DESTINATION ${INSTALL_BIN_DIR} )
diff --git a/bin/ecbuild b/bin/ecbuild
index b327cde..d1ffff4 100755
--- a/bin/ecbuild
+++ b/bin/ecbuild
@@ -3,7 +3,7 @@
set -eua
CMAKE_MIN_REQUIRED=2.8.10
-CMAKE_BUILD_VERSION=3.2.3
+CMAKE_BUILD_VERSION=3.4.1
usage()
{
@@ -70,13 +70,13 @@ Available values for "option":
Build static libraries.
Equivalent to "-DBUILD_SHARED_LIBS=OFF"
- --dynamic
+ --dynamic, --shared
Build dynamic libraries (usually the default).
Equivalent to "-DBUILD_SHARED_LIBS=ON"
- --shared (same option as --dynamic)
- Build dynamic libraries (usually the default).
- Equivalent to "-DBUILD_SHARED_LIBS=ON"
+ --config=<config>
+ Configuration file using CMake syntax that gets included
+ Equivalent to cmake argument "-DECBUILD_CONFIG=<config-file>"
--toolchain=<toolchain>
Use a platform specific toolchain, containing settings such
@@ -188,7 +188,7 @@ version()
log()
{
- log_level=$(sed 's/.*/\U&/' <<< "$1")
+ log_level=$(tr "[a-z]" "[A-Z]" <<< "$1")
ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DECBUILD_LOG_LEVEL=${log_level}"
}
@@ -213,6 +213,20 @@ prefix()
ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DCMAKE_INSTALL_PREFIX=${1/#\~\//$HOME/}"
}
+config()
+{
+ arg=${1/#\~\//$HOME/}
+ if [ -f $arg ]; then
+ config_file=$arg
+ config_file="$( cd $( dirname "${config_file}" ) && pwd -P )/$( basename ${config_file} )"
+ else
+ echo "Error:"
+ echo " Config file [$arg] is not found or is not a file."
+ exit 1
+ fi
+ ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DECBUILD_CONFIG=${config_file}"
+}
+
toolchain()
{
arg=${1/#\~\//$HOME/}
@@ -237,7 +251,8 @@ cache()
{
arg=$1
if [ -f $arg ]; then
- cache_file=$( cd "$arg" && pwd -P )
+ cache_file=$arg
+ cache_file="$( cd $( dirname "${cache_file}" ) && pwd -P )/$( basename ${cache_file} )"
else
echo "Error:"
echo " Cache file [$arg] is not found or is not a file."
@@ -313,6 +328,9 @@ while test $# -gt 0; do
--toolchain)
toolchain $val
;;
+ --config)
+ config $val
+ ;;
--cache)
cache $val
;;
diff --git a/cmake/CheckFortranSourceCompiles.cmake b/cmake/CheckFortranSourceCompiles.cmake
index 4303315..d3dc968 100644
--- a/cmake/CheckFortranSourceCompiles.cmake
+++ b/cmake/CheckFortranSourceCompiles.cmake
@@ -38,7 +38,7 @@ if( ${VAR} MATCHES "^${VAR}$" )
elseif(_key)
list(APPEND _${_key} "${arg}")
else()
- message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
+ ecbuild_critical("Unknown argument:\n ${arg}\n")
endif()
endforeach()
set(MACRO_CHECK_FUNCTION_DEFINITIONS
@@ -58,7 +58,7 @@ if( ${VAR} MATCHES "^${VAR}$" )
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.f90"
"${SOURCE}\n")
- message(STATUS "Performing Test ${VAR}")
+ ecbuild_debug("Performing Test ${VAR}")
try_compile(${VAR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.f90
@@ -76,13 +76,13 @@ if( ${VAR} MATCHES "^${VAR}$" )
if(${VAR})
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- message(STATUS "Performing Test ${VAR} - Success")
+ ecbuild_debug("Performing Test ${VAR} - Success")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing Fortran SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
else()
- message(STATUS "Performing Test ${VAR} - Failed")
+ ecbuild_debug("Performing Test ${VAR} - Failed")
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n"
diff --git a/cmake/FindADSM.cmake b/cmake/FindADSM.cmake
index 7af6723..b46e798 100644
--- a/cmake/FindADSM.cmake
+++ b/cmake/FindADSM.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindAEC.cmake b/cmake/FindAEC.cmake
index 8a59037..767544f 100644
--- a/cmake/FindAEC.cmake
+++ b/cmake/FindAEC.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindAIO.cmake b/cmake/FindAIO.cmake
index c27b795..76e357a 100644
--- a/cmake/FindAIO.cmake
+++ b/cmake/FindAIO.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindArmadillo.cmake b/cmake/FindArmadillo.cmake
index a3628a5..4ef1a4a 100644
--- a/cmake/FindArmadillo.cmake
+++ b/cmake/FindArmadillo.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -34,9 +34,10 @@ set( ARMADILLO_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIR} )
include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments and set ARMADILLO_FOUND to TRUE
+# handle the QUIET and REQUIRED arguments and set ARMADILLO_FOUND to TRUE
# if all listed variables are TRUE
-find_package_handle_standard_args(ARMADILLO DEFAULT_MSG
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args(Armadillo DEFAULT_MSG
ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR)
mark_as_advanced(ARMADILLO_INCLUDE_DIR ARMADILLO_LIBRARY )
diff --git a/cmake/FindCMath.cmake b/cmake/FindCMath.cmake
index cf80f85..b8a2a0b 100644
--- a/cmake/FindCMath.cmake
+++ b/cmake/FindCMath.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -10,14 +10,17 @@
# CMATH_LIBRARIES = the library to link against (RT etc)
IF(UNIX)
- if( DEFINED CMATH_PATH )
+ if( DEFINED CMATH_PATH )
find_library(CMATH_LIBRARIES m PATHS ${CMATH_PATH}/lib NO_DEFAULT_PATH )
- endif()
+ endif()
- find_library(CMATH_LIBRARIES m )
+ find_library(CMATH_LIBRARIES m )
- include(FindPackageHandleStandardArgs)
+ include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args(CMATH DEFAULT_MSG CMATH_LIBRARIES )
+ # handle the QUIET and REQUIRED arguments and set CMATH_FOUND to TRUE
+ # if all listed variables are TRUE
+ # Note: capitalisation of the package name must be the same as in the file name
+ find_package_handle_standard_args(CMath DEFAULT_MSG CMATH_LIBRARIES )
ENDIF(UNIX)
diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake
index 7b3d47e..4298a1d 100644
--- a/cmake/FindCairo.cmake
+++ b/cmake/FindCairo.cmake
@@ -50,9 +50,10 @@ set( CAIRO_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR} )
include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments and set GRIBAPI_FOUND to TRUE
+# handle the QUIET and REQUIRED arguments and set CAIRO_FOUND to TRUE
# if all listed variables are TRUE
-find_package_handle_standard_args(CAIRO DEFAULT_MSG
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args(Cairo DEFAULT_MSG
CAIRO_LIBRARY CAIRO_INCLUDE_DIR)
mark_as_advanced( CAIRO_INCLUDE_DIR CAIRO_LIBRARY )
diff --git a/cmake/FindDl.cmake b/cmake/FindDl.cmake
index 30db9c6..16463c6 100644
--- a/cmake/FindDl.cmake
+++ b/cmake/FindDl.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2015 ECMWF.
+# © Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -17,4 +17,7 @@ find_library(DL_LIBRARIES dl )
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(DL DEFAULT_MSG DL_LIBRARIES )
+# handle the QUIET and REQUIRED arguments and set DL_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args(Dl DEFAULT_MSG DL_LIBRARIES )
diff --git a/cmake/FindEMOS.cmake b/cmake/FindEMOS.cmake
index 70028ca..c549fc2 100644
--- a/cmake/FindEMOS.cmake
+++ b/cmake/FindEMOS.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindFDB.cmake b/cmake/FindFDB.cmake
index 9608a54..4bcbdf3 100644
--- a/cmake/FindFDB.cmake
+++ b/cmake/FindFDB.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindGeoTIFF.cmake b/cmake/FindGeoTIFF.cmake
index f4f3b53..83c868c 100644
--- a/cmake/FindGeoTIFF.cmake
+++ b/cmake/FindGeoTIFF.cmake
@@ -31,7 +31,8 @@ IF(GEOTIFF_FOUND)
SET(GEOTIFF_LIBRARIES ${GEOTIFF_LIBRARY})
ENDIF()
-# Handle the QUIETLY and REQUIRED arguments and set SPATIALINDEX_FOUND to TRUE
+# Handle the QUIET and REQUIRED arguments and set GEOTIFF_FOUND to TRUE
# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GEOTIFF DEFAULT_MSG GEOTIFF_LIBRARY GEOTIFF_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GEOTiff DEFAULT_MSG GEOTIFF_LIBRARY GEOTIFF_INCLUDE_DIR)
diff --git a/cmake/FindHPSS.cmake b/cmake/FindHPSS.cmake
index a96b8d4..b2b662b 100644
--- a/cmake/FindHPSS.cmake
+++ b/cmake/FindHPSS.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindLEX.cmake b/cmake/FindLEX.cmake
index 00335c2..221868f 100644
--- a/cmake/FindLEX.cmake
+++ b/cmake/FindLEX.cmake
@@ -44,7 +44,7 @@
# This file is based on the FindFLEX CMake macro, and adapted by ECMWF
#=============================================================================
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindLegacyFDB.cmake b/cmake/FindLegacyFDB.cmake
deleted file mode 100644
index f461a0e..0000000
--- a/cmake/FindLegacyFDB.cmake
+++ /dev/null
@@ -1,35 +0,0 @@
-# (C) Copyright 1996-2015 ECMWF.
-#
-# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
-# granted to it by virtue of its status as an intergovernmental organisation nor
-# does it submit to any jurisdiction.
-
-# - Try to find FDB
-# Once done this will define
-# LEGACY_FDB_FOUND - System has FDB
-# LEGACY_FDB_INCLUDE_DIRS - The FDB include directories
-# LEGACY_FDB_LIBRARIES - The libraries needed to use FDB
-
-
-if( NOT LEGACY_FDB_FOUND )
-
- if( DEFINED LEGACY_FDB_PATH )
- find_library( LEGACY_FDB_LIBRARY NAMES fdb_legacy PATHS ${LEGACY_FDB_PATH} ${LEGACY_FDB_PATH}/lib NO_DEFAULT_PATH)
- endif()
-
- find_library( LEGACY_FDB_LIBRARY NAMES fdb_legacy )
-
- set( LEGACY_FDB_LIBRARIES ${LEGACY_FDB_LIBRARY} )
-
- include(FindPackageHandleStandardArgs)
-
- # handle the QUIETLY and REQUIRED arguments and set LEGACY_FDB_FOUND to TRUE
- # if all listed variables are TRUE
- find_package_handle_standard_args(LEGACY_FDB DEFAULT_MSG
- LEGACY_FDB_LIBRARY )
-
- mark_as_advanced(LEGACY_FDB_LIBRARY)
-
-endif()
diff --git a/cmake/FindLibGFortran.cmake b/cmake/FindLibGFortran.cmake
index 200ffcb..a293ea5 100644
--- a/cmake/FindLibGFortran.cmake
+++ b/cmake/FindLibGFortran.cmake
@@ -1,8 +1,8 @@
-# © Copyright 1996-2015 ECMWF.
-#
+# © Copyright 1996-2016 ECMWF.
+#
# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
@@ -23,16 +23,16 @@ if( GFORTRAN_EXECUTABLE )
ERROR_VARIABLE _GFORTRAN_ERROR_VALUE
OUTPUT_STRIP_TRAILING_WHITESPACE)
-# debug_var(_GFORTRAN_SEARCH_SUCCESS)
-# debug_var(_GFORTRAN_VALUES_OUTPUT)
-# debug_var(_GFORTRAN_ERROR_VALUE)
+# ecbuild_debug_var(_GFORTRAN_SEARCH_SUCCESS)
+# ecbuild_debug_var(_GFORTRAN_VALUES_OUTPUT)
+# ecbuild_debug_var(_GFORTRAN_ERROR_VALUE)
if(_GFORTRAN_SEARCH_SUCCESS MATCHES 0)
string(REGEX REPLACE ".*libraries: =(.*)" "\\1" _result ${_GFORTRAN_VALUES_OUTPUT})
string(REGEX REPLACE ":" ";" _gfortran_hints ${_result} )
endif()
- debug_var( _gfortran_hints )
+ ecbuild_debug_var( _gfortran_hints )
endif()
@@ -47,6 +47,7 @@ endif()
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args( LIBGFORTRAN DEFAULT_MSG GFORTRAN_LIBRARIES )
-
-
+# Handle the QUIET and REQUIRED arguments and set LIBGFORTRAN_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( LibGFortran DEFAULT_MSG GFORTRAN_LIBRARIES )
diff --git a/cmake/FindLibIFort.cmake b/cmake/FindLibIFort.cmake
index e1d82ee..da782a4 100644
--- a/cmake/FindLibIFort.cmake
+++ b/cmake/FindLibIFort.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2015 ECMWF.
+# © Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -44,4 +44,7 @@ endif()
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args( LIBIFORT DEFAULT_MSG IFORT_LIBRARIES )
+# Handle the QUIET and REQUIRED arguments and set LIBIFORT_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( LibIFort DEFAULT_MSG IFORT_LIBRARIES )
diff --git a/cmake/FindMKL.cmake b/cmake/FindMKL.cmake
index fe182a4..1123234 100644
--- a/cmake/FindMKL.cmake
+++ b/cmake/FindMKL.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindNDBM.cmake b/cmake/FindNDBM.cmake
index 5203ee9..869223f 100644
--- a/cmake/FindNDBM.cmake
+++ b/cmake/FindNDBM.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindNetCDF.cmake b/cmake/FindNetCDF.cmake
index 89af114..9084549 100644
--- a/cmake/FindNetCDF.cmake
+++ b/cmake/FindNetCDF.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -76,7 +76,7 @@ if( PREFER_NETCDF4 )
## hdf5
- # Note: Only the HDF5 C-library is required for NetCDF
+ # Note: Only the HDF5 C-library is required for NetCDF
# ( even for Fortan and CXX bindings)
find_package( HDF5 COMPONENTS C QUIET )
@@ -87,24 +87,24 @@ if( PREFER_NETCDF4 )
# Find NetCDF4
# message( "NETCDF CMAKE_PREFIX_PATH = [${CMAKE_PREFIX_PATH}]")
- # debug_var( NETCDF_ROOT )
- # debug_var( NETCDF_FIND_COMPONENTS )
- # debug_var( NETCDF_FIND_QUIETLY )
- # debug_var( NETCDF_FIND_REQUIRED )
+ # ecbuild_debug_var( NETCDF_ROOT )
+ # ecbuild_debug_var( NETCDF_FIND_COMPONENTS )
+ # ecbuild_debug_var( NETCDF_FIND_QUIETLY )
+ # ecbuild_debug_var( NETCDF_FIND_REQUIRED )
find_package( NetCDF4 COMPONENTS ${NETCDF_FIND_COMPONENTS} )
- # debug_var( NETCDF4_FOUND )
- # debug_var( NETCDF_FOUND )
- # debug_var( NETCDF_LIBRARIES )
- # debug_var( NETCDF_INCLUDE_DIRS )
+ # ecbuild_debug_var( NETCDF4_FOUND )
+ # ecbuild_debug_var( NETCDF_FOUND )
+ # ecbuild_debug_var( NETCDF_LIBRARIES )
+ # ecbuild_debug_var( NETCDF_INCLUDE_DIRS )
list( APPEND NETCDF_Fortran_LIBRARIES ${NETCDF_FORTRAN_LIBRARIES} ${NETCDF_F90_LIBRARIES} )
if( NETCDF_Fortran_LIBRARIES )
list( REMOVE_DUPLICATES NETCDF_Fortran_LIBRARIES )
endif()
- # debug_var( NETCDF_Fortran_LIBRARIES )
- # debug_var( NETCDF_C_LIBRARIES )
- # debug_var( NETCDF_CXX_LIBRARIES )
+ # ecbuild_debug_var( NETCDF_Fortran_LIBRARIES )
+ # ecbuild_debug_var( NETCDF_C_LIBRARIES )
+ # ecbuild_debug_var( NETCDF_CXX_LIBRARIES )
set_package_properties( NetCDF4 PROPERTIES TYPE RECOMMENDED PURPOSE "support for NetCDF4 file format" )
@@ -115,13 +115,13 @@ if( PREFER_NETCDF4 )
list( APPEND NETCDF_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} )
endif()
- #debug_var( NETCDF_FOUND )
- #debug_var( NETCDF_LIBRARIES )
- #debug_var( NETCDF_INCLUDE_DIRS )
- #debug_var( HDF5_FOUND )
- #debug_var( HDF5_INCLUDE_DIRS )
- #debug_var( HDF5_HL_LIBRARIES )
- #debug_var( HDF5_LIBRARIES )
+ #ecbuild_debug_var( NETCDF_FOUND )
+ #ecbuild_debug_var( NETCDF_LIBRARIES )
+ #ecbuild_debug_var( NETCDF_INCLUDE_DIRS )
+ #ecbuild_debug_var( HDF5_FOUND )
+ #ecbuild_debug_var( HDF5_INCLUDE_DIRS )
+ #ecbuild_debug_var( HDF5_HL_LIBRARIES )
+ #ecbuild_debug_var( HDF5_LIBRARIES )
endif()
@@ -131,9 +131,9 @@ if( PREFER_NETCDF3 )
ecbuild_debug( "FindNetCDF: looking for NetCDF3" )
- # debug_var( NetCDF_FIND_COMPONENTS )
- # debug_var( NetCDF_FIND_QUIETLY )
- # debug_var( NetCDF_FIND_REQUIRED )
+ # ecbuild_debug_var( NetCDF_FIND_COMPONENTS )
+ # ecbuild_debug_var( NetCDF_FIND_QUIETLY )
+ # ecbuild_debug_var( NetCDF_FIND_REQUIRED )
list(FIND NetCDF_FIND_COMPONENTS "CXX" _index)
if(${_index} GREATER -1)
diff --git a/cmake/FindNetCDF3.cmake b/cmake/FindNetCDF3.cmake
index 40e6bc0..5519fd6 100644
--- a/cmake/FindNetCDF3.cmake
+++ b/cmake/FindNetCDF3.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -104,7 +104,10 @@ if( NETCDF_FIND_REQUIRED )
set( NETCDF3_FIND_REQUIRED ${NETCDF_FIND_REQUIRED} )
endif()
-find_package_handle_standard_args( NETCDF3 DEFAULT_MSG ${NETCDF_REQUIRED_VARS} )
+# Handle the QUIET and REQUIRED arguments and set NETCDF3_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( NetCDF3 DEFAULT_MSG ${NETCDF_REQUIRED_VARS} )
set( NETCDF_FOUND ${NETCDF3_FOUND} )
diff --git a/cmake/FindODB.cmake b/cmake/FindODB.cmake
index 3a1fa12..1beb5c8 100644
--- a/cmake/FindODB.cmake
+++ b/cmake/FindODB.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2015 ECMWF.
+# © Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindOpenCL.cmake b/cmake/FindOpenCL.cmake
index e4e9556..9b6e978 100644
--- a/cmake/FindOpenCL.cmake
+++ b/cmake/FindOpenCL.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -61,7 +61,10 @@ endif()
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args( OPENCL DEFAULT_MSG
+# Handle the QUIET and REQUIRED arguments and set OPENCL_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( OpenCL DEFAULT_MSG
OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS )
mark_as_advanced( OPENCL_INCLUDE_DIRS OPENCL_LIBRARIES )
diff --git a/cmake/FindOpenJPEG.cmake b/cmake/FindOpenJPEG.cmake
index 82d19fb..805f091 100644
--- a/cmake/FindOpenJPEG.cmake
+++ b/cmake/FindOpenJPEG.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindPGIFortran.cmake b/cmake/FindPGIFortran.cmake
index 7308e49..e68bdf6 100644
--- a/cmake/FindPGIFortran.cmake
+++ b/cmake/FindPGIFortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -35,12 +35,15 @@ endforeach()
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args( LIBPGIFORTRAN DEFAULT_MSG pgi_fortran_all_libs_found PGIFORTRAN_LIBRARIES )
+# Handle the QUIET and REQUIRED arguments and set PGIFORTRAN_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( PGIFortran DEFAULT_MSG pgi_fortran_all_libs_found PGIFORTRAN_LIBRARIES )
-if( LIBPGIFORTRAN_FOUND )
+if( PGIFORTRAN_FOUND )
find_package( Realtime )
endif()
if( REALTIME_FOUND )
- set( LIBPGIFORTRAN_LIBRARIES ${PGIFORTRAN_LIBRARIES} ${RT_LIB} )
+ set( PGIFORTRAN_LIBRARIES ${PGIFORTRAN_LIBRARIES} ${RT_LIB} )
endif()
diff --git a/cmake/FindPango.cmake b/cmake/FindPango.cmake
index 811cdf9..76e152a 100644
--- a/cmake/FindPango.cmake
+++ b/cmake/FindPango.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-#
+# (C) Copyright 1996-2016 ECMWF.
+#
# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
@@ -17,15 +17,17 @@ find_package(PkgConfig)
pkg_check_modules(PC_LIBPANGO QUIET pango)
-debug_var( PC_LIBPANGO_FOUND )
-debug_var( PC_LIBPANGO_VERSION )
-debug_var( PC_LIBPANGO_LIBRARIES )
-debug_var( PC_LIBPANGO_INCLUDE_DIRS )
+ecbuild_debug_var( PC_LIBPANGO_FOUND )
+ecbuild_debug_var( PC_LIBPANGO_VERSION )
+ecbuild_debug_var( PC_LIBPANGO_LIBRARIES )
+ecbuild_debug_var( PC_LIBPANGO_INCLUDE_DIRS )
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args( pango DEFAULT_MSG PC_LIBPANGO_LIBRARIES PC_LIBPANGO_INCLUDE_DIRS )
+# Handle the QUIET and REQUIRED arguments and set PANGO_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( Pango DEFAULT_MSG PC_LIBPANGO_LIBRARIES PC_LIBPANGO_INCLUDE_DIRS )
set( PANGO_VERSION ${PC_LIBPANGO_VERSION} )
set( PANGO_LIBRARIES ${PC_LIBPANGO_LIBRARIES} )
set( PANGO_INCLUDE_DIRS ${PC_LIBPANGO_INCLUDE_DIRS} )
-
diff --git a/cmake/FindPangoCairo.cmake b/cmake/FindPangoCairo.cmake
index 7445754..9979550 100644
--- a/cmake/FindPangoCairo.cmake
+++ b/cmake/FindPangoCairo.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -18,17 +18,20 @@ find_package(PkgConfig)
pkg_check_modules(PC_LIBPANGOCAIRO QUIET pangocairo)
-#debug_var( PC_LIBPANGOCAIRO_FOUND )
-#debug_var( PC_LIBPANGOCAIRO_VERSION )
-#debug_var( PC_LIBPANGOCAIRO_LIBRARIES )
-#debug_var( PC_LIBPANGOCAIRO_LDFLAGS )
-#debug_var( PC_LIBPANGOCAIRO_LDFLAGS_OTHER )
-#debug_var( PC_LIBPANGOCAIRO_INCLUDE_DIRS )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_FOUND )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_VERSION )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_LIBRARIES )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_LDFLAGS )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_LDFLAGS_OTHER )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_INCLUDE_DIRS )
if(PC_LIBPANGOCAIRO_FOUND)
include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args( pangocairo DEFAULT_MSG PC_LIBPANGOCAIRO_LIBRARIES PC_LIBPANGOCAIRO_INCLUDE_DIRS )
+ # Handle the QUIET and REQUIRED arguments and set PANGOCAIRO_FOUND to TRUE
+ # if all listed variables are TRUE
+ # Note: capitalisation of the package name must be the same as in file name
+ find_package_handle_standard_args( PangoCairo DEFAULT_MSG PC_LIBPANGOCAIRO_LIBRARIES PC_LIBPANGOCAIRO_INCLUDE_DIRS )
set( PANGOCAIRO_VERSION ${PC_LIBPANGOCAIRO_VERSION} )
set( PANGOCAIRO_LIBRARIES "${PC_LIBPANGOCAIRO_LDFLAGS} ${PC_LIBPANGOCAIRO_LDFLAGS_OTHER}" )
set( PANGOCAIRO_INCLUDE_DIRS ${PC_LIBPANGOCAIRO_INCLUDE_DIRS} )
@@ -69,8 +72,6 @@ else()
${X11_INCLUDE_DIR}
)
-#message(WARNING "===> ${PANGOCAIRO_INCLUDE_DIRS}")
-
find_library( _PANGOCAIRO_LIBRARIES NAMES pangocairo pangocairo-${PANGO_VERSION})
find_library( _PANGO_LIBRARIES NAMES pango pango-${PANGO_VERSION})
find_library( _CAIRO_LIBRARIES NAMES cairo)
@@ -84,11 +85,12 @@ else()
${X11_LIBRARIES}
)
-#message(WARNING "===> ${PANGOCAIRO_LIBRARIES}")
-
- find_package_handle_standard_args( pangocairo DEFAULT_MSG
- PANGOCAIRO_LIBRARIES
- PANGOCAIRO_INCLUDE_DIRS )
+ # Handle the QUIET and REQUIRED arguments and set PANGOCAIRO_FOUND to TRUE
+ # if all listed variables are TRUE
+ # Note: capitalisation of the package name must be the same as in file name
+ find_package_handle_standard_args( PangoCairo DEFAULT_MSG
+ PANGOCAIRO_LIBRARIES
+ PANGOCAIRO_INCLUDE_DIRS )
endif()
diff --git a/cmake/FindProj4.cmake b/cmake/FindProj4.cmake
index 6774b6e..a3560b2 100644
--- a/cmake/FindProj4.cmake
+++ b/cmake/FindProj4.cmake
@@ -38,9 +38,9 @@ if( NOT PROJ4_PATH )
endif()
-# debug_var( PKG_CONFIG_FOUND )
-# debug_var( PKPROJ4_FOUND )
-# debug_var( PROJ4_MIN_VERSION )
+# ecbuild_debug_var( PKG_CONFIG_FOUND )
+# ecbuild_debug_var( PKPROJ4_FOUND )
+# ecbuild_debug_var( PROJ4_MIN_VERSION )
endif()
@@ -55,12 +55,12 @@ find_path(PROJ4_INCLUDE_DIR NAMES proj_api.h PATHS PATH_SUFFIXES proj4 )
find_library( PROJ4_LIBRARY NAMES proj PATHS PATH_SUFFIXES proj4 )
-# debug_var( PROJ4_INCLUDE_DIR )
-# debug_var( PROJ4_LIBRARY )
+# ecbuild_debug_var( PROJ4_INCLUDE_DIR )
+# ecbuild_debug_var( PROJ4_LIBRARY )
# handle the QUIETLY and REQUIRED arguments and set GRIBAPI_FOUND
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(PROJ4 DEFAULT_MSG
+find_package_handle_standard_args(Proj4 DEFAULT_MSG
PROJ4_LIBRARY PROJ4_INCLUDE_DIR)
set( PROJ4_LIBRARIES ${PROJ4_LIBRARY} )
diff --git a/cmake/FindREADLINE.cmake b/cmake/FindREADLINE.cmake
index bbabe15..2ba08b4 100644
--- a/cmake/FindREADLINE.cmake
+++ b/cmake/FindREADLINE.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -47,8 +47,8 @@ cmake_push_check_state()
cmake_pop_check_state()
-# debug_var( readline_version )
-# debug_var( __readline_version_out )
+# ecbuild_debug_var( readline_version )
+# ecbuild_debug_var( __readline_version_out )
set( __readline_fail 0 )
if( __readline_version_out )
diff --git a/cmake/FindRPCGEN.cmake b/cmake/FindRPCGEN.cmake
index 3e25daf..fd42e9f 100644
--- a/cmake/FindRPCGEN.cmake
+++ b/cmake/FindRPCGEN.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindRealtime.cmake b/cmake/FindRealtime.cmake
index 2c2a7b2..843a54f 100644
--- a/cmake/FindRealtime.cmake
+++ b/cmake/FindRealtime.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -18,5 +18,7 @@ find_library( RT_LIB rt )
mark_as_advanced( RT_LIB )
include(FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args(REALTIME DEFAULT_MSG RT_LIB )
+# Handle the QUIET and REQUIRED arguments and set REALTIME_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args(Realtime DEFAULT_MSG RT_LIB )
diff --git a/cmake/FindSZip.cmake b/cmake/FindSZip.cmake
index 6e9b1a2..925348c 100644
--- a/cmake/FindSZip.cmake
+++ b/cmake/FindSZip.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindTrilinos.cmake b/cmake/FindTrilinos.cmake
index a1cabce..0d99b54 100644
--- a/cmake/FindTrilinos.cmake
+++ b/cmake/FindTrilinos.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/FindViennaCL.cmake b/cmake/FindViennaCL.cmake
index a1b1eb9..aba2980 100644
--- a/cmake/FindViennaCL.cmake
+++ b/cmake/FindViennaCL.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -30,9 +30,10 @@ set( VIENNACL_INCLUDE_DIRS ${VIENNACL_INCLUDE_DIR} )
include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments and set VIENNACL_FOUND to TRUE
+# handle the QUIET and REQUIRED arguments and set VIENNACL_FOUND to TRUE
# if all listed variables are valid
-find_package_handle_standard_args(VIENNACL DEFAULT_MSG
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args(ViennaCL DEFAULT_MSG
VIENNACL_INCLUDE_DIR)
mark_as_advanced(VIENNACL_INCLUDE_DIRS)
diff --git a/cmake/FindXLFortranLibs.cmake b/cmake/FindXLFortranLibs.cmake
index 10a68aa..37800c7 100644
--- a/cmake/FindXLFortranLibs.cmake
+++ b/cmake/FindXLFortranLibs.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2015 ECMWF.
+# © Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -27,8 +27,10 @@ foreach( lib ${xl_libs} )
endforeach()
include(FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args( LIBXLFORTRAN DEFAULT_MSG xlf_all_libs_found XLFORTRAN_LIBRARIES )
+# handle the QUIET and REQUIRED arguments and set XLFORTRANLIBS_FOUND to TRUE
+# if all listed variables are valid
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( XLFortranLibs DEFAULT_MSG xlf_all_libs_found XLFORTRAN_LIBRARIES )
# HACK for support libraries
diff --git a/cmake/FindYACC.cmake b/cmake/FindYACC.cmake
index a410c6f..7b15bfe 100644
--- a/cmake/FindYACC.cmake
+++ b/cmake/FindYACC.cmake
@@ -41,7 +41,7 @@
# This file is based on the FindFLEX CMake macro, and adapted by ECMWF
#=============================================================================
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/Findgrib_api.cmake b/cmake/Findgrib_api.cmake
index 8b6cb43..ab6fc0b 100644
--- a/cmake/Findgrib_api.cmake
+++ b/cmake/Findgrib_api.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -20,16 +20,16 @@ option( GRIB_API_JPG "use jpg with grib_api" ON )
if( NOT grib_api_FOUND AND NOT NO_GRIB_API_BINARIES )
if( GRIB_API_JPG ) # jpeg support
-
+
find_package( JPEG QUIET ) # grib_api might be a static .a library in which
-
+
if( NOT "$ENV{JASPER_PATH}" STREQUAL "" )
list( APPEND CMAKE_PREFIX_PATH "$ENV{JASPER_PATH}" )
endif()
find_package( Jasper QUIET ) # case we don't know if which jpeg library was used
-
- find_package( OpenJPEG QUIET ) # so we try to find all jpeg libs and link to them
-
+
+ find_package( OpenJPEG QUIET ) # so we try to find all jpeg libs and link to them
+
if(JPEG_FOUND)
list( APPEND _grib_api_jpg_incs ${JPEG_INCLUDE_DIR} )
list( APPEND _grib_api_jpg_libs ${JPEG_LIBRARIES} )
@@ -44,18 +44,18 @@ if( NOT grib_api_FOUND AND NOT NO_GRIB_API_BINARIES )
endif()
endif()
-
+
if( GRIB_API_PNG ) # png support
-
+
find_package(PNG)
-
+
if( DEFINED PNG_PNG_INCLUDE_DIR AND NOT DEFINED PNG_INCLUDE_DIRS )
set( PNG_INCLUDE_DIRS ${PNG_PNG_INCLUDE_DIR} CACHE INTERNAL "PNG include dirs" )
endif()
if( DEFINED PNG_LIBRARY AND NOT DEFINED PNG_LIBRARIES )
set( PNG_LIBRARIES ${PNG_LIBRARY} CACHE INTERNAL "PNG libraries" )
endif()
-
+
if(PNG_FOUND)
list( APPEND _grib_api_png_defs ${PNG_DEFINITIONS} )
list( APPEND _grib_api_png_incs ${PNG_INCLUDE_DIRS} )
@@ -85,22 +85,22 @@ if( NOT grib_api_FOUND AND NOT NO_GRIB_API_BINARIES )
find_library(GRIB_API_LIB_F77 NAMES grib_api_f77 PATHS ${GRIB_API_PATH} ${GRIB_API_PATH}/lib PATH_SUFFIXES grib_api NO_DEFAULT_PATH)
find_program(GRIB_API_INFO NAMES grib_info PATHS ${GRIB_API_PATH} ${GRIB_API_PATH}/bin PATH_SUFFIXES grib_api NO_DEFAULT_PATH)
endif()
-
+
find_path(GRIB_API_INCLUDE_DIR NAMES grib_api.h PATHS PATH_SUFFIXES grib_api )
find_library( GRIB_API_LIBRARY NAMES grib_api PATHS PATH_SUFFIXES grib_api )
find_library( GRIB_API_LIB_F90 NAMES grib_api_f90 PATHS PATH_SUFFIXES grib_api )
find_library( GRIB_API_LIB_F77 NAMES grib_api_f77 PATHS PATH_SUFFIXES grib_api )
find_program(GRIB_API_INFO NAMES grib_info PATHS PATH_SUFFIXES grib_api )
-
+
list( APPEND GRIB_API_LIBRARIES ${GRIB_API_LIBRARY} ${GRIB_API_LIB_F90} ${GRIB_API_LIB_F77} )
set( GRIB_API_INCLUDE_DIRS ${GRIB_API_INCLUDE_DIR} )
if( GRIB_API_INFO )
-
+
execute_process( COMMAND ${GRIB_API_INFO} -v OUTPUT_VARIABLE _grib_info_out ERROR_VARIABLE _grib_info_err OUTPUT_STRIP_TRAILING_WHITESPACE )
-
- # debug_var( _grib_info_out )
-
+
+ # ecbuild_debug_var( _grib_info_out )
+
string( REPLACE "." " " _version_list ${_grib_info_out} ) # dots to spaces
separate_arguments( _version_list )
@@ -108,22 +108,22 @@ if( NOT grib_api_FOUND AND NOT NO_GRIB_API_BINARIES )
list( GET _version_list 1 GRIB_API_MINOR_VERSION )
list( GET _version_list 2 GRIB_API_PATCH_VERSION )
- set( GRIB_API_VERSION "${GRIB_API_MAJOR_VERSION}.${GRIB_API_MINOR_VERSION}.${GRIB_API_PATCH_VERSION}" )
+ set( GRIB_API_VERSION "${GRIB_API_MAJOR_VERSION}.${GRIB_API_MINOR_VERSION}.${GRIB_API_PATCH_VERSION}" )
set( GRIB_API_VERSION_STR "${_grib_info_out}" )
- set( grib_api_VERSION "${GRIB_API_VERSION}" )
+ set( grib_api_VERSION "${GRIB_API_VERSION}" )
set( grib_api_VERSION_STR "${GRIB_API_VERSION_STR}" )
endif()
-
+
include(FindPackageHandleStandardArgs)
-
+
# handle the QUIETLY and REQUIRED arguments and set GRIB_API_FOUND to TRUE
find_package_handle_standard_args( grib_api DEFAULT_MSG
GRIB_API_LIBRARY GRIB_API_INCLUDE_DIR GRIB_API_INFO )
-
+
mark_as_advanced( GRIB_API_INCLUDE_DIR GRIB_API_LIBRARY GRIB_API_INFO )
-
+
list( APPEND GRIB_API_DEFINITIONS ${_grib_api_jpg_defs} ${_grib_api_png_defs} )
list( APPEND GRIB_API_INCLUDE_DIRS ${_grib_api_jpg_incs} ${_grib_api_png_incs} )
list( APPEND GRIB_API_LIBRARIES ${_grib_api_jpg_libs} ${_grib_api_png_libs} )
diff --git a/cmake/Findodb_api.cmake b/cmake/Findodb_api.cmake
index 2b8e800..0058fbe 100644
--- a/cmake/Findodb_api.cmake
+++ b/cmake/Findodb_api.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/Findspot.cmake b/cmake/Findspot.cmake
index cad0e33..52e0fb5 100644
--- a/cmake/Findspot.cmake
+++ b/cmake/Findspot.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/VERSION.cmake b/cmake/VERSION.cmake
index a07bd4a..a65cc6d 100644
--- a/cmake/VERSION.cmake
+++ b/cmake/VERSION.cmake
@@ -1,7 +1,7 @@
-set( ECBUILD_MAJOR_VERSION "1" )
-set( ECBUILD_MINOR_VERSION "9" )
+set( ECBUILD_MAJOR_VERSION "2" )
+set( ECBUILD_MINOR_VERSION "2" )
set( ECBUILD_PATCH_VERSION "0" )
-set( ECBUILD_VERSION_STR "1.9.0" )
+set( ECBUILD_VERSION_STR "2.2.0" )
set( ECBUILD_MACRO_VERSION "${ECBUILD_MAJOR_VERSION}.${ECBUILD_MINOR_VERSION}" )
diff --git a/cmake/compiler_flags/Clang_C.cmake b/cmake/compiler_flags/Clang_C.cmake
new file mode 100644
index 0000000..bc73c69
--- /dev/null
+++ b/cmake/compiler_flags/Clang_C.cmake
@@ -0,0 +1,13 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "C compiler flags for Release builds" FORCE )
+set( CMAKE_C_FLAGS_BIT "-O2 -DNDEBUG" CACHE STRING "C compiler flags for Bit-reproducible builds" FORCE )
+set( CMAKE_C_FLAGS_DEBUG "-O0 -g -ftrapv" CACHE STRING "C compiler flags for Debug builds" FORCE )
+set( CMAKE_C_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "C compiler flags for Production builds." FORCE )
+set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "C compiler flags for RelWithDebInfo builds." FORCE )
diff --git a/cmake/compiler_flags/Clang_CXX.cmake b/cmake/compiler_flags/Clang_CXX.cmake
new file mode 100644
index 0000000..53f0f21
--- /dev/null
+++ b/cmake/compiler_flags/Clang_CXX.cmake
@@ -0,0 +1,13 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "C++ compiler flags for Release builds" FORCE )
+set( CMAKE_CXX_FLAGS_BIT "-O2 -DNDEBUG" CACHE STRING "C++ compiler flags for Bit-reproducible builds" FORCE )
+set( CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ftrapv" CACHE STRING "C++ compiler flags for Debug builds" FORCE )
+set( CMAKE_CXX_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "C++ compiler flags for Production builds." FORCE )
+set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "C++ compiler flags for RelWithDebInfo builds." FORCE )
diff --git a/cmake/compiler_flags/Cray_C.cmake b/cmake/compiler_flags/Cray_C.cmake
new file mode 100644
index 0000000..76779f9
--- /dev/null
+++ b/cmake/compiler_flags/Cray_C.cmake
@@ -0,0 +1,14 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( CMAKE_C_FLAGS_ALL "-hlist=amid" CACHE STRING "Common flags for all build-types" FORCE )
+set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_ALL} -O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" CACHE STRING "Release C flags" FORCE )
+set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_ALL} -O2 -hfp1 -Gfast -DNDEBUG" CACHE STRING "Release-with-debug-info C flags" FORCE )
+set( CMAKE_C_FLAGS_PRODUCTION "${CMAKE_C_FLAGS_ALL} -O2 -hfp1 -G2" CACHE STRING "Production C flags" FORCE )
+set( CMAKE_C_FLAGS_BIT "${CMAKE_C_FLAGS_ALL} -O2 -hfp1 -G2 -hflex_mp=conservative -hadd_paren -DNDEBUG" CACHE STRING "Bit-reproducible C flags" FORCE )
+set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_ALL} -O0 -G0" CACHE STRING "Debug Cflags" FORCE )
diff --git a/cmake/compiler_flags/Cray_CXX.cmake b/cmake/compiler_flags/Cray_CXX.cmake
new file mode 100644
index 0000000..d599bff
--- /dev/null
+++ b/cmake/compiler_flags/Cray_CXX.cmake
@@ -0,0 +1,14 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( CMAKE_CXX_FLAGS_ALL "-hlist=amid" CACHE STRING "Common flags for all build-types" FORCE )
+set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_ALL} -O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" CACHE STRING "Release C++ flags" FORCE )
+set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_ALL} -O2 -hfp1 -Gfast -DNDEBUG" CACHE STRING "Release-with-debug-info C++ flags" FORCE )
+set( CMAKE_CXX_FLAGS_PRODUCTION "${CMAKE_CXX_FLAGS_ALL} -O2 -hfp1 -G2" CACHE STRING "Production C++ flags" FORCE )
+set( CMAKE_CXX_FLAGS_BIT "${CMAKE_CXX_FLAGS_ALL} -O2 -hfp1 -G2 -hflex_mp=conservative -hadd_paren -DNDEBUG" CACHE STRING "Bit-reproducible C++ flags" FORCE )
+set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_ALL} -O0 -G0" CACHE STRING "Debug CXX flags" FORCE )
diff --git a/cmake/compiler_flags/Cray_Fortran.cmake b/cmake/compiler_flags/Cray_Fortran.cmake
new file mode 100644
index 0000000..b2c23de
--- /dev/null
+++ b/cmake/compiler_flags/Cray_Fortran.cmake
@@ -0,0 +1,15 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+# -emf activates .mods and uses lower case
+set( CMAKE_Fortran_FLAGS_ALL "-emf" CACHE STRING "Common flags for all build-types" FORCE )
+set( CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_ALL} -O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" CACHE STRING "Release Fortran flags" FORCE )
+set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_ALL} -O2 -hfp1 -Gfast -DNDEBUG" CACHE STRING "Release-with-debug-info Fortran flags" FORCE )
+set( CMAKE_Fortran_FLAGS_PRODUCTION "${CMAKE_Fortran_FLAGS_ALL} -O2 -hfp1 -G2" CACHE STRING "Production Fortran flags" FORCE )
+set( CMAKE_Fortran_FLAGS_BIT "${CMAKE_Fortran_FLAGS_ALL} -O2 -hfp1 -G2 -hflex_mp=conservative -hadd_paren -DNDEBUG" CACHE STRING "Bit-reproducible Fortran flags" FORCE )
+set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_ALL} -O0 -G0" CACHE STRING "Debug Fortran flags" FORCE )
diff --git a/cmake/compiler_flags/GNU_C.cmake b/cmake/compiler_flags/GNU_C.cmake
new file mode 100644
index 0000000..955f527
--- /dev/null
+++ b/cmake/compiler_flags/GNU_C.cmake
@@ -0,0 +1,18 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "C compiler flags for Release builds" FORCE )
+set( CMAKE_C_FLAGS_BIT "-g -O2 -m64 -march=native -DNDEBUG" CACHE STRING "C compiler flags for Bit-reproducible builds" FORCE )
+set( CMAKE_C_FLAGS_DEBUG "-O0 -g" CACHE STRING "C compiler flags for Debug builds" FORCE )
+set( CMAKE_C_FLAGS_PRODUCTION "-O2 -g" CACHE STRING "C compiler flags for Production builds." FORCE )
+set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "C compiler flags for RelWithDebInfo builds." FORCE )
+
+# NOTE: gcc does not guarrante that -O3 performs better than -O2
+# -- it can perform worse due to assembly code bloating.
+# Moreover for gcc 4.1.2 we found that -O3 remove the parser code generated from Lex/Yacc
+# and therefore in production mode we downgrade to -O2 if the compiler is GCC (for all versions).
diff --git a/cmake/compiler_flags/GNU_CXX.cmake b/cmake/compiler_flags/GNU_CXX.cmake
new file mode 100644
index 0000000..0ab8c3a
--- /dev/null
+++ b/cmake/compiler_flags/GNU_CXX.cmake
@@ -0,0 +1,18 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "C++ compiler flags for Release builds" FORCE )
+set( CMAKE_CXX_FLAGS_BIT "-g -O2 -m64 -march=native -DNDEBUG" CACHE STRING "C++ compiler flags for Bit-reproducible builds" FORCE )
+set( CMAKE_CXX_FLAGS_DEBUG "-O0 -g" CACHE STRING "C++ compiler flags for Debug builds" FORCE )
+set( CMAKE_CXX_FLAGS_PRODUCTION "-O2 -g" CACHE STRING "C++ compiler flags for Production builds." FORCE )
+set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "C++ compiler flags for RelWithDebInfo builds." FORCE )
+
+# NOTE: gcc does not guarrante that -O3 performs better than -O2
+# -- it can perform worse due to assembly code bloating.
+# Moreover for gcc 4.1.2 we found that -O3 remove the parser code generated from Lex/Yacc
+# and therefore in production mode we downgrade to -O2 if the compiler is GCC (for all versions).
diff --git a/cmake/compiler_flags/GNU_Fortran.cmake b/cmake/compiler_flags/GNU_Fortran.cmake
new file mode 100644
index 0000000..a12abec
--- /dev/null
+++ b/cmake/compiler_flags/GNU_Fortran.cmake
@@ -0,0 +1,21 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( CMAKE_Fortran_FLAGS_RELEASE "-O3 -funroll-all-loops -finline-functions" CACHE STRING "Fortran compiler flags for Release builds" FORCE )
+set( CMAKE_Fortran_FLAGS_BIT "-g -O2 -m64 -march=native -DNDEBUG -fno-range-check -fconvert=big-endian" CACHE STRING "Fortran compiler flags for Bit-reproducible builds" FORCE )
+set( CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -fcheck=bounds -fbacktrace -finit-real=snan" CACHE STRING "Fortran compiler flags for Debug builds" FORCE )
+set( CMAKE_Fortran_FLAGS_PRODUCTION "-O2 -g" CACHE STRING "Fortran compiler flags for Production builds." FORCE )
+set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Fortran compiler flags for RelWithDebInfo builds." FORCE )
+
+####################################################################
+
+# Meaning of flags
+# ----------------
+# -fstack-arrays : Allocate automatic arrays on the stack (needs large stacksize!!!)
+# -funroll-all-loops : Unroll all loops
+# -fcheck=bounds : Bounds checking
diff --git a/cmake/compiler_flags/Intel_C.cmake b/cmake/compiler_flags/Intel_C.cmake
new file mode 100644
index 0000000..dbea59f
--- /dev/null
+++ b/cmake/compiler_flags/Intel_C.cmake
@@ -0,0 +1,13 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Release C compiler flags" FORCE )
+set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Release-with-debug-info C compiler flags" FORCE )
+set( CMAKE_C_FLAGS_BIT "-O2 -DNDEBUG" CACHE STRING "Bit-reproducible C compiler flags" FORCE )
+set( CMAKE_C_FLAGS_DEBUG "-O0 -g -traceback" CACHE STRING "Debug C compiler flags" FORCE )
+set( CMAKE_C_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Production C compiler flags" FORCE )
diff --git a/cmake/compiler_flags/Intel_CXX.cmake b/cmake/compiler_flags/Intel_CXX.cmake
new file mode 100644
index 0000000..5b8dc78
--- /dev/null
+++ b/cmake/compiler_flags/Intel_CXX.cmake
@@ -0,0 +1,13 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Release C++ compiler flags" FORCE )
+set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Release-with-debug-info C++ compiler flags" FORCE )
+set( CMAKE_CXX_FLAGS_BIT "-O2 -DNDEBUG" CACHE STRING "Bit-reproducible C++ compiler flags" FORCE )
+set( CMAKE_CXX_FLAGS_DEBUG "-O0 -g -traceback" CACHE STRING "Debug C++ compiler flags" FORCE )
+set( CMAKE_CXX_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Production C++ compiler flags" FORCE )
diff --git a/cmake/compiler_flags/Intel_Fortran.cmake b/cmake/compiler_flags/Intel_Fortran.cmake
new file mode 100644
index 0000000..86b69dc
--- /dev/null
+++ b/cmake/compiler_flags/Intel_Fortran.cmake
@@ -0,0 +1,14 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( CMAKE_Fortran_FLAGS_RELEASE "-O3 -unroll -inline -heap-arrays" CACHE STRING "Release Fortran flags" FORCE )
+set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Release-with-debug-info Fortran flags" FORCE )
+set( CMAKE_Fortran_FLAGS_BIT "-O2 -unroll -inline -heap-arrays" CACHE STRING "Bit-reproducible Fortran flags" FORCE )
+# -check all implies -check bounds
+set( CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -traceback -heap-arrays -check all" CACHE STRING "Debug Fortran flags" FORCE )
+set( CMAKE_Fortran_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Production Fortran compiler flags" FORCE )
diff --git a/cmake/compiler_flags/PGI_C.cmake b/cmake/compiler_flags/PGI_C.cmake
new file mode 100644
index 0000000..6784a14
--- /dev/null
+++ b/cmake/compiler_flags/PGI_C.cmake
@@ -0,0 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+set( CMAKE_C_FLAGS_RELEASE "-fast -O3 -DNDEBUG" CACHE STRING "Release C compiler flags" FORCE )
+
+set( CMAKE_C_LINK_FLAGS "" CACHE STRING "" )
diff --git a/cmake/compiler_flags/PGI_CXX.cmake b/cmake/compiler_flags/PGI_CXX.cmake
new file mode 100644
index 0000000..877ef3f
--- /dev/null
+++ b/cmake/compiler_flags/PGI_CXX.cmake
@@ -0,0 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+set( CMAKE_CXX_FLAGS_RELEASE "-fast -O3 -DNDEBUG" CACHE STRING "Release C++ compiler flags" FORCE )
+
+set( CMAKE_CXX_LINK_FLAGS "" CACHE STRING "" )
diff --git a/cmake/compiler_flags/PGI_Fortran.cmake b/cmake/compiler_flags/PGI_Fortran.cmake
new file mode 100644
index 0000000..a268cc9
--- /dev/null
+++ b/cmake/compiler_flags/PGI_Fortran.cmake
@@ -0,0 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+set( CMAKE_Fortran_FLAGS_RELEASE "-fast -O3" CACHE STRING "Release Fortran compiler flags" FORCE )
+
+set( CMAKE_Fortran_LINK_FLAGS "" CACHE STRING "" )
diff --git a/cmake/contrib/FindFFTW.cmake b/cmake/contrib/FindFFTW.cmake
index d76767b..5ef46df 100644
--- a/cmake/contrib/FindFFTW.cmake
+++ b/cmake/contrib/FindFFTW.cmake
@@ -1,22 +1,60 @@
-# - Find the FFTW library
-#
-# Usage:
-# find_package(FFTW [REQUIRED] [QUIET] )
-#
-# It sets the following variables:
-# FFTW_FOUND ... true if fftw is found on the system
-# FFTW_LIBRARIES ... full path to fftw library
-# FFTW_INCLUDES ... fftw include directory
-#
-# The following variables will be checked by the function
-# FFTW_USE_STATIC_LIBS ... if true, only static libraries are found
-# FFTW_ROOT ... if set, the libraries are exclusively searched
-# under this path
-# FFTW_DIR ... equivalent to FFTW_ROOT
-# FFTW_PATH ... equivalent to FFTW_ROOT
-# FFTW_LIBRARY ... fftw library to use
-# FFTW_INCLUDE_DIR ... fftw include directory
+# (C) Copyright 1996-2016 ECMWF.
#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+##############################################################################
+#.rst:
+#
+# FindFFTW
+# ========
+#
+# Find the FFTW library. ::
+#
+# find_package(FFTW [REQUIRED] [QUIET]
+# [COMPONENTS [single] [double] [long_double] [quad]])
+#
+# By default, search for the double precision library ``fftw3``
+#
+# Components
+# ----------
+#
+# If a different version or multiple versions of the library are required,
+# these need to be specified as ``COMPONENTS``. Note that double must be given
+# explicitly if any ``COMPONENTS`` are specified.
+#
+# The libraries corresponding to each of the ``COMPONENTS`` are:
+#
+# :single: ``fftw3f``
+# :double: ``fftw3``
+# :long_double: ``fftw3l``
+# :quad: ``fftw3q``
+#
+# Output variables
+# ----------------
+#
+# The following CMake variables are set on completion:
+#
+# :FFTW_FOUND: true if FFTW is found on the system
+# :FFTW_LIBRARIES: full paths to requested FFTW libraries
+# :FFTW_INCLUDES: FFTW include directory
+#
+# Input variables
+# ---------------
+#
+# The following CMake variables are checked by the function:
+#
+# :FFTW_USE_STATIC_LIBS: if true, only static libraries are found
+# :FFTW_ROOT: if set, this path is exclusively searched
+# :FFTW_DIR: equivalent to FFTW_ROOT
+# :FFTW_PATH: equivalent to FFTW_ROOT
+# :FFTW_LIBRARY: FFTW library to use
+# :FFTW_INCLUDE_DIR: FFTW include directory
+#
+##############################################################################
#============================================#
# #
@@ -72,76 +110,103 @@ else()
set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX} )
endif()
+if( FFTW_FIND_COMPONENTS )
+ ecbuild_debug( "FindFFTW: looking for components: ${FFTW_FIND_COMPONENTS}" )
+ foreach( _component ${FFTW_FIND_COMPONENTS} )
+ if( _component MATCHES "single" )
+ ecbuild_debug( "FindFFTW: looking for single precision (fftw3f)" )
+ set( _require_sp TRUE )
+ elseif( _component MATCHES "double" )
+ ecbuild_debug( "FindFFTW: looking for double precision (fftw3)" )
+ set( _require_dp TRUE )
+ elseif( _component MATCHES "long_double" )
+ ecbuild_debug( "FindFFTW: looking for long double precision (fftw3l)" )
+ set( _require_lp TRUE )
+ elseif( _component MATCHES "quad" )
+ ecbuild_debug( "FindFFTW: looking for quad precision (fftw3q)" )
+ set( _require_qp TRUE )
+ else()
+ endif()
+ endforeach()
+else()
+ ecbuild_debug( "FindFFTW: no components specified, looking for double precision (fftw3)" )
+ set( _require_dp TRUE )
+endif()
+
if( FFTW_ROOT )
+ set( _default_paths NO_DEFAULT_PATH )
+ set( _lib_paths ${FFTW_ROOT} )
+ set( _include_paths ${FFTW_ROOT} )
+else()
+ set( _lib_paths ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} )
+ set( _include_paths ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR} )
+endif()
+
+#find libs
- #find libs
+if( _require_dp )
find_library(
FFTW_LIB
NAMES "fftw3"
- PATHS ${FFTW_ROOT}
+ PATHS ${_lib_paths}
PATH_SUFFIXES "lib" "lib64"
- NO_DEFAULT_PATH
+ ${_default_paths}
)
+ if( NOT FFTW_LIB )
+ ecbuild_warn("FindFFTW: double precision required, but fftw3 was not found")
+ endif()
+endif()
+if( _require_sp )
find_library(
FFTWF_LIB
NAMES "fftw3f"
- PATHS ${FFTW_ROOT}
+ PATHS ${_lib_paths}
PATH_SUFFIXES "lib" "lib64"
- NO_DEFAULT_PATH
+ ${_default_paths}
)
+ if( NOT FFTWF_LIB )
+ ecbuild_warn("FindFFTW: single precision required, but fftw3f was not found")
+ endif()
+endif()
+if( _require_lp )
find_library(
FFTWL_LIB
NAMES "fftw3l"
- PATHS ${FFTW_ROOT}
+ PATHS ${_lib_paths}
PATH_SUFFIXES "lib" "lib64"
- NO_DEFAULT_PATH
+ ${_default_paths}
)
+ if( NOT FFTWL_LIB )
+ ecbuild_warn("FindFFTW: long double precision required, but fftw3l was not found")
+ endif()
+endif()
- #find includes
- find_path(
- FFTW_INCLUDES
- NAMES "fftw3.h"
- PATHS ${FFTW_ROOT}
- PATH_SUFFIXES "include"
- NO_DEFAULT_PATH
- )
-
-else()
-
- find_library(
- FFTW_LIB
- NAMES "fftw3"
- PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
- )
-
- find_library(
- FFTWF_LIB
- NAMES "fftw3f"
- PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
- )
-
-
+if( _require_qp )
find_library(
- FFTWL_LIB
- NAMES "fftw3l"
- PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
- )
-
- find_path(
- FFTW_INCLUDES
- NAMES "fftw3.h"
- PATHS ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR}
+ FFTWQ_LIB
+ NAMES "fftw3q"
+ PATHS ${_lib_paths}
+ PATH_SUFFIXES "lib" "lib64"
+ ${_default_paths}
)
+ if( NOT FFTWQ_LIB )
+ ecbuild_warn("FindFFTW: quad precision required, but fftw3q was not found")
+ endif()
+endif()
-endif( FFTW_ROOT )
+#find includes
-set(FFTW_LIBRARIES ${FFTW_LIB} ${FFTWF_LIB})
+find_path(
+ FFTW_INCLUDES
+ NAMES "fftw3.h"
+ PATHS ${_include_paths}
+ PATH_SUFFIXES "include"
+ ${_default_paths}
+)
-if(FFTWL_LIB)
- set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTWL_LIB})
-endif()
+set(FFTW_LIBRARIES ${FFTW_LIB} ${FFTWF_LIB} ${FFTWL_LIB} ${FFTWQ_LIB})
set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )
@@ -149,4 +214,4 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFTW DEFAULT_MSG
FFTW_INCLUDES FFTW_LIBRARIES)
-mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB FFTWF_LIB FFTWL_LIB)
\ No newline at end of file
+mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB FFTWF_LIB FFTWL_LIB)
diff --git a/cmake/contrib/FindNetCDF4.cmake b/cmake/contrib/FindNetCDF4.cmake
index 89b0337..6bba4e0 100644
--- a/cmake/contrib/FindNetCDF4.cmake
+++ b/cmake/contrib/FindNetCDF4.cmake
@@ -157,10 +157,13 @@ else()
foreach( LANGUAGE ${NETCDF_LANGUAGE_BINDINGS} )
ecbuild_debug("FindNetCDF4: looking for ${LANGUAGE} language bindings")
+
set( NETCDF_${LANGUAGE}_FOUND 1 ) # disable this in following if necessary
-
+
# find the NETCDF includes
foreach( INC ${NETCDF_${LANGUAGE}_INCLUDE_NAMES} )
+ #ecbuild_debug( "FindNetCDF4: looking for include file ${INC}")
+
find_path( NETCDF_${INC}_INCLUDE_DIR ${INC}
HINTS ${NETCDF_${LANGUAGE}_INCLUDE_FLAGS}
${NETCDF_ROOT} ${NETCDF_DIR} ${NETCDF_PATH} ${NETCDF4_DIR}
@@ -169,8 +172,25 @@ else()
include
Include
)
+ if( NOT NETCDF_${INC}_INCLUDE_DIR )
+ #ecbuild_debug( "FindNetCDF4: ${INC} not found" )
+ GET_FILENAME_COMPONENT( _basename ${INC} NAME_WE )
+ GET_FILENAME_COMPONENT( _ext ${INC} EXT )
+ string( TOUPPER ${_basename} _BASENAME )
+ set( INC_MOD "${_BASENAME}${_ext}")
+ #ecbuild_debug( "FindNetCDF4: try ${INC_MOD}" )
+ find_path( NETCDF_${INC}_INCLUDE_DIR ${INC_MOD}
+ HINTS ${NETCDF_${LANGUAGE}_INCLUDE_FLAGS}
+ ${NETCDF_ROOT} ${NETCDF_DIR} ${NETCDF_PATH} ${NETCDF4_DIR}
+ ENV NETCDF_ROOT ENV NETCDF_DIR ENV NETCDF_PATH ENV NETCDF4_DIR
+ PATH_SUFFIXES
+ include
+ Include
+ )
+ endif()
+
mark_as_advanced( NETCDF_${INC}_INCLUDE_DIR )
- # debug_var( NETCDF_${INC}_INCLUDE_DIR)
+ #ecbuild_debug_var( NETCDF_${INC}_INCLUDE_DIR)
if (NETCDF_${INC}_INCLUDE_DIR)
list( APPEND NETCDF_INCLUDE_DIRS ${NETCDF_${INC}_INCLUDE_DIR} )
else()
@@ -178,7 +198,7 @@ else()
if( ${location} EQUAL -1 )
else()
if(NETCDF_FIND_REQUIRED)
- message( SEND_ERROR "\"${INC}\" is not found for NetCDF component ${LANGUAGE}" )
+ ecbuild_error( "\"${INC}\" is not found for NetCDF component ${LANGUAGE}" )
elseif( NOT NETCDF_FIND_QUIETLY )
message( STATUS "\"${INC}\" is not found for NetCDF component ${LANGUAGE}" )
endif()
@@ -249,19 +269,19 @@ else()
# Append the libraries for this language binding to the list of all
# required libraries.
-
+
if( NETCDF_${LANGUAGE}_FOUND )
ecbuild_debug( "FindNetCDF4: ${LANGUAGE} language bindings found" )
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
- list( APPEND NETCDF_${LANGUAGE}_LIBRARIES
+ list( APPEND NETCDF_${LANGUAGE}_LIBRARIES
debug ${NETCDF_${LANGUAGE}_LIBRARIES_DEBUG}
optimized ${NETCDF_${LANGUAGE}_LIBRARIES_RELEASE} )
else()
- list( APPEND NETCDF_${LANGUAGE}_LIBRARIES
- ${NETCDF_${LANGUAGE}_LIBRARIES_RELEASE} )
+ list( APPEND NETCDF_${LANGUAGE}_LIBRARIES
+ ${NETCDF_${LANGUAGE}_LIBRARIES_RELEASE} )
endif()
endif()
- # debug_var( NETCDF_${LANGUAGE}_LIBRARIES )
+ # ecbuild_debug_var( NETCDF_${LANGUAGE}_LIBRARIES )
list( APPEND NETCDF_FOUND_REQUIRED_VARS NETCDF_${LANGUAGE}_FOUND )
endforeach()
@@ -294,7 +314,10 @@ endif()
set( NETCDF4_FIND_QUIETLY ${NETCDF_FIND_QUIETLY} )
set( NETCDF4_FIND_REQUIRED ${NETCDF_FIND_REQUIRED} )
-find_package_handle_standard_args( NETCDF4 DEFAULT_MSG
+# handle the QUIET and REQUIRED arguments and set NETCDF4_FOUND to TRUE
+# if all listed variables are valid
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( NetCDF4 DEFAULT_MSG
${NETCDF_FOUND_REQUIRED_VARS}
NETCDF_LIBRARIES
NETCDF_INCLUDE_DIRS
diff --git a/cmake/contrib/GetGitRevisionDescription.cmake.in b/cmake/contrib/GetGitRevisionDescription.cmake.in
index 7a3e42f..9fd3e64 100644
--- a/cmake/contrib/GetGitRevisionDescription.cmake.in
+++ b/cmake/contrib/GetGitRevisionDescription.cmake.in
@@ -33,6 +33,10 @@ else()
endif()
if(NOT HEAD_HASH)
+ if(EXISTS "@GIT_DATA@/head-ref")
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
-endif()
\ No newline at end of file
+ else()
+ set(HEAD_HASH "unknown")
+ endif()
+endif()
diff --git a/cmake/ecbuild_add_c_flags.cmake b/cmake/ecbuild_add_c_flags.cmake
index bef1d34..e6923a9 100644
--- a/cmake/ecbuild_add_c_flags.cmake
+++ b/cmake/ecbuild_add_c_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -40,41 +40,53 @@ macro( ecbuild_add_c_flags m_c_flags )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
- if( NOT DEFINED N_CFLAG )
- set( N_CFLAG 0 )
+ set( _try_add_flag TRUE )
+ if( _PAR_BUILD )
+ string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_CAPS )
+ string( TOUPPER ${_PAR_BUILD} _PAR_BUILD_CAPS )
+ if( NOT CMAKE_BUILD_TYPE_CAPS MATCHES "${_PAR_BUILD_CAPS}" )
+ set( _try_add_flag FALSE )
+ endif()
endif()
+ if( _try_add_flag )
+ if( NOT DEFINED N_CFLAG )
+ set( N_CFLAG 0 )
+ endif()
- math( EXPR N_CFLAG '${N_CFLAG}+1' )
+ math( EXPR N_CFLAG '${N_CFLAG}+1' )
- if( NOT ECBUILD_TRUST_FLAGS )
- if( DEFINED _PAR_NAME )
- check_c_compiler_flag( ${_flags} ${_PAR_NAME} )
- set( _flag_ok ${${_PAR_NAME}} )
+ if( NOT ECBUILD_TRUST_FLAGS )
+ if( DEFINED _PAR_NAME )
+ check_c_compiler_flag( ${_flags} ${_PAR_NAME} )
+ set( _flag_ok ${${_PAR_NAME}} )
+ else()
+ check_c_compiler_flag( ${_flags} C_FLAG_TEST_${N_CFLAG} )
+ set( _flag_ok ${C_FLAG_TEST_${N_CFLAG}} )
+ endif()
else()
- check_c_compiler_flag( ${_flags} C_FLAG_TEST_${N_CFLAG} )
- set( _flag_ok ${C_FLAG_TEST_${N_CFLAG}} )
+ set( _flag_ok 1 )
endif()
- else()
- set( _flag_ok 1 )
- endif()
- if( _flag_ok )
- if( _PAR_BUILD )
- set( CMAKE_C_FLAGS_${_PAR_BUILD} "${CMAKE_C_FLAGS_${_PAR_BUILD}} ${_flags}" )
- ecbuild_debug( "C FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+ if( _flag_ok )
+ if( _PAR_BUILD )
+ set( CMAKE_C_FLAGS_${_PAR_BUILD} "${CMAKE_C_FLAGS_${_PAR_BUILD}} ${_flags}" )
+ ecbuild_debug( "C FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+ else()
+ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" )
+ ecbuild_debug( "C FLAG [${_flags}] added" )
+ endif()
else()
- set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" )
- ecbuild_debug( "C FLAG [${_flags}] added" )
+ ecbuild_warn( "Unrecognised C flag [${_flags}] -- skipping" )
endif()
- else()
- message( WARNING "Unrecognised C flag [${_flags}] -- skipping" )
endif()
+ unset( _flags )
+ unset( _flag_ok )
+ unset( _try_add_flag )
endif()
- unset( _flags )
- unset( _flag_ok )
+
endmacro()
macro( cmake_add_c_flags m_c_flags )
- message( DEPRECATION " cmake_add_c_flags is deprecated, use ecbuild_add_c_flags instead." )
+ ecbuild_deprecate( " cmake_add_c_flags is deprecated, use ecbuild_add_c_flags instead." )
ecbuild_add_c_flags( ${m_c_flags} )
endmacro()
diff --git a/cmake/ecbuild_add_cxx11_flags.cmake b/cmake/ecbuild_add_cxx11_flags.cmake
index a4cce91..df8cde5 100644
--- a/cmake/ecbuild_add_cxx11_flags.cmake
+++ b/cmake/ecbuild_add_cxx11_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/ecbuild_add_cxx_flags.cmake b/cmake/ecbuild_add_cxx_flags.cmake
index 8393572..63c442e 100644
--- a/cmake/ecbuild_add_cxx_flags.cmake
+++ b/cmake/ecbuild_add_cxx_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -39,42 +39,54 @@ macro( ecbuild_add_cxx_flags m_cxx_flags )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
- if( NOT DEFINED N_CXXFLAG )
- set( N_CXXFLAG 0 )
+ set( _try_add_flag TRUE )
+ if( _PAR_BUILD )
+ string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_CAPS )
+ string( TOUPPER ${_PAR_BUILD} _PAR_BUILD_CAPS )
+ if( NOT CMAKE_BUILD_TYPE_CAPS MATCHES "${_PAR_BUILD_CAPS}" )
+ set( _try_add_flag FALSE )
+ endif()
endif()
+ if( _try_add_flag )
+
+ if( NOT DEFINED N_CXXFLAG )
+ set( N_CXXFLAG 0 )
+ endif()
- math( EXPR N_CXXFLAG '${N_CXXFLAG}+1' )
+ math( EXPR N_CXXFLAG '${N_CXXFLAG}+1' )
- if( NOT ECBUILD_TRUST_FLAGS )
- if( DEFINED _PAR_NAME )
- check_cxx_compiler_flag( ${_flags} ${_PAR_NAME} )
- set( _flag_ok ${${_PAR_NAME}} )
+ if( NOT ECBUILD_TRUST_FLAGS )
+ if( DEFINED _PAR_NAME )
+ check_cxx_compiler_flag( ${_flags} ${_PAR_NAME} )
+ set( _flag_ok ${${_PAR_NAME}} )
+ else()
+ check_cxx_compiler_flag( ${_flags} CXX_FLAG_TEST_${N_CXXFLAG} )
+ set( _flag_ok CXX_FLAG_TEST_${N_CXXFLAG} )
+ endif()
else()
- check_cxx_compiler_flag( ${_flags} CXX_FLAG_TEST_${N_CXXFLAG} )
- set( _flag_ok CXX_FLAG_TEST_${N_CXXFLAG} )
+ set( _flag_ok 1 )
endif()
- else()
- set( _flag_ok 1 )
- endif()
- if( _flag_ok )
- if( _PAR_BUILD )
- set( CMAKE_CXX_FLAGS_${_PAR_BUILD} "${CMAKE_CXX_FLAGS_${_PAR_BUILD}} ${_flags}" )
- ecbuild_debug( "C++ FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+ if( _flag_ok )
+ if( _PAR_BUILD )
+ set( CMAKE_CXX_FLAGS_${_PAR_BUILD} "${CMAKE_CXX_FLAGS_${_PAR_BUILD}} ${_flags}" )
+ ecbuild_debug( "C++ FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+ else()
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" )
+ ecbuild_debug( "C++ FLAG [${_flags}] added" )
+ endif()
else()
- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" )
- ecbuild_debug( "C++ FLAG [${_flags}] added" )
+ ecbuild_info( "Unrecognised CXX flag [${_flags}] -- skipping" )
endif()
- else()
- message( STATUS "Unrecognised CXX flag [${_flags}] -- skipping" )
endif()
+ unset( _flags )
+ unset( _flag_ok )
+ unset( _try_add_flag )
endif()
- unset( _flags )
- unset( _flag_ok )
endmacro()
macro( cmake_add_cxx_flags m_cxx_flags )
- message( DEPRECATION " cmake_add_cxx_flags is deprecated, use ecbuild_add_cxx_flags instead." )
+ ecbuild_deprecate( " cmake_add_cxx_flags is deprecated, use ecbuild_add_cxx_flags instead." )
ecbuild_add_cxx_flags( ${m_cxx_flags} )
endmacro()
diff --git a/cmake/ecbuild_add_executable.cmake b/cmake/ecbuild_add_executable.cmake
index e4e39a1..4572832 100644
--- a/cmake/ecbuild_add_executable.cmake
+++ b/cmake/ecbuild_add_executable.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -16,6 +16,9 @@
#
# ecbuild_add_executable( TARGET <name>
# SOURCES <source1> [<source2> ...]
+# [ SOURCES_GLOB <glob1> [<glob2> ...] ]
+# [ SOURCES_EXCLUDE_REGEX <regex1> [<regex2> ...] ]
+# [ OBJECTS <obj1> [<obj2> ...] ]
# [ TEMPLATES <template1> [<template2> ...] ]
# [ LIBS <library1> [<library2> ...] ]
# [ INCLUDES <path1> [<path2> ...] ]
@@ -41,6 +44,16 @@
# SOURCES : required
# list of source files
#
+# SOURCES_GLOB : optional
+# search pattern to find source files to compile (note: not recommend according to CMake guidelines)
+# it is usually better to explicitly list the source files in the CMakeList.txt
+#
+# SOURCES_EXCLUDE_REGEX : optional
+# search pattern to exclude source files from compilation, applies o the results of SOURCES_GLOB
+#
+# OBJECTS : optional
+# list of object libraries to add to this target
+#
# TEMPLATES : optional
# list of files specified as SOURCES which are not to be compiled separately
# (these are commonly template implementation files included in a header)
@@ -69,7 +82,7 @@
#
# NOINSTALL : optional
# do not install the executable
-#
+#
# VERSION : optional, AUTO_VERSION or LIBS_VERSION is used if not specified
# version to use as executable version
#
@@ -85,7 +98,6 @@
# FFLAGS : optional
# list of Fortran compiler flags to use for all Fortran source files
#
-#
# LINKER_LANGUAGE : optional
# sets the LINKER_LANGUAGE property on the target
#
@@ -98,20 +110,20 @@ macro( ecbuild_add_executable )
set( options NOINSTALL AUTO_VERSION )
set( single_value_args TARGET COMPONENT LINKER_LANGUAGE VERSION OUTPUT_NAME )
- set( multi_value_args SOURCES TEMPLATES LIBS INCLUDES DEPENDS PERSISTENT DEFINITIONS CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
+ set( multi_value_args SOURCES SOURCES_GLOB SOURCES_EXCLUDE_REGEX OBJECTS TEMPLATES LIBS INCLUDES DEPENDS PERSISTENT DEFINITIONS CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_add_executable(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_add_executable(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_TARGET )
- message(FATAL_ERROR "The call to ecbuild_add_executable() doesn't specify the TARGET.")
+ ecbuild_critical("The call to ecbuild_add_executable() doesn't specify the TARGET.")
endif()
- if( NOT _PAR_SOURCES )
- message(FATAL_ERROR "The call to ecbuild_add_executable() doesn't specify the SOURCES.")
+ if( NOT _PAR_SOURCES AND NOT _PAR_OBJECTS AND NOT _PAR_SOURCES_GLOB )
+ ecbuild_critical("The call to ecbuild_add_executable() specifies neither SOURCES nor OBJECTS nor SOURCES_GLOB.")
endif()
### conditional build
@@ -130,19 +142,6 @@ macro( ecbuild_add_executable )
if( _${_PAR_TARGET}_condition )
- # add include dirs if defined
- if( DEFINED _PAR_INCLUDES )
- list(REMOVE_DUPLICATES _PAR_INCLUDES )
- foreach( path ${_PAR_INCLUDES} ) # skip NOTFOUND
- if( path )
- ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): add ${path} to include_directories")
- include_directories( ${path} )
- else()
- ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): ${path} not found - not adding to include_directories")
- endif()
- endforeach()
- endif()
-
# add persistent layer files
if( DEFINED _PAR_PERSISTENT )
if( DEFINED PERSISTENT_NAMESPACE )
@@ -159,8 +158,44 @@ macro( ecbuild_add_executable )
add_custom_target( ${_PAR_TARGET}_templates SOURCES ${_PAR_TEMPLATES} )
endif()
- # add the executable target
- add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} )
+ # glob sources
+ unset( _glob_srcs )
+ foreach( pattern ${_PAR_SOURCES_GLOB} )
+ ecbuild_list_add_pattern( LIST _glob_srcs GLOB "${pattern}" )
+ endforeach()
+
+ foreach( pattern ${_PAR_SOURCES_EXCLUDE_REGEX} )
+ ecbuild_list_exclude_pattern( LIST _glob_srcs REGEX "${pattern}" )
+ endforeach()
+
+ # insert already compiled objects (from OBJECT libraries)
+ unset( _all_objects )
+ foreach( _obj ${_PAR_OBJECTS} )
+ list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
+ endforeach()
+
+ list( APPEND _PAR_SOURCES ${_glob_srcs} )
+
+ if( ECBUILD_LIST_SOURCES )
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): sources ${_PAR_SOURCES}")
+ endif()
+
+ add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} ${_all_objects} )
+
+ # ecbuild_echo_target( ${_PAR_TARGET} )
+
+ # add include dirs if defined
+ if( DEFINED _PAR_INCLUDES )
+ list(REMOVE_DUPLICATES _PAR_INCLUDES )
+ foreach( path ${_PAR_INCLUDES} ) # skip NOTFOUND
+ if( path )
+ ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): add ${path} to include_directories")
+ target_include_directories( ${_PAR_TARGET} PRIVATE ${path} )
+ else()
+ ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): ${path} not found - not adding to include_directories")
+ endif()
+ endforeach()
+ endif()
# set OUTPUT_NAME
@@ -191,24 +226,71 @@ macro( ecbuild_add_executable )
endif()
# filter sources
+
ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
+ # ecbuild_debug_var( ${_PAR_TARGET}_h_srcs )
+ # ecbuild_debug_var( ${_PAR_TARGET}_c_srcs )
+ # ecbuild_debug_var( ${_PAR_TARGET}_cxx_srcs )
+ # ecbuild_debug_var( ${_PAR_TARGET}_f_srcs )
+
# add local flags
- if( DEFINED _PAR_CFLAGS )
- ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): use C flags ${_PAR_CFLAGS}")
- set_source_files_properties( ${${_PAR_TARGET}_c_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CFLAGS}" )
- endif()
- if( DEFINED _PAR_CXXFLAGS )
- ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): use C++ flags ${_PAR_CFLAGS}")
- set_source_files_properties( ${${_PAR_TARGET}_cxx_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CXXFLAGS}" )
+
+ if( ${_PAR_TARGET}_c_srcs )
+
+ if( ECBUILD_SOURCE_FLAGS )
+ ecbuild_source_flags( ${_PAR_TARGET}_C_SOURCE_FLAGS
+ ${_PAR_TARGET}_c
+ "${_PAR_CFLAGS}"
+ "${${_PAR_TARGET}_c_srcs}" )
+
+ ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): setting source file C flags from ${${_PAR_TARGET}_C_SOURCE_FLAGS}")
+ include( ${${_PAR_TARGET}_C_SOURCE_FLAGS} )
+
+ elseif( DEFINED _PAR_CFLAGS )
+
+ ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): use C flags ${_PAR_CFLAGS}")
+ set_source_files_properties( ${${_PAR_TARGET}_c_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CFLAGS}" )
+
+ endif()
endif()
- if( DEFINED _PAR_FFLAGS )
- ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): use Fortran flags ${_PAR_CFLAGS}")
- set_source_files_properties( ${${_PAR_TARGET}_f_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_FFLAGS}" )
+
+ if( ${_PAR_TARGET}_cxx_srcs )
+
+ if( ECBUILD_SOURCE_FLAGS )
+ ecbuild_source_flags( ${_PAR_TARGET}_CXX_SOURCE_FLAGS
+ ${_PAR_TARGET}_cxx
+ "${_PAR_CXXFLAGS}"
+ "${${_PAR_TARGET}_cxx_srcs}" )
+
+ ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): setting source file CXX flags from ${${_PAR_TARGET}_CXX_SOURCE_FLAGS}")
+ include( ${${_PAR_TARGET}_CXX_SOURCE_FLAGS} )
+
+ elseif( DEFINED _PAR_CXXFLAGS )
+
+ ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): use C++ flags ${_PAR_CFLAGS}")
+ set_source_files_properties( ${${_PAR_TARGET}_cxx_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CXXFLAGS}" )
+
+ endif()
endif()
- if( DEFINED _PAR_GENERATED )
- ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): mark as generated ${_PAR_GENERATED}")
- set_source_files_properties( ${_PAR_GENERATED} PROPERTIES GENERATED 1 )
+
+ if( ${_PAR_TARGET}_f_srcs )
+
+ if( ECBUILD_SOURCE_FLAGS )
+ ecbuild_source_flags( ${_PAR_TARGET}_Fortran_SOURCE_FLAGS
+ ${_PAR_TARGET}_f
+ "${_PAR_FFLAGS}"
+ "${${_PAR_TARGET}_f_srcs}" )
+
+ ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): setting source file Fortran flags from ${${_PAR_TARGET}_Fortran_SOURCE_FLAGS}")
+ include( ${${_PAR_TARGET}_Fortran_SOURCE_FLAGS} )
+
+ elseif( DEFINED _PAR_FFLAGS )
+
+ ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): use Fortran flags ${_PAR_CFLAGS}")
+ set_source_files_properties( ${${_PAR_TARGET}_f_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_FFLAGS}" )
+
+ endif()
endif()
# define VERSION if requested
@@ -222,11 +304,6 @@ macro( ecbuild_add_executable )
endif()
endif()
- # debug_var( ${_PAR_TARGET}_h_srcs )
- # debug_var( ${_PAR_TARGET}_c_srcs )
- # debug_var( ${_PAR_TARGET}_cxx_srcs )
- # debug_var( ${_PAR_TARGET}_f_srcs )
-
# installation
if( NOT _PAR_NOINSTALL )
@@ -240,7 +317,7 @@ macro( ecbuild_add_executable )
# endif()
install( TARGETS ${_PAR_TARGET}
- EXPORT ${CMAKE_PROJECT_NAME}-targets
+ EXPORT ${PROJECT_NAME}-targets
RUNTIME DESTINATION ${INSTALL_BIN_DIR}
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${INSTALL_LIB_DIR} )
@@ -273,6 +350,13 @@ macro( ecbuild_add_executable )
if( DEFINED _PAR_LINKER_LANGUAGE )
ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): using linker language ${_PAR_LINKER_LANGUAGE}")
set_property( TARGET ${_PAR_TARGET} PROPERTY LINKER_LANGUAGE ${_PAR_LINKER_LANGUAGE} )
+ if( ECBUILD_${_PAR_LINKER_LANGUAGE}_IMPLICIT_LINK_LIBRARIES )
+ target_link_libraries( ${_PAR_TARGET} ${ECBUILD_${_PAR_LINKER_LANGUAGE}_IMPLICIT_LINK_LIBRARIES} )
+ endif()
+ endif()
+
+ if( ECBUILD_IMPLICIT_LINK_LIBRARIES )
+ target_link_libraries( ${_PAR_TARGET} ${ECBUILD_IMPLICIT_LINK_LIBRARIES} )
endif()
# make sure target is removed before - some problems with AIX
diff --git a/cmake/ecbuild_add_extra_search_paths.cmake b/cmake/ecbuild_add_extra_search_paths.cmake
index fac96ba..94ac85b 100644
--- a/cmake/ecbuild_add_extra_search_paths.cmake
+++ b/cmake/ecbuild_add_extra_search_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -15,10 +15,10 @@
function( ecbuild_add_extra_search_paths pkg )
- message( DEPRECATION " ecbuild_add_extra_search_paths modifies CMAKE_PREFIX_PATH,"
- " which can affect future package discovery if not undone by the caller."
- " The current CMAKE_PREFIX_PATH is being backed up as _CMAKE_PREFIX_PATH"
- " so it can later be restored." )
+ ecbuild_deprecate( " ecbuild_add_extra_search_paths modifies CMAKE_PREFIX_PATH,"
+ " which can affect future package discovery if not undone by the caller."
+ " The current CMAKE_PREFIX_PATH is being backed up as _CMAKE_PREFIX_PATH"
+ " so it can later be restored." )
# Back up current CMAKE_PREFIX_PATH so the caller can reset it
set( _CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE )
@@ -28,6 +28,6 @@ function( ecbuild_add_extra_search_paths pkg )
ecbuild_list_extra_search_paths( ${pkg} CMAKE_PREFIX_PATH )
set( CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE )
- # debug_var( CMAKE_PREFIX_PATH )
+ # ecbuild_debug_var( CMAKE_PREFIX_PATH )
endfunction()
diff --git a/cmake/ecbuild_add_fortran_flags.cmake b/cmake/ecbuild_add_fortran_flags.cmake
index f0da53f..86cea83 100644
--- a/cmake/ecbuild_add_fortran_flags.cmake
+++ b/cmake/ecbuild_add_fortran_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -44,43 +44,55 @@ macro( ecbuild_add_fortran_flags m_fortran_flags )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
- if( NOT DEFINED N_FortranFLAG )
- set( N_FortranFLAG 0 )
+ set( _try_add_flag TRUE )
+ if( _PAR_BUILD )
+ string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_CAPS )
+ string( TOUPPER ${_PAR_BUILD} _PAR_BUILD_CAPS )
+ if( NOT CMAKE_BUILD_TYPE_CAPS MATCHES "${_PAR_BUILD_CAPS}" )
+ set( _try_add_flag FALSE )
+ endif()
endif()
- math( EXPR N_FortranFLAG '${N_FortranFLAG}+1' )
+ if( _try_add_flag )
+ if( NOT DEFINED N_FortranFLAG )
+ set( N_FortranFLAG 0 )
+ endif()
+
+ math( EXPR N_FortranFLAG '${N_FortranFLAG}+1' )
- if( NOT ECBUILD_TRUST_FLAGS )
- if( DEFINED _PAR_NAME )
- check_fortran_compiler_flag( ${_flags} ${_PAR_NAME} )
- set( _flag_ok ${${_PAR_NAME}} )
+ if( NOT ECBUILD_TRUST_FLAGS )
+ if( DEFINED _PAR_NAME )
+ check_fortran_compiler_flag( ${_flags} ${_PAR_NAME} )
+ set( _flag_ok ${${_PAR_NAME}} )
+ else()
+ check_fortran_compiler_flag( ${_flags} Fortran_FLAG_TEST_${N_FortranFLAG} )
+ set( _flag_ok ${Fortran_FLAG_TEST_${N_FortranFLAG}} )
+ endif()
else()
- check_fortran_compiler_flag( ${_flags} Fortran_FLAG_TEST_${N_FortranFLAG} )
- set( _flag_ok ${Fortran_FLAG_TEST_${N_FortranFLAG}} )
+ set( _flag_ok 1 )
endif()
- else()
- set( _flag_ok 1 )
- endif()
- if( _flag_ok )
- if( _PAR_BUILD )
- set( CMAKE_Fortran_FLAGS_${_PAR_BUILD} "${CMAKE_Fortran_FLAGS_${_PAR_BUILD}} ${_flags}" )
- ecbuild_debug( "Fortran FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+ if( _flag_ok )
+ if( _PAR_BUILD )
+ set( CMAKE_Fortran_FLAGS_${_PAR_BUILD} "${CMAKE_Fortran_FLAGS_${_PAR_BUILD}} ${_flags}" )
+ ecbuild_debug( "Fortran FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+ else()
+ set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${_flags}" )
+ ecbuild_debug( "Fortran FLAG [${_flags}] added" )
+ endif()
else()
- set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${_flags}" )
- ecbuild_debug( "Fortran FLAG [${_flags}] added" )
+ ecbuild_info( "Unrecognised Fortran flag [${_flags}] -- skipping" )
endif()
- else()
- message( STATUS "Unrecognised Fortran flag [${_flags}] -- skipping" )
endif()
- endif()
- unset( _flags )
- unset( _flag_ok )
+ unset( _flags )
+ unset( _flag_ok )
+ unset( _try_add_flag )
+ endif()
endmacro()
macro( cmake_add_fortran_flags m_fortran_flags )
- message( DEPRECATION " cmake_add_fortran_flags is deprecated, use ecbuild_add_fortran_flags instead." )
+ ecbuild_deprecate( " cmake_add_fortran_flags is deprecated, use ecbuild_add_fortran_flags instead." )
ecbuild_add_fortran_flags( ${m_fortran_flags} )
endmacro()
diff --git a/cmake/ecbuild_add_library.cmake b/cmake/ecbuild_add_library.cmake
index dc47956..48602a4 100644
--- a/cmake/ecbuild_add_library.cmake
+++ b/cmake/ecbuild_add_library.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -16,7 +16,10 @@
#
# ecbuild_add_library( TARGET <name>
# SOURCES <source1> [<source2> ...]
-# [ TYPE SHARED|STATIC|MODULE ]
+# [ SOURCES_GLOB <glob1> [<glob2> ...] ]
+# [ SOURCES_EXCLUDE_REGEX <regex1> [<regex2> ...] ]
+# [ TYPE SHARED|STATIC|MODULE|OBJECT ]
+# [ OBJECTS <obj1> [<obj2> ...] ]
# [ TEMPLATES <template1> [<template2> ...] ]
# [ LIBS <library1> [<library2> ...] ]
# [ INCLUDES <path1> [<path2> ...] ]
@@ -55,6 +58,17 @@
# :STATIC: archives of object files for use when linking other targets.
# :MODULE: plugins that are not linked into other targets but may be loaded
# dynamically at runtime using dlopen-like functionality
+# :OBJECT: files are just compiled into objects
+#
+# SOURCES_GLOB : optional
+# search pattern to find source files to compile (note: not recommend according to CMake guidelines)
+# it is usually better to explicitly list the source files in the CMakeList.txt
+#
+# SOURCES_EXCLUDE_REGEX : optional
+# search pattern to exclude source files from compilation, applies o the results of SOURCES_GLOB
+#
+# OBJECTS : optional
+# list of object libraries to add to this target
#
# TEMPLATES : optional
# list of files specified as SOURCES which are not to be compiled separately
@@ -135,20 +149,20 @@ function( ecbuild_add_library_impl )
set( options NOINSTALL AUTO_VERSION )
set( single_value_args TARGET TYPE COMPONENT INSTALL_HEADERS INSTALL_HEADERS_REGEX LINKER_LANGUAGE HEADER_DESTINATION VERSION OUTPUT_NAME )
- set( multi_value_args SOURCES TEMPLATES LIBS INCLUDES PRIVATE_INCLUDES PUBLIC_INCLUDES DEPENDS PERSISTENT DEFINITIONS INSTALL_HEADERS_LIST CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
+ set( multi_value_args SOURCES SOURCES_GLOB SOURCES_EXCLUDE_REGEX OBJECTS TEMPLATES LIBS INCLUDES PRIVATE_INCLUDES PUBLIC_INCLUDES DEPENDS PERSISTENT DEFINITIONS INSTALL_HEADERS_LIST CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_add_library(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_add_library(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_TARGET )
- message(FATAL_ERROR "The call to ecbuild_add_library() doesn't specify the TARGET.")
+ ecbuild_critical("The call to ecbuild_add_library() doesn't specify the TARGET.")
endif()
- if( NOT _PAR_SOURCES )
- message(FATAL_ERROR "The call to ecbuild_add_library() doesn't specify the SOURCES.")
+ if( NOT _PAR_SOURCES AND NOT _PAR_OBJECTS AND NOT _PAR_SOURCES_GLOB )
+ ecbuild_critical("The call to ecbuild_add_library() specifies neither SOURCES nor OBJECTS nor SOURCES_GLOB")
endif()
### conditional build
@@ -172,8 +186,9 @@ function( ecbuild_add_library_impl )
# checks that is either SHARED or STATIC or MODULE
if( NOT _PAR_TYPE MATCHES "STATIC" AND
NOT _PAR_TYPE MATCHES "SHARED" AND
+ NOT _PAR_TYPE MATCHES "OBJECT" AND
NOT _PAR_TYPE MATCHES "MODULE" )
- message( FATAL_ERROR "library type must be one of [ STATIC | SHARED | MODULE ]" )
+ ecbuild_critical( "library type must be one of [ STATIC | SHARED | MODULE | OBJECT ]" )
endif()
ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): library type is ${_PAR_TYPE}")
endif()
@@ -195,7 +210,31 @@ function( ecbuild_add_library_impl )
add_custom_target( ${_PAR_TARGET}_templates SOURCES ${_PAR_TEMPLATES} )
endif()
- add_library( ${_PAR_TARGET} ${_PAR_TYPE} ${_PAR_SOURCES} )
+ # glob sources
+ unset( _glob_srcs )
+ foreach( pattern ${_PAR_SOURCES_GLOB} )
+ ecbuild_list_add_pattern( LIST _glob_srcs GLOB "${pattern}" )
+ endforeach()
+
+ foreach( pattern ${_PAR_SOURCES_EXCLUDE_REGEX} )
+ ecbuild_list_exclude_pattern( LIST _glob_srcs REGEX "${pattern}" )
+ endforeach()
+
+ # insert already compiled objects (from OBJECT libraries)
+ unset( _all_objects )
+ foreach( _obj ${_PAR_OBJECTS} )
+ list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
+ endforeach()
+
+ list( APPEND _PAR_SOURCES ${_glob_srcs} )
+
+ if( ECBUILD_LIST_SOURCES )
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): sources ${_PAR_SOURCES}")
+ endif()
+
+ add_library( ${_PAR_TARGET} ${_PAR_TYPE} ${_PAR_SOURCES} ${_all_objects} )
+
+ # ecbuild_echo_target( ${_PAR_TARGET} )
# set OUTPUT_NAME
@@ -306,27 +345,74 @@ function( ecbuild_add_library_impl )
# filter sources
- ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
+ if( _PAR_SOURCES )
+ ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
+ endif()
- # debug_var( ${_PAR_TARGET}_h_srcs )
- # debug_var( ${_PAR_TARGET}_c_srcs )
- # debug_var( ${_PAR_TARGET}_cxx_srcs )
- # debug_var( ${_PAR_TARGET}_f_srcs )
+ # ecbuild_debug_var( ${_PAR_TARGET}_h_srcs )
+ # ecbuild_debug_var( ${_PAR_TARGET}_c_srcs )
+ # ecbuild_debug_var( ${_PAR_TARGET}_cxx_srcs )
+ # ecbuild_debug_var( ${_PAR_TARGET}_f_srcs )
# add local flags
- if( DEFINED _PAR_CFLAGS )
- ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): use C flags ${_PAR_CFLAGS}")
- set_source_files_properties( ${${_PAR_TARGET}_c_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CFLAGS}" )
+ if( ${_PAR_TARGET}_c_srcs )
+
+ if( ECBUILD_SOURCE_FLAGS )
+ ecbuild_source_flags( ${_PAR_TARGET}_C_SOURCE_FLAGS
+ ${_PAR_TARGET}_c
+ "${_PAR_CFLAGS}"
+ "${${_PAR_TARGET}_c_srcs}" )
+
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): setting source file C flags from ${${_PAR_TARGET}_C_SOURCE_FLAGS}")
+ include( ${${_PAR_TARGET}_C_SOURCE_FLAGS} )
+
+ elseif( DEFINED _PAR_CFLAGS )
+
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): use C flags ${_PAR_CFLAGS}")
+ set_source_files_properties( ${${_PAR_TARGET}_c_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CFLAGS}" )
+
+ endif()
endif()
- if( DEFINED _PAR_CXXFLAGS )
- ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): use C++ flags ${_PAR_CFLAGS}")
- set_source_files_properties( ${${_PAR_TARGET}_cxx_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CXXFLAGS}" )
+
+ if( ${_PAR_TARGET}_cxx_srcs )
+
+ if( ECBUILD_SOURCE_FLAGS )
+ ecbuild_source_flags( ${_PAR_TARGET}_CXX_SOURCE_FLAGS
+ ${_PAR_TARGET}_cxx
+ "${_PAR_CXXFLAGS}"
+ "${${_PAR_TARGET}_cxx_srcs}" )
+
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): setting source file CXX flags from ${${_PAR_TARGET}_CXX_SOURCE_FLAGS}")
+ include( ${${_PAR_TARGET}_CXX_SOURCE_FLAGS} )
+
+ elseif( DEFINED _PAR_CXXFLAGS )
+
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): use C++ flags ${_PAR_CFLAGS}")
+ set_source_files_properties( ${${_PAR_TARGET}_cxx_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CXXFLAGS}" )
+
+ endif()
endif()
- if( DEFINED _PAR_FFLAGS )
- ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): use Fortran flags ${_PAR_CFLAGS}")
- set_source_files_properties( ${${_PAR_TARGET}_f_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_FFLAGS}" )
+
+ if( ${_PAR_TARGET}_f_srcs )
+
+ if( ECBUILD_SOURCE_FLAGS )
+ ecbuild_source_flags( ${_PAR_TARGET}_Fortran_SOURCE_FLAGS
+ ${_PAR_TARGET}_f
+ "${_PAR_FFLAGS}"
+ "${${_PAR_TARGET}_f_srcs}" )
+
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): setting source file Fortran flags from ${${_PAR_TARGET}_Fortran_SOURCE_FLAGS}")
+ include( ${${_PAR_TARGET}_Fortran_SOURCE_FLAGS} )
+
+ elseif( DEFINED _PAR_FFLAGS )
+
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): use Fortran flags ${_PAR_CFLAGS}")
+ set_source_files_properties( ${${_PAR_TARGET}_f_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_FFLAGS}" )
+
+ endif()
endif()
+
if( DEFINED _PAR_GENERATED )
ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): mark as generated ${_PAR_GENERATED}")
set_source_files_properties( ${_PAR_GENERATED} PROPERTIES GENERATED 1 )
@@ -336,11 +422,18 @@ function( ecbuild_add_library_impl )
if( DEFINED _PAR_LINKER_LANGUAGE )
ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): using linker language ${_PAR_LINKER_LANGUAGE}")
set_property( TARGET ${_PAR_TARGET} PROPERTY LINKER_LANGUAGE ${_PAR_LINKER_LANGUAGE} )
+ if( ECBUILD_${_PAR_LINKER_LANGUAGE}_IMPLICIT_LINK_LIBRARIES )
+ target_link_libraries( ${_PAR_TARGET} ${ECBUILD_${_PAR_LINKER_LANGUAGE}_IMPLICIT_LINK_LIBRARIES} )
+ endif()
endif()
- # installation
+ if( ECBUILD_IMPLICIT_LINK_LIBRARIES )
+ target_link_libraries( ${_PAR_TARGET} ${ECBUILD_IMPLICIT_LINK_LIBRARIES} )
+ endif()
- if( NOT _PAR_NOINSTALL )
+ # installation (except for OBJECT libraries)
+
+ if( NOT _PAR_NOINSTALL AND NOT _PAR_TYPE MATCHES "OBJECT" )
ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): installing to ${INSTALL_LIB_DIR}")
# and associate with defined component
@@ -351,7 +444,7 @@ function( ecbuild_add_library_impl )
# endif()
install( TARGETS ${_PAR_TARGET}
- EXPORT ${CMAKE_PROJECT_NAME}-targets
+ EXPORT ${PROJECT_NAME}-targets
RUNTIME DESTINATION ${INSTALL_BIN_DIR}
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${INSTALL_LIB_DIR} )
@@ -421,7 +514,9 @@ function( ecbuild_add_library_impl )
endif()
# make sure target is removed before - some problems with AIX
- add_custom_command( TARGET ${_PAR_TARGET} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove $<TARGET_FILE:${_PAR_TARGET}> )
+ if( NOT _PAR_TYPE MATCHES "OBJECT" )
+ add_custom_command( TARGET ${_PAR_TARGET} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove $<TARGET_FILE:${_PAR_TARGET}> )
+ endif()
# for the links target
if( NOT _PAR_NOINSTALL )
@@ -469,7 +564,7 @@ macro( ecbuild_add_library )
else()
if( NOT DEFINED _p_TARGET )
- message(FATAL_ERROR "The call to ecbuild_add_library() doesn't specify the TARGET.")
+ ecbuild_critical("The call to ecbuild_add_library() doesn't specify the TARGET.")
else()
if( BUILD_SHARED_LIBS MATCHES "[Bb][Oo][Tt][Hh]" ) # build both types
diff --git a/cmake/ecbuild_add_option.cmake b/cmake/ecbuild_add_option.cmake
index 7728716..c270517 100644
--- a/cmake/ecbuild_add_option.cmake
+++ b/cmake/ecbuild_add_option.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -17,6 +17,7 @@
# ecbuild_add_option( FEATURE <name>
# [ DEFAULT ON|OFF ]
# [ DESCRIPTION <description> ]
+# [ PURPOSE <purpose> ]
# [ REQUIRED_PACKAGES <package1> [<package2> ...] ]
# [ CONDITION <condition1> [<condition2> ...] ]
# [ ADVANCED ] )
@@ -33,18 +34,30 @@
# DESCRIPTION : optional
# string describing the feature (shown in summary and stored in the cache)
#
+# TYPE : optional, one of RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED
+# type of dependency of the project on this package (defaults to OPTIONAL)
+#
+# PURPOSE : optional
+# string describing which functionality this package enables in the project
+#
# REQUIRED_PACKAGES : optional
# list of packages required to be found for this feature to be enabled
#
-# The package specification can be either ::
+# The package specification can have one of two forms. Either ::
#
-# <package> [ <version> ... ]
+# "<package> [ <version> ... ]"
#
-# to search for a given package with option minimum required version or ::
+# to search for a given package using the CMake ``find_package`` mechanism.
+# The entire specification must be enclosed in quotes and is passed on
+# verbatim. Any options of ``find_package`` are supported.
#
-# PROJECT <name> [ VERSION <version> ... ]
+# The other specification must start with ``PROJECT`` like this ::
#
-# to search for an ecBuild project with optional minimum required version.
+# "PROJECT <name> [ VERSION <version> ... ]"
+#
+# and is used to search for an ecBuild project via ``ecbuild_use_package``.
+# The entire specification must be enclosed in quotes and is passed on
+# verbatim. Any options of ``ecbuild_use_package`` are supported.
#
# CONDITION : optional
# conditional expression which must evaluate to true for this option to be
@@ -72,19 +85,19 @@
macro( ecbuild_add_option )
set( options ADVANCED )
- set( single_value_args FEATURE DEFAULT DESCRIPTION )
+ set( single_value_args FEATURE DEFAULT DESCRIPTION TYPE PURPOSE )
set( multi_value_args REQUIRED_PACKAGES CONDITION )
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if( _p_UNPARSED_ARGUMENTS )
- message(FATAL_ERROR "Unknown keywords given to ecbuild_add_option(): \"${_p_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_add_option(): \"${_p_UNPARSED_ARGUMENTS}\"")
endif()
# check FEATURE parameter
if( NOT _p_FEATURE )
- message(FATAL_ERROR "The call to ecbuild_add_option() doesn't specify the FEATURE.")
+ ecbuild_critical("The call to ecbuild_add_option() doesn't specify the FEATURE.")
endif()
# check DEFAULT parameter
@@ -93,11 +106,15 @@ macro( ecbuild_add_option )
set( _p_DEFAULT ON )
else()
if( NOT _p_DEFAULT MATCHES "[Oo][Nn]" AND NOT _p_DEFAULT MATCHES "[Oo][Ff][Ff]" )
- message(FATAL_ERROR "In macro ecbuild_add_option(), DEFAULT is either ON or OFF: \"${_p_DEFAULT}\"")
+ ecbuild_critical("In macro ecbuild_add_option(), DEFAULT is either ON or OFF: \"${_p_DEFAULT}\"")
endif()
endif()
ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): defaults to ${_p_DEFAULT}")
+ if( NOT _p_TYPE )
+ set( _p_TYPE OPTIONAL )
+ endif()
+
# check CONDITION parameter
if( DEFINED _p_CONDITION )
set(_feature_condition_file "${CMAKE_CURRENT_BINARY_DIR}/set_${_p_FEATURE}_condition.cmake")
@@ -135,7 +152,12 @@ macro( ecbuild_add_option )
# define the option -- for cmake GUI
option( ENABLE_${_p_FEATURE} "${_p_DESCRIPTION}" ${_p_DEFAULT} )
- ecbuild_set_feature( ${_p_FEATURE} ENABLED ${_p_DEFAULT} PURPOSE "${_p_DESCRIPTION}" )
+ ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): defining option ENABLE_${_p_FEATURE} '${_p_DESCRIPTION}' ${_p_DEFAULT}")
+ ecbuild_set_feature( ${_p_FEATURE} ENABLED ${_p_DEFAULT} )
+ set_package_properties( ${_p_FEATURE} PROPERTIES
+ DESCRIPTION "${_p_DESCRIPTION}"
+ TYPE ${_p_TYPE}
+ PURPOSE "${_p_PURPOSE}" )
ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE} = ${ENABLE_${_p_FEATURE}}")
set( _do_search ${ENABLE_${_p_FEATURE}} )
@@ -167,9 +189,9 @@ macro( ecbuild_add_option )
set( pkgproject 0 )
endif()
- # debug_var( pkg )
- # debug_var( pkglist )
- # debug_var( pkgname )
+ # ecbuild_debug_var( pkg )
+ # ecbuild_debug_var( pkglist )
+ # ecbuild_debug_var( pkgname )
string( TOUPPER ${pkgname} pkgUPPER )
string( TOLOWER ${pkgname} pkgLOWER )
@@ -206,6 +228,11 @@ macro( ecbuild_add_option )
list( REMOVE_ITEM _find_args ${pkgname} )
ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for Python")
ecbuild_find_python( ${_find_args} )
+ elseif( pkgname STREQUAL "LEXYACC" )
+ set( _find_args ${pkglist} )
+ list( REMOVE_ITEM _find_args ${pkgname} )
+ ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for lex-yacc")
+ ecbuild_find_lexyacc( ${_find_args} )
else()
ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for package ${pkgname}")
find_package( ${pkglist} )
@@ -223,16 +250,16 @@ macro( ecbuild_add_option )
endif()
- # debug_var( ${pkgname}_FOUND )
- # debug_var( ${pkgLOWER}_FOUND )
- # debug_var( ${pkgUPPER}_FOUND )
+ # ecbuild_debug_var( ${pkgname}_FOUND )
+ # ecbuild_debug_var( ${pkgLOWER}_FOUND )
+ # ecbuild_debug_var( ${pkgUPPER}_FOUND )
# we have feature if all required packages were FOUND
if( ${pkgname}_FOUND OR ${pkgUPPER}_FOUND OR ${pkgLOWER}_FOUND )
- message( STATUS "Found package ${pkgname} required for feature ${_p_FEATURE}" )
+ ecbuild_info( "Found package ${pkgname} required for feature ${_p_FEATURE}" )
else()
- message( STATUS "Could not find package ${pkgname} required for feature ${_p_FEATURE} -- Provide ${pkgname} location with -D${pkgUPPER}_PATH=/..." )
+ ecbuild_info( "Could not find package ${pkgname} required for feature ${_p_FEATURE} -- Provide ${pkgname} location with -D${pkgUPPER}_PATH=/..." )
set( HAVE_${_p_FEATURE} 0 )
list( APPEND _failed_to_find_packages ${pkgname} )
endif()
@@ -247,21 +274,21 @@ macro( ecbuild_add_option )
if( HAVE_${_p_FEATURE} )
- message( STATUS "Feature ${_p_FEATURE} enabled" )
+ ecbuild_info( "Feature ${_p_FEATURE} enabled" )
else() # if user provided input and we cannot satisfy FAIL otherwise WARN
if( ${_p_FEATURE}_user_provided_input )
if( _${_p_FEATURE}_condition )
- message( FATAL_ERROR "Feature ${_p_FEATURE} cannot be enabled -- following required packages weren't found: ${_failed_to_find_packages}" )
+ ecbuild_critical( "Feature ${_p_FEATURE} cannot be enabled -- following required packages weren't found: ${_failed_to_find_packages}" )
else()
- message( FATAL_ERROR "Feature ${_p_FEATURE} cannot be enabled -- following condition was not met: ${_p_CONDITION}" )
+ ecbuild_critical( "Feature ${_p_FEATURE} cannot be enabled -- following condition was not met: ${_p_CONDITION}" )
endif()
else()
if( _${_p_FEATURE}_condition )
- message( STATUS "Feature ${_p_FEATURE} was not enabled (also not requested) -- following condition was not met: ${_p_CONDITION}" )
+ ecbuild_info( "Feature ${_p_FEATURE} was not enabled (also not requested) -- following condition was not met: ${_p_CONDITION}" )
else()
- message( STATUS "Feature ${_p_FEATURE} was not enabled (also not requested) -- following required packages weren't found: ${_failed_to_find_packages}" )
+ ecbuild_info( "Feature ${_p_FEATURE} was not enabled (also not requested) -- following required packages weren't found: ${_failed_to_find_packages}" )
endif()
set( ENABLE_${_p_FEATURE} OFF )
ecbuild_set_feature( ${_p_FEATURE} ENABLED OFF )
diff --git a/cmake/ecbuild_add_persistent.cmake b/cmake/ecbuild_add_persistent.cmake
index 96c160d..42bb44b 100644
--- a/cmake/ecbuild_add_persistent.cmake
+++ b/cmake/ecbuild_add_persistent.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-#
+# (C) Copyright 1996-2016 ECMWF.
+#
# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
@@ -34,7 +34,7 @@
# C++ namespace to place the persistent class information in
#
##############################################################################
-
+
# define the script to build the persistent class information
set( sg_perl "${CMAKE_CURRENT_LIST_DIR}/sg.pl" CACHE INTERNAL "perl script to generate persistent objects" )
@@ -44,20 +44,20 @@ macro( ecbuild_add_persistent )
set( options )
set( single_value_args SRC_LIST NAMESPACE )
- set( multi_value_args FILES )
+ set( multi_value_args FILES )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_add_persistent(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_add_persistent(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_SRC_LIST )
- message(FATAL_ERROR "The call to ecbuild_add_persistent() doesn't specify the SRC_LIST.")
+ ecbuild_critical("The call to ecbuild_add_persistent() doesn't specify the SRC_LIST.")
endif()
if( NOT _PAR_FILES )
- message(FATAL_ERROR "The call to ecbuild_add_persistent() doesn't specify the FILES.")
+ ecbuild_critical("The call to ecbuild_add_persistent() doesn't specify the FILES.")
endif()
foreach( file ${_PAR_FILES} )
@@ -71,7 +71,7 @@ macro( ecbuild_add_persistent )
set( file ${_file_dir}/${_file_we} )
endif()
- # debug_var(file)
+ # ecbuild_debug_var(file)
add_custom_command( OUTPUT ${file}.b
COMMAND ${PERL_EXECUTABLE} ${sg_perl} ${CMAKE_CURRENT_SOURCE_DIR}/${file}.h
diff --git a/cmake/ecbuild_add_resources.cmake b/cmake/ecbuild_add_resources.cmake
index da6e55a..cf0543b 100644
--- a/cmake/ecbuild_add_resources.cmake
+++ b/cmake/ecbuild_add_resources.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -62,11 +62,11 @@ macro( ecbuild_add_resources )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_add_resources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_add_resources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_TARGET )
- message(FATAL_ERROR "The call to ecbuild_add_resources() doesn't specify the TARGET.")
+ ecbuild_critical("The call to ecbuild_add_resources() doesn't specify the TARGET.")
endif()
set( LOCAL_FILES_NOT_TO_PACK "" )
diff --git a/cmake/ecbuild_add_test.cmake b/cmake/ecbuild_add_test.cmake
index 6ae839a..2097683 100644
--- a/cmake/ecbuild_add_test.cmake
+++ b/cmake/ecbuild_add_test.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -16,13 +16,15 @@
#
# ecbuild_add_test( [ TARGET <name> ]
# [ SOURCES <source1> [<source2> ...] ]
+# [ OBJECTS <obj1> [<obj2> ...] ]
# [ COMMAND <executable> ]
# [ TYPE EXE|SCRIPT|PYTHON ]
# [ ARGS <argument1> [<argument2> ...] ]
# [ RESOURCES <file1> [<file2> ...] ]
# [ TEST_DATA <file1> [<file2> ...] ]
# [ BOOST ]
-# [ MPI <number-of-ranks> ]
+# [ MPI <number-of-mpi-tasks> ]
+# [ OMP <number-of-threads-per-mpi-task> ]
# [ ENABLED ON|OFF ]
# [ LIBS <library1> [<library2> ...] ]
# [ INCLUDES <path1> [<path2> ...] ]
@@ -48,6 +50,9 @@
# SOURCES : required if TARGET is provided
# list of source files to be compiled
#
+# OBJECTS : optional
+# list of object libraries to add to this target
+#
# COMMAND : either TARGET or COMMAND must be provided, unless TYPE is PYTHON
# command or script to execute (no executable is built)
#
@@ -75,6 +80,12 @@
#
# If greater than 1, and MPI is not available, the test is disabled.
#
+# OMP : optional
+# number of OpenMP threads per MPI task to use.
+#
+# If set, the environment variable OMP_NUM_THREADS will set.
+# Also, in case of launchers like aprun, the OMP_NUMTHREADS_FLAG will be used.
+#
# ENABLED : optional
# if set to OFF, the test is built but not enabled as a test case
#
@@ -126,31 +137,39 @@
macro( ecbuild_add_test )
set( options BOOST )
- set( single_value_args TARGET ENABLED COMMAND TYPE LINKER_LANGUAGE MPI WORKING_DIRECTORY )
- set( multi_value_args SOURCES LIBS INCLUDES TEST_DEPENDS DEPENDS ARGS
+ set( single_value_args TARGET ENABLED COMMAND TYPE LINKER_LANGUAGE MPI OMP WORKING_DIRECTORY )
+ set( multi_value_args SOURCES OBJECTS LIBS INCLUDES TEST_DEPENDS DEPENDS ARGS
PERSISTENT DEFINITIONS RESOURCES TEST_DATA CFLAGS
CXXFLAGS FFLAGS GENERATED CONDITION ENVIRONMENT )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_add_test(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_add_test(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
set( _TEST_DIR ${CMAKE_CURRENT_BINARY_DIR} )
# Check for MPI
if(_PAR_MPI)
- if( (_PAR_MPI GREATER 1) AND ( (NOT HAVE_MPI) OR (NOT MPIEXEC) ) )
+ if( (_PAR_MPI GREATER 1) AND ( (NOT MPI_FOUND) OR (NOT MPIEXEC) ) )
ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): ${_PAR_MPI} MPI ranks requested but MPI not available - disabling test")
set( _PAR_ENABLED 0 )
- endif()
- if( (_PAR_MPI EQUAL 1) AND (NOT HAVE_MPI) )
+ elseif( (_PAR_MPI EQUAL 1) AND (NOT MPI_FOUND) )
ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): 1 MPI rank requested but MPI not available - disabling MPI")
set( _PAR_MPI 0 )
+ else()
+ ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): Running using ${_PAR_MPI} MPI rank(s)")
endif()
endif()
+ # Check for OMP
+ if( NOT DEFINED _PAR_OMP )
+ set( _PAR_OMP 1 )
+ endif()
+ list( APPEND _PAR_ENVIRONMENT "OMP_NUM_THREADS=${_PAR_OMP}" )
+
+
# default is enabled
if( NOT DEFINED _PAR_ENABLED )
set( _PAR_ENABLED 1 )
@@ -168,7 +187,7 @@ macro( ecbuild_add_test )
if( NOT _PAR_TYPE AND DEFINED _PAR_TARGET )
set( _PAR_TYPE "EXE" )
if( NOT _PAR_SOURCES )
- message(FATAL_ERROR "The call to ecbuild_add_test() defines a TARGET without SOURCES.")
+ ecbuild_critical("The call to ecbuild_add_test() defines a TARGET without SOURCES.")
endif()
endif()
@@ -176,7 +195,7 @@ macro( ecbuild_add_test )
if( PYTHONINTERP_FOUND )
set( _PAR_COMMAND ${PYTHON_EXECUTABLE} )
else()
- message( WARNING "Requested a python test but python interpreter not found - disabling test\nPYTHON_EXECUTABLE: [${PYTHON_EXECUTABLE}]" )
+ ecbuild_warn( "Requested a python test but python interpreter not found - disabling test\nPYTHON_EXECUTABLE: [${PYTHON_EXECUTABLE}]" )
set( _PAR_ENABLED 0 )
endif()
endif()
@@ -184,15 +203,15 @@ macro( ecbuild_add_test )
### further checks
if( _PAR_ENABLED AND NOT _PAR_TARGET AND NOT _PAR_COMMAND )
- message(FATAL_ERROR "The call to ecbuild_add_test() defines neither a TARGET nor a COMMAND.")
+ ecbuild_critical("The call to ecbuild_add_test() defines neither a TARGET nor a COMMAND.")
endif()
if( _PAR_ENABLED AND NOT _PAR_COMMAND AND NOT _PAR_SOURCES )
- message(FATAL_ERROR "The call to ecbuild_add_test() defines neither a COMMAND nor SOURCES, so no test can be defined or built.")
+ ecbuild_critical("The call to ecbuild_add_test() defines neither a COMMAND nor SOURCES, so no test can be defined or built.")
endif()
if( _PAR_TYPE MATCHES "SCRIPT" AND NOT _PAR_COMMAND )
- message(FATAL_ERROR "The call to ecbuild_add_test() defines a 'script' but doesn't specify the COMMAND.")
+ ecbuild_critical("The call to ecbuild_add_test() defines a 'script' but doesn't specify the COMMAND.")
endif()
### conditional build
@@ -266,9 +285,13 @@ macro( ecbuild_add_test )
endif()
endif()
- # add the test target
+ # insert already compiled objects (from OBJECT libraries)
+ unset( _all_objects )
+ foreach( _obj ${_PAR_OBJECTS} )
+ list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
+ endforeach()
- add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} )
+ add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} ${_all_objects} )
# add extra dependencies
if( DEFINED _PAR_DEPENDS)
@@ -354,9 +377,6 @@ macro( ecbuild_add_test )
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E remove ${EXE_FILENAME} )
- set_property( TARGET ${_PAR_TARGET} PROPERTY SKIP_BUILD_RPATH FALSE )
- set_property( TARGET ${_PAR_TARGET} PROPERTY BUILD_WITH_INSTALL_RPATH FALSE )
-
endif() # _PAR_SOURCES
if( DEFINED _PAR_COMMAND AND NOT _PAR_TARGET ) # in the absence of target, we use the command as a name
@@ -376,18 +396,29 @@ macro( ecbuild_add_test )
# define the arguments
set( TEST_ARGS "" )
- if( DEFINED _PAR_ARGS )
+ # Boost Unit Test >= 1.60 requires arguments to be passed to the application to be separated by --
+ if( DEFINED _PAR_ARGS AND _PAR_BOOST )
+ list( APPEND TEST_ARGS "--" ${_PAR_ARGS} )
+ elseif( DEFINED _PAR_ARGS )
list( APPEND TEST_ARGS ${_PAR_ARGS} )
endif()
# Wrap with MPIEXEC
if( _PAR_MPI )
+
+ set( MPIEXEC_TASKS ${MPIEXEC_NUMPROC_FLAG} ${_PAR_MPI} )
+ if( DEFINED MPIEXEC_NUMTHREAD_FLAG )
+ set( MPIEXEC_THREADS ${MPIEXEC_NUMTHREAD_FLAG} ${_PAR_OMP} )
+ endif()
+
+ set( _LAUNCH ${MPIEXEC} ${MPIEXEC_TASKS} ${MPIEXEC_THREADS} )
+
if( DEFINED _PAR_COMMAND )
- ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): running as ${MPIEXEC} -n ${_PAR_MPI} ${_TEST_DIR}/${_PAR_COMMAND}")
- set( _PAR_COMMAND ${MPIEXEC} -n ${_PAR_MPI} ${_TEST_DIR}/${_PAR_COMMAND} )
+ ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): running as ${_LAUNCH} ${_PAR_COMMAND}")
+ set( _PAR_COMMAND ${_LAUNCH} ${_PAR_COMMAND} )
else()
- ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): running as ${MPIEXEC} -n ${_PAR_MPI} ${_TEST_DIR}/${_PAR_TARGET}")
- set( _PAR_COMMAND ${MPIEXEC} -n ${_PAR_MPI} ${_TEST_DIR}/${_PAR_TARGET} )
+ ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): running as ${_LAUNCH} ${_TEST_DIR}/${_PAR_TARGET}")
+ set( _PAR_COMMAND ${_LAUNCH} ${_TEST_DIR}/${_PAR_TARGET} )
endif()
endif()
@@ -396,9 +427,9 @@ macro( ecbuild_add_test )
if( _PAR_ENABLED ) # we can disable and still build it but not run it with 'make tests'
if( DEFINED _PAR_COMMAND )
- add_test( ${_PAR_TARGET} ${_PAR_COMMAND} ${TEST_ARGS} ${_working_dir} ) # run a command as test
+ add_test( NAME ${_PAR_TARGET} COMMAND ${_PAR_COMMAND} ${TEST_ARGS} ${_working_dir} ) # run a command as test
else()
- add_test( ${_PAR_TARGET} ${_PAR_TARGET} ${TEST_ARGS} ${_working_dir} ) # run the test that was generated
+ add_test( NAME ${_PAR_TARGET} COMMAND ${_PAR_TARGET} ${TEST_ARGS} ${_working_dir} ) # run the test that was generated
endif()
# get test data
diff --git a/cmake/ecbuild_append_to_rpath.cmake b/cmake/ecbuild_append_to_rpath.cmake
index 5a7bd66..9ecde3e 100644
--- a/cmake/ecbuild_append_to_rpath.cmake
+++ b/cmake/ecbuild_append_to_rpath.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -39,7 +39,7 @@ endfunction()
macro( ecbuild_append_to_rpath RPATH_DIRS )
if( NOT ${ARGC} EQUAL 1 )
- message( SEND_ERROR "ecbuild_append_to_rpath takes 1 argument")
+ ecbuild_error( "ecbuild_append_to_rpath takes 1 argument")
endif()
foreach( RPATH_DIR ${RPATH_DIRS} )
diff --git a/cmake/ecbuild_bundle.cmake b/cmake/ecbuild_bundle.cmake
index 2d9b779..83b0bba 100644
--- a/cmake/ecbuild_bundle.cmake
+++ b/cmake/ecbuild_bundle.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -9,10 +9,6 @@
# Set policies
include( ecbuild_policies NO_POLICY_SCOPE )
-macro( debug_here VAR )
- message( STATUS " >>>>> ${VAR} [${${VAR}}]")
-endmacro()
-
include(CMakeParseArguments)
include(ecbuild_git)
@@ -61,7 +57,7 @@ endmacro()
# Declare a subproject to be built as part of this bundle. ::
#
# ecbuild_bundle( PROJECT <name>
-# STASH <repository> | GIT <giturl>
+# STASH <repository> | GIT <giturl> | SOURCE <path>
# [ BRANCH <gitbranch> | TAG <gittag> ]
# [ UPDATE | NOREMOTE ] )
# [ MANUAL ] )
@@ -72,12 +68,15 @@ endmacro()
# PROJECT : required
# project name for the Git repository to be managed
#
-# STASH : cannot be combined with GIT, either is required
+# STASH : cannot be combined with GIT or SOURCE
# Stash repository in the form <project>/<repository>
#
-# URL : cannot be combined with STASH, either is required
+# GIT : cannot be combined with STASH or SOURCE
# Git URL of the remote repository to clone (see ``git help clone``)
#
+# SOURCE : cannot be combined with STASH or GIT
+# Path to an existing local repository, which will be symlinked
+#
# BRANCH : optional, cannot be combined with TAG
# Git branch to check out
#
@@ -104,6 +103,10 @@ endmacro()
# The first time a bundle is built, the sources of all subprojects are cloned
# into directories named according to project in the *source* tree of the
# bundle (which means these directories should be added to ``.gitignore``).
+# If the ``SOURCE`` option is used it must point to an existing local
+# repository on disk and no new repository is cloned. Be aware that using the
+# ``BRANCH`` or ``TAG`` option leads to the corresponding version being checked
+# out in that repository!
#
# Subprojects are configured and built in order. Due to being added as a
# subproject, the usual project discovery mechanism (i.e. locating and
@@ -119,23 +122,32 @@ endmacro()
macro( ecbuild_bundle )
set( options )
- set( single_value_args PROJECT STASH GIT )
+ set( single_value_args PROJECT STASH GIT SOURCE )
set( multi_value_args )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
string(TOUPPER "${_PAR_PROJECT}" PNAME)
if( BUNDLE_SKIP_${PNAME} )
- message( STATUS "Skipping bundle project ${PNAME}" )
+ ecbuild_info( "Skipping bundle project ${PNAME}" )
else()
- if( _PAR_STASH )
- ecmwf_stash( PROJECT ${_PAR_PROJECT} DIR ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} STASH ${_PAR_STASH} ${_PAR_UNPARSED_ARGUMENTS} )
- elseif( _PAR_GIT )
- ecbuild_git( PROJECT ${_PAR_PROJECT} DIR ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} URL ${_PAR_GIT} ${_PAR_UNPARSED_ARGUMENTS} )
+ if( _PAR_STASH )
+ ecmwf_stash( PROJECT ${_PAR_PROJECT} DIR ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} STASH ${_PAR_STASH} ${_PAR_UNPARSED_ARGUMENTS} )
+ elseif( _PAR_GIT )
+ ecbuild_git( PROJECT ${_PAR_PROJECT} DIR ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} URL ${_PAR_GIT} ${_PAR_UNPARSED_ARGUMENTS} )
+ elseif( _PAR_SOURCE )
+ if( DEFINED ${PNAME}_SOURCE )
+ ecbuild_critical( "ecbuild_bundle called with SOURCE for project ${_PAR_PROJECT} but ${PNAME}_SOURCE is defined" )
endif()
+ execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ${_PAR_SOURCE} ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} )
+ endif()
+
+ if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_PAR_PROJECT} OR NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_PAR_PROJECT}/CMakeLists.txt )
+ ecbuild_critical("Source directory '${CMAKE_CURRENT_SOURCE_DIR}/${_PAR_PROJECT}' for subproject '${_PAR_PROJECT}' does not exist or does not contain a CMakeLists.txt file.")
+ endif()
- ecbuild_use_package( PROJECT ${_PAR_PROJECT} )
+ ecbuild_use_package( PROJECT ${_PAR_PROJECT} )
endif()
endmacro()
diff --git a/cmake/ecbuild_cache.cmake b/cmake/ecbuild_cache.cmake
index 9663bca..e257b36 100644
--- a/cmake/ecbuild_cache.cmake
+++ b/cmake/ecbuild_cache.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/ecbuild_check_c_source_return.cmake b/cmake/ecbuild_check_c_source_return.cmake
index 1dadca6..18b6117 100644
--- a/cmake/ecbuild_check_c_source_return.cmake
+++ b/cmake/ecbuild_check_c_source_return.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -59,11 +59,11 @@ macro( ecbuild_check_c_source_return SOURCE )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_check_c_source_return(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_check_c_source_return(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_VAR OR NOT _PAR_OUTPUT )
- message(FATAL_ERROR "The call to ecbuild_check_c_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
+ ecbuild_critical("The call to ecbuild_check_c_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
endif()
@@ -97,7 +97,7 @@ macro( ecbuild_check_c_source_return SOURCE )
file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_PAR_VAR}.c" "${SOURCE}\n" )
- message( STATUS "Performing Test ${_PAR_VAR}" )
+ ecbuild_debug( "Performing Test ${_PAR_VAR}" )
try_run( ${_PAR_VAR}_EXITCODE ${_PAR_VAR}_COMPILED
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_PAR_VAR}.c
@@ -117,7 +117,7 @@ macro( ecbuild_check_c_source_return SOURCE )
# if the return value was 0 then it worked
if("${${_PAR_VAR}_EXITCODE}" EQUAL 0)
- message(STATUS "Performing Test ${_PAR_VAR} - Success")
+ ecbuild_debug("Performing Test ${_PAR_VAR} - Success")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C SOURCE FILE Test ${_PAR_VAR} succeded with the following compile output:\n"
"${compile_OUTPUT}\n"
@@ -139,7 +139,7 @@ macro( ecbuild_check_c_source_return SOURCE )
set(${_PAR_OUTPUT} "" CACHE INTERNAL "Test ${_PAR_VAR} output")
endif()
- message(STATUS "Performing Test ${_PAR_VAR} - Failed")
+ ecbuild_debug("Performing Test ${_PAR_VAR} - Failed")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${_PAR_VAR} failed with the following compile output:\n"
"${compile_OUTPUT}\n"
diff --git a/cmake/ecbuild_check_compiler.cmake b/cmake/ecbuild_check_compiler.cmake
index 32ff6cc..437b81e 100644
--- a/cmake/ecbuild_check_compiler.cmake
+++ b/cmake/ecbuild_check_compiler.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -10,7 +10,8 @@
# enable C to use in system introspection
if( NOT CMAKE_C_COMPILER_LOADED AND ENABLE_OS_TESTS )
- enable_language( C )
+ enable_language( C )
+ ecbuild_compiler_flags( C )
endif()
############################################################################################
@@ -122,6 +123,10 @@ if( CMAKE_COMPILER_IS_GNUCXX )
endif()
+if( ENABLE_WARNINGS AND CMAKE_Fortran_COMPILER_ID MATCHES "Intel" )
+ ecbuild_add_fortran_flags("-warn all")
+endif()
+
############################################################################################
# compiler dependent fixes
diff --git a/cmake/ecbuild_check_cxx11.cmake b/cmake/ecbuild_check_cxx11.cmake
index 6453786..390462b 100644
--- a/cmake/ecbuild_check_cxx11.cmake
+++ b/cmake/ecbuild_check_cxx11.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -45,7 +45,7 @@ function( ecbuild_check_cxx11 )
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_check_cxx11(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_check_cxx11(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
include( ${ECBUILD_MACROS_DIR}/contrib/GreatCMakeCookOff/CheckCXX11Features.cmake )
@@ -86,7 +86,6 @@ function( ecbuild_check_cxx11 )
endif()
foreach( f ${CXX11_CHECKED_FEATURES} )
- # message( "HAS_CXX11_${FEAT}" )
string( TOUPPER ${f} FEAT )
if( HAS_CXX11_${FEAT} )
list( APPEND CXX11_SUPPORTED_FEATURES ${f} )
@@ -112,21 +111,21 @@ function( ecbuild_check_cxx11 )
if( _p_PRINT )
if( CXX11_CHECKED_FEATURES )
join( CXX11_CHECKED_FEATURES " " CXX11_CHECKED_FEATURES_STR )
- message( STATUS "Checked C++11 features: ${CXX11_CHECKED_FEATURES_STR}" )
+ ecbuild_info( "Checked C++11 features: ${CXX11_CHECKED_FEATURES_STR}" )
else()
- message( STATUS "Checked no C++11 features" )
+ ecbuild_info( "Checked no C++11 features" )
endif()
if( CXX11_SUPPORTED_FEATURES )
join( CXX11_SUPPORTED_FEATURES " " CXX11_SUPPORTED_FEATURES_STR )
- message( STATUS "Found C++11 features: ${CXX11_SUPPORTED_FEATURES_STR}" )
+ ecbuild_info( "Found C++11 features: ${CXX11_SUPPORTED_FEATURES_STR}" )
else()
- message( STATUS "Found no C++11 features" )
+ ecbuild_info( "Found no C++11 features" )
endif()
if( CXX11_NOT_SUPPORTED_FEATURES )
join( CXX11_NOT_SUPPORTED_FEATURES " " CXX11_NOT_SUPPORTED_FEATURES_STR )
- message( STATUS "Not found C++11 features: ${CXX11_NOT_SUPPORTED_FEATURES_STR}" )
+ ecbuild_info( "Not found C++11 features: ${CXX11_NOT_SUPPORTED_FEATURES_STR}" )
else()
- message( STATUS "Found all checked C++11 features" )
+ ecbuild_info( "Found all checked C++11 features" )
endif()
endif()
diff --git a/cmake/ecbuild_check_cxx_source_return.cmake b/cmake/ecbuild_check_cxx_source_return.cmake
index e364918..0868b22 100644
--- a/cmake/ecbuild_check_cxx_source_return.cmake
+++ b/cmake/ecbuild_check_cxx_source_return.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-#
+# (C) Copyright 1996-2016 ECMWF.
+#
# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
@@ -59,11 +59,11 @@ macro( ecbuild_check_cxx_source_return SOURCE )
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_p_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_check_cxx_source_return(): \"${_p_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_check_cxx_source_return(): \"${_p_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _p_VAR OR NOT _p_OUTPUT )
- message(FATAL_ERROR "The call to ecbuild_check_cxx_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
+ ecbuild_critical("The call to ecbuild_check_cxx_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
endif()
set( _msg "Testing ${_p_VAR}:" )
@@ -93,12 +93,12 @@ macro( ecbuild_check_cxx_source_return SOURCE )
if( __add_incs )
set(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${__add_incs}")
endif()
-
+
# write the source file
-
+
file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_p_VAR}.cxx" "${SOURCE}\n" )
- message( STATUS "${_msg}" )
+ ecbuild_debug( "${_msg}" )
try_run( ${_p_VAR}_EXITCODE ${_p_VAR}_COMPILED
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_p_VAR}.cxx
@@ -107,39 +107,39 @@ macro( ecbuild_check_cxx_source_return SOURCE )
-DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
"${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}"
"${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
- COMPILE_OUTPUT_VARIABLE compile_OUTPUT
+ COMPILE_OUTPUT_VARIABLE compile_OUTPUT
RUN_OUTPUT_VARIABLE run_OUTPUT )
-
- # debug_var( ${_p_VAR}_COMPILED )
- # debug_var( ${_p_VAR}_EXITCODE )
+
+ # ecbuild_debug_var( ${_p_VAR}_COMPILED )
+ # ecbuild_debug_var( ${_p_VAR}_EXITCODE )
# if it did not compile make the return value fail code of 1
if( NOT ${_p_VAR}_COMPILED )
- message( STATUS "${_msg} failed to compile" )
+ ecbuild_debug( "${_msg} failed to compile" )
endif()
if( "${${_p_VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN" )
- message( STATUS "${_msg} failed to run" )
+ ecbuild_debug( "${_msg} failed to run" )
endif()
# if the return value was 0 then it worked
if( ${_p_VAR}_COMPILED AND "${${_p_VAR}_EXITCODE}" EQUAL 0 )
-
- message(STATUS "${_msg} Success")
- file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+
+ ecbuild_debug("${_msg} Success")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C++ SOURCE FILE Test ${_p_VAR} succeded with the following compile output:\n"
- "${compile_OUTPUT}\n"
+ "${compile_OUTPUT}\n"
"Performing C++ SOURCE FILE Run ${_p_VAR} succeded with the following run output:\n"
- "${run_OUTPUT}\n"
+ "${run_OUTPUT}\n"
"Return value: ${${_p_VAR}}\n"
"Source file was:\n${SOURCE}\n")
set( ${_p_VAR} 1 CACHE INTERNAL "Test ${_p_VAR}")
set( ${_p_OUTPUT} "${run_OUTPUT}" CACHE INTERNAL "Test ${_p_VAR} output")
-
+
else()
-
+
if(CMAKE_CROSSCOMPILING AND "${${_p_VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
set(${_p_VAR} "${${_p_VAR}_EXITCODE}")
set(${OUTPUT} "")
@@ -147,17 +147,17 @@ macro( ecbuild_check_cxx_source_return SOURCE )
set(${_p_VAR} "" CACHE INTERNAL "Test ${_p_VAR}")
set(${_p_OUTPUT} "" CACHE INTERNAL "Test ${_p_VAR} output")
endif()
-
- message(STATUS "Test ${_p_VAR} - Failed")
- file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+
+ ecbuild_debug("Test ${_p_VAR} - Failed")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C++ SOURCE FILE Test ${_p_VAR} failed with the following compile output:\n"
- "${compile_OUTPUT}\n"
+ "${compile_OUTPUT}\n"
"Performing C++ SOURCE FILE Run ${_p_VAR} failed with the following run output:\n"
- "${run_OUTPUT}\n"
+ "${run_OUTPUT}\n"
"Return value: ${${_p_VAR}_EXITCODE}\n"
"Source file was:\n${SOURCE}\n")
endif()
-
+
endif()
endmacro()
diff --git a/cmake/ecbuild_check_fortran_source_return.cmake b/cmake/ecbuild_check_fortran_source_return.cmake
index 1c50896..6b007df 100644
--- a/cmake/ecbuild_check_fortran_source_return.cmake
+++ b/cmake/ecbuild_check_fortran_source_return.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -52,7 +52,7 @@
macro( ecbuild_check_fortran_source_return SOURCE )
- message( WARNING "This macro ecbuild_check_fortran_source has never been tested" )
+ ecbuild_warn( "This macro ecbuild_check_fortran_source has never been tested" )
set( options )
set( single_value_args VAR OUTPUT )
set( multi_value_args INCLUDES LIBS DEFINITIONS )
@@ -60,11 +60,11 @@ macro( ecbuild_check_fortran_source_return SOURCE )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_check_fortran_source_return(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_check_fortran_source_return(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_VAR OR NOT _PAR_OUTPUT )
- message(FATAL_ERROR "The call to ecbuild_check_fortran_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
+ ecbuild_critical("The call to ecbuild_check_fortran_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
endif()
@@ -98,7 +98,7 @@ macro( ecbuild_check_fortran_source_return SOURCE )
file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_PAR_VAR}.f" "${SOURCE}\n" )
- message( STATUS "Performing Test ${_PAR_VAR}" )
+ ecbuild_debug( "Performing Test ${_PAR_VAR}" )
try_run( ${_PAR_VAR}_EXITCODE ${_PAR_VAR}_COMPILED
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_PAR_VAR}.f
@@ -118,7 +118,7 @@ macro( ecbuild_check_fortran_source_return SOURCE )
# if the return value was 0 then it worked
if("${${_PAR_VAR}_EXITCODE}" EQUAL 0)
- message(STATUS "Performing Test ${_PAR_VAR} - Success")
+ ecbuild_debug("Performing Test ${_PAR_VAR} - Success")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing Fortran SOURCE FILE Test ${_PAR_VAR} succeded with the following compile output:\n"
"${compile_OUTPUT}\n"
@@ -140,7 +140,7 @@ macro( ecbuild_check_fortran_source_return SOURCE )
set(${_PAR_OUTPUT} "" CACHE INTERNAL "Test ${_PAR_VAR} output")
endif()
- message(STATUS "Performing Test ${_PAR_VAR} - Failed")
+ ecbuild_debug("Performing Test ${_PAR_VAR} - Failed")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${_PAR_VAR} failed with the following compile output:\n"
"${compile_OUTPUT}\n"
diff --git a/cmake/ecbuild_check_functions.cmake b/cmake/ecbuild_check_functions.cmake
index a3ed7a1..7b850e9 100644
--- a/cmake/ecbuild_check_functions.cmake
+++ b/cmake/ecbuild_check_functions.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
@@ -73,10 +73,10 @@ if( ENABLE_OS_FUNCTIONS_TEST )
ecbuild_cache_check_c_source_compiles( "#define _LARGEFILE64_SOURCE\n#include <sys/stat.h>\nint main(){ struct stat64 s; fstat64(1,&s); return 0; }" EC_HAVE_FSTAT64 )
# test fseeko64
ecbuild_cache_check_c_source_compiles( "#define _LARGEFILE64_SOURCE\n#include <stdio.h>\n#include <sys/types.h>\nint main(){FILE* file;off64_t l=0;fseeko64(file,l,SEEK_CUR);return 0;}\n" EC_HAVE_FSEEKO64 )
-
+
# test for ftello64
ecbuild_cache_check_c_source_compiles( "#define _LARGEFILE64_SOURCE\n#include <stdio.h>\n#include <sys/types.h>\nint main(){FILE* file;off64_t l = ftello64(file);return 0;}\n" EC_HAVE_FTELLO64 )
-
+
# test for lseek64
ecbuild_cache_check_c_source_compiles( "#define _LARGEFILE64_SOURCE\n#include <sys/types.h>\n#include <unistd.h>\nint main(){off64_t h = lseek64(0,0,SEEK_SET);return 0;}\n" EC_HAVE_LSEEK64 )
# test for open64
@@ -114,7 +114,7 @@ if( ENABLE_OS_FUNCTIONS_TEST )
# test for getpwuid_r
ecbuild_cache_check_c_source_compiles( "#include <unistd.h>\n#include <sys/types.h>\n#include <pwd.h>\nint main(){ char buf[4096]; struct passwd pwbuf; struct passwd *pwbufp = 0; getpwuid_r(getuid(), &pwbuf, buf, sizeof(buf), &pwbufp); }\n" EC_HAVE_GETPWUID_R )
# test for getpwnam_r
- ecbuild_cache_check_c_source_compiles( "#include <sys/types.h>\n#include <pwd.h>\nint main(){ struct passwd p; char line[1024]; int n = getpwnam_r(\"user\",&p,line,sizeof(line),0); }\n" EC_HAVE_GETPWNAM_R )
+ ecbuild_cache_check_c_source_compiles( "#include <sys/types.h>\n#include <pwd.h>\nint main(){ struct passwd p; char line[1024]; int n = getpwnam_r(\"user\",&p,line,sizeof(line),0); }\n" EC_HAVE_GETPWNAM_R )
# test for readdir_r
ecbuild_cache_check_c_source_compiles( "#include <dirent.h>\nint main(){ DIR *dirp; struct dirent *entry; struct dirent **result; int i = readdir_r(dirp, entry, result); }\n" EC_HAVE_READDIR_R )
# test for gethostbyname_r
@@ -164,8 +164,8 @@ if( ENABLE_OS_FUNCTIONS_TEST )
endif()
ecbuild_cache_var( EC_HAVE_PROCFS )
-# debug_var(EC_HAVE_PROCFS)
-# debug_var(EC_HAVE_PROCFS_OUTPUT)
+# ecbuild_debug_var(EC_HAVE_PROCFS)
+# ecbuild_debug_var(EC_HAVE_PROCFS_OUTPUT)
endif()
diff --git a/cmake/ecbuild_check_os.cmake b/cmake/ecbuild_check_os.cmake
index 942fb6b..7bbb344 100644
--- a/cmake/ecbuild_check_os.cmake
+++ b/cmake/ecbuild_check_os.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -9,23 +9,34 @@
############################################################################################
# check size of pointer
+# Re-check size of void pointer since for some compiler combinations this is not properly set
ecbuild_cache_check_type_size( "void*" CMAKE_SIZEOF_VOID_P )
+if( NOT CMAKE_C_COMPILER_LOADED AND ENABLE_OS_TESTS )
+
+ enable_language( C )
+ ecbuild_compiler_flags( C )
+
+endif()
+
math( EXPR EC_OS_BITS "${CMAKE_SIZEOF_VOID_P} * 8" )
# we only support 32 and 64 bit operating systems
if( NOT EC_OS_BITS EQUAL "32" AND NOT EC_OS_BITS EQUAL "64" )
- message( FATAL_ERROR "operating system ${CMAKE_SYSTEM} ${EC_OS_BITS} bits -- ecbuild only supports 32 or 64 bit OS's" )
+ ecbuild_critical( "operating system ${CMAKE_SYSTEM} ${EC_OS_BITS} bits -- ecbuild only supports 32 or 64 bit OS's" )
endif()
-ecbuild_cache_var( EC_OS_BITS )
############################################################################################
# For 64 bit architectures enable PIC (position-independent code)
-if( ${EC_OS_BITS} EQUAL 64 )
- set( CMAKE_POSITION_INDEPENDENT_CODE ON )
+# Allow overriding the position independent code setting (ECBUILD-220)
+if( DEFINED ECBUILD_POSITION_INDEPENDENT_CODE )
+ set( CMAKE_POSITION_INDEPENDENT_CODE ${ECBUILD_POSITION_INDEPENDENT_CODE} )
+elseif( ${EC_OS_BITS} EQUAL 64 )
+ set( CMAKE_POSITION_INDEPENDENT_CODE ON )
endif()
+
############################################################################################
# check architecture
@@ -45,21 +56,21 @@ if( ENABLE_OS_TYPES_TEST )
ecbuild_cache_check_type_size( ssize_t EC_SIZEOF_SSIZE_T )
ecbuild_cache_check_type_size( off_t EC_SIZEOF_OFF_T )
-# message( STATUS "sizeof void* [${EC_SIZEOF_PTR}]" )
-# message( STATUS "sizeof off_t [${EC_SIZEOF_OFF_T}]" )
-# message( STATUS "sizeof int [${EC_SIZEOF_INT}]" )
-# message( STATUS "sizeof short [${EC_SIZEOF_SHORT}]" )
-# message( STATUS "sizeof long [${EC_SIZEOF_LONG}]" )
-# message( STATUS "sizeof size_t [${EC_SIZEOF_SIZE_T}]" )
-# message( STATUS "sizeof float [${EC_SIZEOF_FLOAT}]" )
-# message( STATUS "sizeof double [${EC_SIZEOF_DOUBLE}]" )
-# message( STATUS "sizeof long long [${EC_SIZEOF_LONG_LONG}]" )
-# message( STATUS "sizeof long double [${EC_SIZEOF_LONG_DOUBLE}]" )
-
-# message( STATUS "system sizeof :" )
-# message( STATUS " void* [${EC_SIZEOF_PTR}] size_t [${EC_SIZEOF_SIZE_T}] off_t [${EC_SIZEOF_OFF_T}] short [${EC_SIZEOF_SHORT}]" )
-# message( STATUS " int [${EC_SIZEOF_INT}] long [${EC_SIZEOF_LONG}] long long [${EC_SIZEOF_LONG_LONG}]" )
-# message( STATUS " float [${EC_SIZEOF_FLOAT}] double [${EC_SIZEOF_DOUBLE}] long double [${EC_SIZEOF_LONG_DOUBLE}]" )
+# ecbuild_info( "sizeof void* [${EC_SIZEOF_PTR}]" )
+# ecbuild_info( "sizeof off_t [${EC_SIZEOF_OFF_T}]" )
+# ecbuild_info( "sizeof int [${EC_SIZEOF_INT}]" )
+# ecbuild_info( "sizeof short [${EC_SIZEOF_SHORT}]" )
+# ecbuild_info( "sizeof long [${EC_SIZEOF_LONG}]" )
+# ecbuild_info( "sizeof size_t [${EC_SIZEOF_SIZE_T}]" )
+# ecbuild_info( "sizeof float [${EC_SIZEOF_FLOAT}]" )
+# ecbuild_info( "sizeof double [${EC_SIZEOF_DOUBLE}]" )
+# ecbuild_info( "sizeof long long [${EC_SIZEOF_LONG_LONG}]" )
+# ecbuild_info( "sizeof long double [${EC_SIZEOF_LONG_DOUBLE}]" )
+
+# ecbuild_info( "system sizeof :" )
+# ecbuild_info( " void* [${EC_SIZEOF_PTR}] size_t [${EC_SIZEOF_SIZE_T}] off_t [${EC_SIZEOF_OFF_T}] short [${EC_SIZEOF_SHORT}]" )
+# ecbuild_info( " int [${EC_SIZEOF_INT}] long [${EC_SIZEOF_LONG}] long long [${EC_SIZEOF_LONG_LONG}]" )
+# ecbuild_info( " float [${EC_SIZEOF_FLOAT}] double [${EC_SIZEOF_DOUBLE}] long double [${EC_SIZEOF_LONG_DOUBLE}]" )
endif()
@@ -101,14 +112,19 @@ endif()
if( ENABLE_OS_ENDINESS_TEST )
if( NOT DEFINED EC_BIG_ENDIAN AND NOT DEFINED EC_LITTLE_ENDIAN )
+
test_big_endian( _BIG_ENDIAN )
if( _BIG_ENDIAN )
- set( EC_BIG_ENDIAN 1 )
+ set( EC_BIG_ENDIAN 1 )
+ set( EC_LITTLE_ENDIAN 0 )
else()
- set( EC_LITTLE_ENDIAN 1 )
+ set( EC_BIG_ENDIAN 0 )
+ set( EC_LITTLE_ENDIAN 1 )
endif()
+
endif()
+
ecbuild_cache_var( EC_BIG_ENDIAN )
ecbuild_cache_var( EC_LITTLE_ENDIAN )
@@ -142,9 +158,15 @@ if( ENABLE_OS_ENDINESS_TEST )
if( "${IEEE_BE}" STREQUAL "" )
set( IEEE_BE 0 CACHE INTERNAL "Test IEEE_BE")
endif()
+
endif()
+
ecbuild_cache_var( IEEE_BE )
+ if( EC_BIG_ENDIAN AND NOT IEEE_BE )
+ ecbuild_critical("Failed to sanity check on endiness: OS should be Big-Endian but compiled code runs differently -- to ignore this pass -DIEEE_BE=0 to CMake/ecBuild")
+ endif()
+
if( NOT DEFINED IEEE_LE )
check_c_source_runs(
"int compare(unsigned char* a,unsigned char* b) {
@@ -172,12 +194,17 @@ if( ENABLE_OS_ENDINESS_TEST )
return 0;
}" IEEE_LE )
- if( "${IEEE_BE}" STREQUAL "" )
+ if( "${IEEE_LE}" STREQUAL "" )
set( IEEE_LE 0 CACHE INTERNAL "Test IEEE_LE")
endif()
endif()
+
ecbuild_cache_var( IEEE_LE )
+ if( EC_LITTLE_ENDIAN AND NOT IEEE_LE )
+ ecbuild_critical("Failed to sanity check on endiness: OS should be Little-Endian but compiled code runs differently -- to ignore this pass -DIEEE_LE=0 to CMake/ecBuild")
+ endif()
+
endif()
############################################################################################
@@ -202,9 +229,9 @@ if( ENABLE_PROFILING )
unset( _trust_flags )
unset( _flags )
-
+
else()
- message( WARNING "Profiling enabled but ecbuild doesn't know how to enable for this particular compiler ${CMAKE_C_COMPILER_ID}")
+ ecbuild_warn( "Profiling enabled but ecbuild doesn't know how to enable for this particular compiler ${CMAKE_C_COMPILER_ID}")
endif()
endif()
@@ -350,7 +377,7 @@ endif()
if( ${CMAKE_SYSTEM_NAME} MATCHES "CYGWIN" )
set( EC_OS_NAME "cygwin" )
- message( WARNING "Building on Cygwin should work but is untested" )
+ ecbuild_warn( "Building on Cygwin should work but is untested" )
endif()
@@ -359,11 +386,11 @@ endif()
if( ${EC_OS_NAME} MATCHES "UNKNOWN" )
if( DISABLE_OS_CHECK )
- message( WARNING "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
- " -- DISABLE_OS_CHECK is ON so proceeding at your own risk ..." )
+ ecbuild_warn( "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
+ " -- DISABLE_OS_CHECK is ON so proceeding at your own risk ..." )
else()
- message( FATAL_ERROR "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
- " -- refusing to continue. Disable this check with -DDISABLE_OS_CHECK=ON" )
+ ecbuild_critical( "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
+ " -- refusing to continue. Disable this check with -DDISABLE_OS_CHECK=ON" )
endif()
endif()
diff --git a/cmake/ecbuild_compiler_flags.cmake b/cmake/ecbuild_compiler_flags.cmake
new file mode 100644
index 0000000..b97eb2c
--- /dev/null
+++ b/cmake/ecbuild_compiler_flags.cmake
@@ -0,0 +1,97 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_compiler_flags
+# ======================
+#
+# Set default compiler flags for a given language. ::
+#
+# ecbuild_compiler_flags( <lang> )
+#
+# The procedure is as follows:
+#
+# 1. ecBuild does *not* set ``CMAKE_<lang>_FLAGS`` i.e. the user can set these
+# via -D or the CMake cache and these will be the "base" flags.
+#
+# 2. ecBuild *overwrites* ``CMAKE_<lang>_FLAGS_<btype>`` in the CMake cache
+# for all build types with compiler specific defaults for the currently
+# loaded compiler i.e. any value set by the user via -D or the CMake cache
+# *has no effect*.
+#
+# 3. Any value the user provides via ``ECBUILD_<lang>_FLAGS`` or
+# ``ECBUILD_<lang>_FLAGS_<btype>`` *overrides* the corresponding
+# ``CMAKE_<lang>_FLAGS`` or ``CMAKE_<lang>_FLAGS_<btype>`` *without being
+# written to the CMake cache*.
+#
+##############################################################################
+
+macro( ecbuild_compiler_flags _lang )
+
+ if( CMAKE_${_lang}_COMPILER_LOADED )
+
+ ecbuild_debug( "try include ${ECBUILD_MACROS_DIR}/compiler_flags/${CMAKE_${_lang}_COMPILER_ID}_${_lang}.cmake ")
+
+ include( ${ECBUILD_MACROS_DIR}/compiler_flags/${CMAKE_${_lang}_COMPILER_ID}_${_lang}.cmake OPTIONAL )
+
+ ecbuild_debug_var( CMAKE_${_lang}_FLAGS )
+
+ foreach( _btype NONE DEBUG BIT PRODUCTION RELEASE RELWITHDEBINFO )
+ ecbuild_debug_var( CMAKE_${_lang}_FLAGS_${_btype} )
+ endforeach()
+
+ endif()
+
+ foreach( _btype NONE DEBUG BIT PRODUCTION RELEASE RELWITHDEBINFO )
+ if( DEFINED ECBUILD_${_lang}_FLAGS_${_btype} )
+ set( CMAKE_${_lang}_FLAGS_${_btype} ${ECBUILD_${_lang}_FLAGS_${_btype}} )
+ endif()
+ mark_as_advanced( CMAKE_${_lang}_FLAGS_${_btype} )
+ endforeach()
+
+ if( DEFINED ECBUILD_${_lang}_FLAGS )
+ set( CMAKE_${_lang}_FLAGS "${ECBUILD_${_lang}_FLAGS}" )
+ endif()
+
+ mark_as_advanced( CMAKE_${_lang}_FLAGS )
+
+ if( DEFINED ECBUILD_${_lang}_LINK_FLAGS )
+ set( CMAKE_${_lang}_LINK_FLAGS "${ECBUILD_${_lang}_LINK_FLAGS}" )
+ endif()
+
+ mark_as_advanced( CMAKE_${_lang}_LINK_FLAGS )
+
+endmacro()
+
+#-----------------------------------------------------------------------------------------------------------------------
+
+### OVERRIDE Compiler FLAGS (we override because CMake forcely defines them) -- see ecbuild_compiler_flags() macro
+
+foreach( _lang C CXX Fortran )
+ if( CMAKE_${_lang}_COMPILER_LOADED )
+ ecbuild_compiler_flags( ${_lang} )
+ endif()
+endforeach()
+
+### OVERRIDE Linker FLAGS per object type (we override because CMake forcely defines them)
+
+foreach( _btype NONE DEBUG BIT PRODUCTION RELEASE RELWITHDEBINFO )
+
+ foreach( _obj EXE SHARED MODULE )
+ if( ECBUILD_${_obj}_LINKER_FLAGS_${_btype} )
+ set( CMAKE_${_obj}_LINKER_FLAGS_${_btype} ${ECBUILD_${_obj}_LINKER_FLAGS_${_btype}} )
+ endif()
+ endforeach()
+
+endforeach()
+
+#-----------------------------------------------------------------------------------------------------------------------
+
+mark_as_advanced( CMAKE_C_FLAGS_BIT )
diff --git a/cmake/ecbuild_config.h.in b/cmake/ecbuild_config.h.in
index 2a01618..eef9b85 100644
--- a/cmake/ecbuild_config.h.in
+++ b/cmake/ecbuild_config.h.in
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 1996-2015 ECMWF.
+ * (C) Copyright 1996-2016 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/ecbuild_debug_var.cmake b/cmake/ecbuild_debug_var.cmake
deleted file mode 100644
index 9bb3499..0000000
--- a/cmake/ecbuild_debug_var.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
-# (C) Copyright 1996-2015 ECMWF.
-#
-# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
-# granted to it by virtue of its status as an intergovernmental organisation nor
-# does it submit to any jurisdiction.
-
-##############################################################################
-# macro for exporting a variable to parent scope
-
-macro( set_parent_scope VAR )
-
- set( ${VAR} ${${VAR}} PARENT_SCOPE )
-
-endmacro( set_parent_scope )
-
-##############################################################################
-# macro for debugging a cmake variable
-
-macro( debug_var VAR )
-
- message( STATUS "${VAR} [${${VAR}}]" )
-
-endmacro( debug_var )
-
-##############################################################################
-# macro for debugging a cmake list
-
-macro( debug_list VAR )
-
- message( STATUS "${VAR}:" )
- foreach( _elem ${${VAR}} )
- message( STATUS " ${_elem}" )
- endforeach()
-
-endmacro( debug_list )
-
-##############################################################################
-# macro for debugging a environment variable within cmake
-
-macro( debug_env_var VAR )
-
- message( STATUS "ENV ${VAR} [$ENV{${VAR}}]" )
-
-endmacro( debug_env_var )
-
diff --git a/cmake/ecbuild_declare_project.cmake b/cmake/ecbuild_declare_project.cmake
index 11052c6..1c2e93b 100644
--- a/cmake/ecbuild_declare_project.cmake
+++ b/cmake/ecbuild_declare_project.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -69,10 +69,10 @@ macro( ecbuild_declare_project )
get_git_head_revision( GIT_REFSPEC ${PNAME}_GIT_SHA1 )
if( ${PNAME}_GIT_SHA1 )
string( SUBSTRING "${${PNAME}_GIT_SHA1}" 0 7 ${PNAME}_GIT_SHA1_SHORT )
- # debug_var( ${PNAME}_GIT_SHA1 )
- # debug_var( ${PNAME}_GIT_SHA1_SHORT )
+ # ecbuild_debug_var( ${PNAME}_GIT_SHA1 )
+ # ecbuild_debug_var( ${PNAME}_GIT_SHA1_SHORT )
else()
- message( STATUS "Could not get git-sha1 for project ${PNAME}")
+ ecbuild_debug( "Could not get git-sha1 for project ${PNAME}")
endif()
endif()
@@ -101,11 +101,11 @@ macro( ecbuild_declare_project )
set( ${PNAME}_VERSION_STR "${${PROJECT_NAME}_VERSION_STR}"
CACHE INTERNAL "package ${PNAME} version string" ) # ignore caps
- # debug_var( ${PNAME}_VERSION )
- # debug_var( ${PNAME}_VERSION_STR )
- # debug_var( ${PNAME}_MAJOR_VERSION )
- # debug_var( ${PNAME}_MINOR_VERSION )
- # debug_var( ${PNAME}_PATCH_VERSION )
+ # ecbuild_debug_var( ${PNAME}_VERSION )
+ # ecbuild_debug_var( ${PNAME}_VERSION_STR )
+ # ecbuild_debug_var( ${PNAME}_MAJOR_VERSION )
+ # ecbuild_debug_var( ${PNAME}_MINOR_VERSION )
+ # ecbuild_debug_var( ${PNAME}_PATCH_VERSION )
# install dirs for this project
@@ -133,7 +133,7 @@ macro( ecbuild_declare_project )
foreach( p LIB BIN INCLUDE DATA CMAKE )
if( IS_ABSOLUTE ${INSTALL_${p}_DIR} )
- message( WARNING "Defining INSTALL_${p}_DIR as absolute path '${INSTALL_${p}_DIR}' makes this build non-relocatable, possibly breaking the installation of RPMS and DEB packages" )
+ ecbuild_warn( "Defining INSTALL_${p}_DIR as absolute path '${INSTALL_${p}_DIR}' makes this build non-relocatable, possibly breaking the installation of RPMS and DEB packages" )
endif()
endforeach()
@@ -146,12 +146,12 @@ macro( ecbuild_declare_project )
set( ${PNAME}_FULL_INSTALL_${p}_DIR "${CMAKE_INSTALL_PREFIX}/${${var}}"
CACHE INTERNAL "${PNAME} ${p} full install path" )
else()
- message( WARNING "Setting an absolute path for ${VAR} in project ${PNAME}, breakes generation of relocatable binary packages (rpm,deb,...)" )
+ ecbuild_warn( "Setting an absolute path for ${VAR} in project ${PNAME}, breakes generation of relocatable binary packages (rpm,deb,...)" )
set( ${PNAME}_FULL_INSTALL_${p}_DIR "${${var}}"
CACHE INTERNAL "${PNAME} ${p} full install path" )
endif()
- # debug_var( ${PNAME}_FULL_INSTALL_${p}_DIR )
+ # ecbuild_debug_var( ${PNAME}_FULL_INSTALL_${p}_DIR )
endforeach()
@@ -162,7 +162,7 @@ macro( ecbuild_declare_project )
if( ENABLE_RELATIVE_RPATHS )
file( RELATIVE_PATH relative_rpath ${${PNAME}_FULL_INSTALL_BIN_DIR} ${${PNAME}_FULL_INSTALL_LIB_DIR} )
- # debug_var( relative_rpath )
+ # ecbuild_debug_var( relative_rpath )
ecbuild_append_to_rpath( ${relative_rpath} )
@@ -171,23 +171,23 @@ macro( ecbuild_declare_project )
if( IS_ABSOLUTE ${INSTALL_LIB_DIR} )
ecbuild_append_to_rpath( "${INSTALL_LIB_DIR}" )
else()
- ecbuild_append_to_rpath( "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}" )
+ ecbuild_append_to_rpath( "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}" )
endif()
endif()
endif()
- # debug_var( CMAKE_INSTALL_RPATH )
+ # ecbuild_debug_var( CMAKE_INSTALL_RPATH )
# print project header
message( STATUS "---------------------------------------------------------" )
if( ${PNAME}_GIT_SHA1_SHORT )
- message( STATUS "[${PROJECT_NAME}] (${${PNAME}_VERSION_STR}) [${${PNAME}_GIT_SHA1_SHORT}]" )
+ ecbuild_info( "[${PROJECT_NAME}] (${${PNAME}_VERSION_STR}) [${${PNAME}_GIT_SHA1_SHORT}]" )
else()
- message( STATUS "[${PROJECT_NAME}] (${${PNAME}_VERSION_STR})" )
+ ecbuild_info( "[${PROJECT_NAME}] (${${PNAME}_VERSION_STR})" )
endif()
endmacro( ecbuild_declare_project )
diff --git a/cmake/ecbuild_define_build_types.cmake b/cmake/ecbuild_define_build_types.cmake
index 53e4de0..cf92d23 100644
--- a/cmake/ecbuild_define_build_types.cmake
+++ b/cmake/ecbuild_define_build_types.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -7,55 +7,6 @@
# does it submit to any jurisdiction.
############################################################################################
-# define a Production build type
-
-# NOTE: gcc does not guarrante that -O3 performs better than -O2
-# -- it can perform worse due to assembly code bloating.
-# Moreover for gcc 4.1.2 we found that -O3 remove the parser code generated from Lex/Yacc
-# and therefore in production mode we downgrade to -O2 if the compiler is GCC (for all versions).
-
-
-if(CMAKE_COMPILER_IS_GNUCXX)
- set( CMAKE_CXX_FLAGS_PRODUCTION "-O2 -g" CACHE STRING "Flags used by the C++ compiler during Production builds." FORCE )
-else()
- set( CMAKE_CXX_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Flags used by the C++ compiler during Production builds." FORCE )
-endif()
-
-if(CMAKE_COMPILER_IS_GNUCC)
- set( CMAKE_C_FLAGS_PRODUCTION "-O2 -g" CACHE STRING "Flags used by the C compiler during Production builds." FORCE )
-else()
- set( CMAKE_C_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Flags used by the C compiler during Production builds." FORCE )
-endif()
-
-set( CMAKE_EXE_LINKER_FLAGS_PRODUCTION "" CACHE STRING "Flags used for linking binaries during Production builds." FORCE )
-set( CMAKE_SHARED_LINKER_FLAGS_PRODUCTION "" CACHE STRING "Flags used by the shared libraries linker during Production builds." FORCE )
-set( CMAKE_MODULE_LINKER_FLAGS_PRODUCTION "" CACHE STRING "Flags used by the static libraries linker during Production builds." FORCE )
-
-mark_as_advanced(
- CMAKE_CXX_FLAGS_PRODUCTION
- CMAKE_C_FLAGS_PRODUCTION
- CMAKE_EXE_LINKER_FLAGS_PRODUCTION
- CMAKE_SHARED_LINKER_FLAGS_PRODUCTION
- CMAKE_MODULE_LINKER_FLAGS_PRODUCTION )
-
-############################################################################################
-# fixes for specific compilers
-
-### remove -Mipa=fast from PGI compilers in RELEASE mode
-
-if( CMAKE_C_COMPILER_ID STREQUAL "PGI" )
- set(CMAKE_C_FLAGS_RELEASE "-fast -O3")
-endif()
-
-if( CMAKE_CXX_COMPILER_ID STREQUAL "PGI" )
- set(CMAKE_CXX_FLAGS_RELEASE "-fast -O3")
-endif()
-
-if( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
- set(CMAKE_Fortran_FLAGS_RELEASE "-fast -O3")
-endif()
-
-############################################################################################
# define default build type
set( _BUILD_TYPE_MSG "Build type options are: [ None | Debug | Bit | Production | Release | RelWithDebInfo ]" )
@@ -104,34 +55,5 @@ if( NOT CMAKE_BUILD_TYPE MATCHES "None" AND
NOT CMAKE_BUILD_TYPE MATCHES "Production" AND
NOT CMAKE_BUILD_TYPE MATCHES "Release" AND
NOT CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo" )
- message( FATAL_ERROR "CMAKE_BUILD_TYPE is not recognized. ${_BUILD_TYPE_MSG}" )
+ ecbuild_critical( "CMAKE_BUILD_TYPE is not recognized. ${_BUILD_TYPE_MSG}" )
endif()
-
-############################################################################################
-# overrides of the flags per build type
-
-foreach( _btype NONE DEBUG BIT PRODUCTION RELEASE RELWITHDEBINFO )
-
- # OVERRIDE Compiler FLAGS per language (we override because CMake forcely defines them)
- foreach( _lang C CXX Fortran )
- if( ECBUILD_${_lang}_FLAGS_${_btype} )
- set( CMAKE_${_lang}_FLAGS_${_btype} ${ECBUILD_${_lang}_FLAGS_${_btype}} )
- endif()
- endforeach()
-
- # OVERRIDE Linker FLAGS per object type (we override because CMake forcely defines them)
- foreach( _obj EXE SHARED MODULE )
- if( ECBUILD_${_obj}_LINKER_FLAGS_${_btype} )
- set( CMAKE_${_obj}_LINKER_FLAGS_${_btype} ${ECBUILD_${_obj}_LINKER_FLAGS_${_btype}} )
- endif()
- endforeach()
-
-endforeach()
-
-# APPEND Linker FLAGS per language (we append because CMake typically leaves them empty)
-
-foreach( _lang C CXX Fortran )
- if( ECBUILD_${_lang}_LINK_FLAGS )
- set( CMAKE_${_lang}_LINK_FLAGS "${CMAKE_${_lang}_LINK_FLAGS} ${ECBUILD_${_lang}_LINK_FLAGS}" )
- endif()
-endforeach()
\ No newline at end of file
diff --git a/cmake/ecbuild_define_libs_and_execs_target.cmake b/cmake/ecbuild_define_libs_and_execs_target.cmake
new file mode 100644
index 0000000..812f42c
--- /dev/null
+++ b/cmake/ecbuild_define_libs_and_execs_target.cmake
@@ -0,0 +1,29 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+set( EC_ALL_EXES "" CACHE INTERNAL "" )
+set( EC_ALL_LIBS "" CACHE INTERNAL "" )
+
+############################################################################################
+# define libs and execs targets
+
+macro( ecbuild_define_libs_and_execs_targets )
+
+ add_custom_target( libs )
+
+ if( EC_ALL_LIBS )
+ add_dependencies( libs ${EC_ALL_LIBS} )
+ endif()
+
+ add_custom_target( execs )
+
+ if( EC_ALL_EXECS )
+ add_dependencies( execs ${EC_ALL_EXES} )
+ endif()
+
+endmacro(ecbuild_define_libs_and_execs_targets)
diff --git a/cmake/ecbuild_links_target.cmake b/cmake/ecbuild_define_links_target.cmake
similarity index 92%
rename from cmake/ecbuild_links_target.cmake
rename to cmake/ecbuild_define_links_target.cmake
index c881c0d..b5f53fe 100644
--- a/cmake/ecbuild_links_target.cmake
+++ b/cmake/ecbuild_define_links_target.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -63,11 +63,11 @@ macro( ecbuild_define_links_target )
add_custom_target( links DEPENDS ${ec_link_libs} ${ec_link_exes} )
- # debug_var( EC_ALL_EXES )
- # debug_var( ec_link_exes )
+ # ecbuild_debug_var( EC_ALL_EXES )
+ # ecbuild_debug_var( ec_link_exes )
- # debug_var( EC_ALL_LIBS )
- # debug_var( ec_link_libs )
+ # ecbuild_debug_var( EC_ALL_LIBS )
+ # ecbuild_debug_var( ec_link_libs )
endif()
diff --git a/cmake/ecbuild_define_options.cmake b/cmake/ecbuild_define_options.cmake
index f7a2321..af40ae1 100644
--- a/cmake/ecbuild_define_options.cmake
+++ b/cmake/ecbuild_define_options.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-#
+# (C) Copyright 1996-2016 ECMWF.
+#
# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
@@ -46,3 +46,7 @@ option( ECBUILD_USE_INCLUDE_DIRECTORIES "Forces to use global include_directorie
mark_as_advanced( ECBUILD_USE_INCLUDE_DIRECTORIES )
set( CMAKE_NO_SYSTEM_FROM_IMPORTED ON )
+
+# hide some CMake options from CMake UI
+
+mark_as_advanced( CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT )
\ No newline at end of file
diff --git a/cmake/ecbuild_define_paths.cmake b/cmake/ecbuild_define_paths.cmake
index 822bf71..856903d 100644
--- a/cmake/ecbuild_define_paths.cmake
+++ b/cmake/ecbuild_define_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/ecbuild_dont_pack.cmake b/cmake/ecbuild_dont_pack.cmake
index 099ee1d..bc62182 100644
--- a/cmake/ecbuild_dont_pack.cmake
+++ b/cmake/ecbuild_dont_pack.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -41,11 +41,11 @@ macro( ecbuild_dont_pack )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_dont_pack(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_dont_pack(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT DEFINED _PAR_REGEX AND NOT DEFINED _PAR_FILES AND NOT DEFINED _PAR_DIRS )
- message(FATAL_ERROR "Call to ecbuild_dont_pack does not speficify any list to avoid packing.")
+ ecbuild_critical("Call to ecbuild_dont_pack does not speficify any list to avoid packing.")
endif()
set( LOCAL_FILES_NOT_TO_PACK "" )
diff --git a/cmake/ecbuild_download_resource.cmake b/cmake/ecbuild_download_resource.cmake
index d313704..3b2f90e 100644
--- a/cmake/ecbuild_download_resource.cmake
+++ b/cmake/ecbuild_download_resource.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -34,12 +34,12 @@ function( ecbuild_download_resource _p_OUT _p_URL )
execute_process( COMMAND ${WGET_PROGRAM} -nv -O ${_p_OUT} ${_p_URL}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} RESULT_VARIABLE CMD_RESULT )
else()
- message(FATAL_ERROR "Could not find curl or wget. Error downloading ${_p_URL}")
+ ecbuild_critical("Could not find curl or wget. Error downloading ${_p_URL}")
endif()
endif()
if(CMD_RESULT)
- message(FATAL_ERROR "Error downloading ${_p_URL}")
+ ecbuild_critical("Error downloading ${_p_URL}")
endif()
endif()
diff --git a/cmake/ecbuild_echo_targets.cmake b/cmake/ecbuild_echo_targets.cmake
index ddaa2e4..1406a1f 100644
--- a/cmake/ecbuild_echo_targets.cmake
+++ b/cmake/ecbuild_echo_targets.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -32,13 +32,13 @@ function(ecbuild_echo_target_property tgt prop)
get_property(s TARGET ${tgt} PROPERTY ${prop} SET)
# only produce output for values that are set
- #if(s)
- message("tgt='${tgt}' prop='${prop}'")
- message(" value='${v}'")
- message(" defined='${d}'")
- message(" set='${s}'")
- message("")
- #endif()
+ if(s)
+ ecbuild_debug("tgt='${tgt}' prop='${prop}'")
+ ecbuild_debug(" value='${v}'")
+ ecbuild_debug(" defined='${d}'")
+ ecbuild_debug(" set='${s}'")
+ ecbuild_debug("")
+ endif()
cmake_policy(POP)
@@ -58,7 +58,7 @@ endfunction()
function(ecbuild_echo_target tgt)
if(NOT TARGET ${tgt})
- message("There is no target named '${tgt}'")
+ ecbuild_debug("There is no target named '${tgt}'")
return()
endif()
@@ -205,11 +205,11 @@ WIN32_EXECUTABLE
XCODE_ATTRIBUTE_WHATEVER
)
- message("======================== ${tgt} ========================")
+ ecbuild_debug("======================== ${tgt} ========================")
foreach(p ${props})
- ecbuild_echo_target_property("${t}" "${p}")
+ ecbuild_echo_target_property("${tgt}" "${p}")
endforeach()
- message("")
+ ecbuild_debug("")
endfunction()
##############################################################################
diff --git a/cmake/ecbuild_enable_fortran.cmake b/cmake/ecbuild_enable_fortran.cmake
index 16512e8..c1c5503 100644
--- a/cmake/ecbuild_enable_fortran.cmake
+++ b/cmake/ecbuild_enable_fortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -36,17 +36,24 @@ macro( ecbuild_enable_fortran )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_enable_fortran(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_enable_fortran(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
- enable_language( Fortran )
+ if( NOT CMAKE_Fortran_COMPILER_LOADED )
+ enable_language( Fortran )
+ ecbuild_compiler_flags( Fortran )
+ if( ENABLE_WARNINGS AND CMAKE_Fortran_COMPILER_ID MATCHES "Intel" )
+ set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -warn all" )
+ ecbuild_debug( "Fortran FLAG [-warn all] added" )
+ endif()
+ endif()
if( DEFINED _PAR_REQUIRED )
if( CMAKE_Fortran_COMPILER_FORCED )
set( CMAKE_Fortran_COMPILER_WORKS 1 )
endif()
if( NOT CMAKE_Fortran_COMPILER OR NOT CMAKE_Fortran_COMPILER_WORKS )
- message( FATAL_ERROR "Fortran compiler required by project ${PROJECT_NAME} but does not seem to work" )
+ ecbuild_critical( "Fortran compiler required by project ${PROJECT_NAME} but does not seem to work" )
endif()
endif()
diff --git a/cmake/ecbuild_features.cmake b/cmake/ecbuild_features.cmake
index 5d619a5..6d20038 100644
--- a/cmake/ecbuild_features.cmake
+++ b/cmake/ecbuild_features.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -10,10 +10,6 @@
include( FeatureSummary )
-function( debug_var _var )
- message( "${_var} = ${${_var}}" )
-endfunction()
-
# Write list of enabled features to CMake variable ${OUT}
macro( ecbuild_enabled_features OUT )
get_property( ${OUT} GLOBAL PROPERTY ENABLED_FEATURES )
@@ -26,17 +22,17 @@ endmacro()
# Enable the feature ${_name} (add to enabled features, remove from disabled)
function( ecbuild_enable_feature _name )
-
+
get_property( _enabled_features GLOBAL PROPERTY ENABLED_FEATURES )
get_property( _disabled_features GLOBAL PROPERTY DISABLED_FEATURES )
-
+
if( _disabled_features )
list( REMOVE_ITEM _disabled_features ${_name} )
endif()
list( APPEND _enabled_features ${_name} )
list( REMOVE_DUPLICATES _enabled_features )
-
+
set_property(GLOBAL PROPERTY ENABLED_FEATURES "${_enabled_features}" )
set_property(GLOBAL PROPERTY DISABLED_FEATURES "${_disabled_features}" )
@@ -47,53 +43,42 @@ function( ecbuild_disable_feature _name )
get_property( _enabled_features GLOBAL PROPERTY ENABLED_FEATURES )
get_property( _disabled_features GLOBAL PROPERTY DISABLED_FEATURES )
-
+
if( _enabled_features )
list( REMOVE_ITEM _enabled_features ${_name} )
endif()
list( APPEND _disabled_features ${_name} )
list( REMOVE_DUPLICATES _disabled_features )
-
+
set_property(GLOBAL PROPERTY ENABLED_FEATURES "${_enabled_features}" )
set_property(GLOBAL PROPERTY DISABLED_FEATURES "${_disabled_features}" )
-
-endfunction()
-# Set description of feature ${_name} to ${_desc}
-function( ecbuild_set_feature_description _name _desc)
- set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
-endfunction()
-
-# Set purpose of feature ${_name} to ${_desc}
-function( ecbuild_set_feature_purpose _name _purpose )
- get_property( _purpose_list GLOBAL PROPERTY _CMAKE_${_name}_PURPOSE )
- list( APPEND _purpose_list ${_purpose} )
- list( REMOVE_DUPLICATES _purpose_list )
- set_property(GLOBAL PROPERTY _CMAKE_${_name}_PURPOSE "${_purpose_list}" )
endfunction()
# en/disable feature ${_name} and set its description and purpose
function( ecbuild_set_feature _name )
set(options ) # none
- set(oneValueArgs ENABLED DESCRIPTION PURPOSE )
+ set(oneValueArgs ENABLED )
set(multiValueArgs ) # none
- CMAKE_PARSE_ARGUMENTS( _PAR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
-
- get_property( _feature_desc GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION )
+ cmake_parse_arguments( _PAR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+
+ get_property( _feature_desc GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION )
get_property( _enabled_features GLOBAL PROPERTY ENABLED_FEATURES )
get_property( _disabled_features GLOBAL PROPERTY DISABLED_FEATURES )
-
+
if( DEFINED _PAR_ENABLED )
if( _PAR_ENABLED )
+ ecbuild_debug( "ecbuild_set_feature(${_name}): enabling feature" )
ecbuild_enable_feature( ${_name} )
else()
+ ecbuild_debug( "ecbuild_set_feature(${_name}): disabling feature" )
ecbuild_disable_feature( ${_name} )
endif()
endif()
-
+
ecbuild_enabled_features( _enabled_features )
list (FIND _enabled_features "${_name}" _index)
if (${_index} GREATER -1)
@@ -105,17 +90,9 @@ function( ecbuild_set_feature _name )
if (${_index} GREATER -1)
set( _feature_found 1 )
endif()
-
+
if( NOT _feature_found )
- message( WARNING "Feature ${_name} has not yet been enabled or disabled" )
- endif()
-
- if( _PAR_DESCRIPTION )
- ecbuild_set_feature_description( ${_name} ${_PAR_DESCRIPTION} )
- endif()
-
- if( _PAR_PURPOSE )
- ecbuild_set_feature_purpose( ${_name} ${_PAR_PURPOSE} )
+ ecbuild_warn( "Feature ${_name} has not yet been enabled or disabled" )
endif()
endfunction()
diff --git a/cmake/ecbuild_find_fortranlibs.cmake b/cmake/ecbuild_find_fortranlibs.cmake
index 850c4a3..279833f 100644
--- a/cmake/ecbuild_find_fortranlibs.cmake
+++ b/cmake/ecbuild_find_fortranlibs.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -39,7 +39,7 @@ macro( ecbuild_find_fortranlibs )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_find_python(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_find_python(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT FORTRANLIBS_FOUND ) # don't repeat search
@@ -69,7 +69,7 @@ macro( ecbuild_find_fortranlibs )
endif()
if( _PAR_COMPILER AND NOT __known_fcomp )
- message( FATAL_ERROR "unknown fortran compiler ${_PAR_COMPILER}" )
+ ecbuild_critical( "unknown fortran compiler ${_PAR_COMPILER}" )
endif()
### set path from environment variables
@@ -88,7 +88,7 @@ macro( ecbuild_find_fortranlibs )
WITH_XL_FORTRAN OR WITH_INTEL_FORTRAN)
AND NOT (DEFINED PGI_PATH OR DEFINED LIBGFORTRAN_PATH OR
DEFINED XLF_PATH OR DEFINED INTEL_PATH) )
- message( WARNING "Finding fortran libs for unspecified Fortran compiler: default search [ gfortran ]" )
+ ecbuild_warn( "Finding fortran libs for unspecified Fortran compiler: default search [ gfortran ]" )
set( WITH_LIBGFORTRAN 1 )
endif()
@@ -148,13 +148,13 @@ macro( ecbuild_find_fortranlibs )
set( FORTRANLIBS_FOUND 1 CACHE INTERNAL "Fortran libraries found" )
set( FORTRANLIBS_NAME ${_flibs_txt} CACHE INTERNAL "Fortran library name" )
set( FORTRAN_LIBRARIES ${FORTRAN_LIBRARIES} CACHE INTERNAL "Fortran libraries" )
- message( STATUS "Found Fortran libraries: ${_flibs_txt}" )
+ ecbuild_info( "Found Fortran libraries: ${_flibs_txt}" )
else()
set( FORTRANLIBS_FOUND 0 )
if( _PAR_REQUIRED )
- message( FATAL_ERROR "Failed to find Fortran libraries" )
+ ecbuild_critical( "Failed to find Fortran libraries" )
else()
- message( STATUS "Failed to find Fortran libraries" )
+ ecbuild_warn( "Failed to find Fortran libraries" )
endif()
endif()
diff --git a/cmake/ecbuild_find_lexyacc.cmake b/cmake/ecbuild_find_lexyacc.cmake
index 9876097..628488f 100644
--- a/cmake/ecbuild_find_lexyacc.cmake
+++ b/cmake/ecbuild_find_lexyacc.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -34,6 +34,7 @@
#
# The following CMake variables are set if lex and yacc were found:
#
+# :LEXYACC_FOUND: Found suitable combination of bison, lex, yacc, flex
# :LEX_FOUND: lex was found
# :YACC_FOUND: yacc was found
# :LEX_EXECUTABLE: path to the lex executable
@@ -59,25 +60,32 @@ macro( ecbuild_find_lexyacc )
endif()
+ set( LEXYACC_FOUND 1 )
+
if( NOT YACC_FOUND AND NOT BISON_FOUND ) # neither bison nor yacc were found
- message( FATAL_ERROR "neither bison or yacc were found - at least one is required (together with its lexical analyser" )
+ ecbuild_debug( "Neither bison or yacc were found - at least one is required (together with its lexical analyser" )
+ set( LEXYACC_FOUND 0 )
endif()
if( NOT YACC_FOUND ) # check for both bison & flex together
if( BISON_FOUND AND NOT FLEX_FOUND )
- message( FATAL_ERROR "both bison and flex are required - flex not found" )
+ set( LEXYACC_FOUND 0 )
+ ecbuild_debug( "Both bison and flex are required - flex not found" )
endif()
if( FLEX_FOUND AND NOT BISON_FOUND )
- message( FATAL_ERROR "both bison and flex are required - bison not found" )
+ set( LEXYACC_FOUND 0 )
+ ecbuild_debug( "Both bison and flex are required - bison not found" )
endif()
endif()
if( NOT BISON_FOUND ) # check for both yacc & lex together
if( YACC_FOUND AND NOT LEX_FOUND )
- message( FATAL_ERROR "both yacc and lex are required - lex not found" )
+ set( LEXYACC_FOUND 0 )
+ ecbuild_debug( "Both yacc and lex are required - lex not found" )
endif()
if( LEX_FOUND AND NOT YACC_FOUND )
- message( FATAL_ERROR "both yacc and lex are required - yacc not found" )
+ set( LEXYACC_FOUND 0 )
+ ecbuild_debug( "Both yacc and lex are required - yacc not found" )
endif()
endif()
diff --git a/cmake/ecbuild_find_mpi.cmake b/cmake/ecbuild_find_mpi.cmake
index 82fc4b5..a0c6cfa 100644
--- a/cmake/ecbuild_find_mpi.cmake
+++ b/cmake/ecbuild_find_mpi.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -81,7 +81,7 @@ macro( ecbuild_find_mpi )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
# if user defined compilers are MPI compliant, then we use them ...
@@ -110,7 +110,7 @@ macro( ecbuild_find_mpi )
C_COMPILER_SUPPORTS_MPI )
if( C_COMPILER_SUPPORTS_MPI )
- message( STATUS "C compiler supports MPI -- ${CMAKE_C_COMPILER}" )
+ ecbuild_info( "C compiler supports MPI -- ${CMAKE_C_COMPILER}" )
set( MPI_C_COMPILER ${CMAKE_C_COMPILER} )
endif()
@@ -134,7 +134,7 @@ macro( ecbuild_find_mpi )
CXX_COMPILER_SUPPORTS_MPI )
if( CXX_COMPILER_SUPPORTS_MPI )
- message( STATUS "C++ compiler supports MPI -- ${CMAKE_CXX_COMPILER}" )
+ ecbuild_info( "C++ compiler supports MPI -- ${CMAKE_CXX_COMPILER}" )
set( MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER} )
endif()
@@ -157,7 +157,7 @@ macro( ecbuild_find_mpi )
Fortran_COMPILER_SUPPORTS_MPI )
if( Fortran_COMPILER_SUPPORTS_MPI )
- message( STATUS "Fortran compiler supports MPI (F90) -- ${CMAKE_Fortran_COMPILER}" )
+ ecbuild_info( "Fortran compiler supports MPI (F90) -- ${CMAKE_Fortran_COMPILER}" )
set( MPI_Fortran_COMPILER ${CMAKE_Fortran_COMPILER} )
set( MPI_Fortran_FOUND TRUE )
endif()
@@ -251,7 +251,7 @@ macro( ecbuild_enable_mpi )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_COMPONENTS )
@@ -304,7 +304,7 @@ macro( ecbuild_include_mpi )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( MPI_C_FOUND AND NOT C_COMPILER_SUPPORTS_MPI )
diff --git a/cmake/ecbuild_find_omp.cmake b/cmake/ecbuild_find_omp.cmake
index 882adfe..47c05c2 100644
--- a/cmake/ecbuild_find_omp.cmake
+++ b/cmake/ecbuild_find_omp.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -123,7 +123,7 @@ macro( ecbuild_find_omp )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if( NOT _PAR_COMPONENTS )
- message( FATAL_ERROR "No COMPONENTS were specified, looking for OMP.\n Please find with COMPONENTS C CXX Fortran " )
+ ecbuild_critical( "No COMPONENTS were specified, looking for OMP.\n Please find with COMPONENTS C CXX Fortran " )
endif()
set( _STUBS "" )
@@ -206,17 +206,24 @@ endmacro( ecbuild_find_omp )
macro( ecbuild_enable_omp )
+ ecbuild_debug("ecbuild_enable_omp: Trying to enable OpenMP")
ecbuild_find_omp( COMPONENTS C CXX Fortran )
+ ecbuild_debug_var("OMP_C_FOUND")
if( OMP_C_FOUND )
+ ecbuild_debug("Adding ${OMP_C_FLAGS} to CMAKE_C_FLAGS")
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OMP_C_FLAGS}" )
endif()
+ ecbuild_debug_var("OMP_CXX_FOUND")
if( OMP_CXX_FOUND )
+ ecbuild_debug("Adding ${OMP_CXX_FLAGS} to CMAKE_CXX_FLAGS")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OMP_CXX_FLAGS}" )
endif()
+ ecbuild_debug_var("OMP_Fortran_FOUND")
if( OMP_Fortran_FOUND )
+ ecbuild_debug("Adding ${OMP_Fortran_FLAGS} to CMAKE_Fortran_FLAGS")
set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OMP_Fortran_FLAGS}" )
endif()
diff --git a/cmake/ecbuild_find_package.cmake b/cmake/ecbuild_find_package.cmake
index b67b51d..f7f1a9c 100644
--- a/cmake/ecbuild_find_package.cmake
+++ b/cmake/ecbuild_find_package.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -92,18 +92,18 @@ macro( ecbuild_find_package )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_find_package(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_find_package(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_NAME )
- message(FATAL_ERROR "The call to ecbuild_find_package() doesn't specify the NAME.")
+ ecbuild_critical("The call to ecbuild_find_package() doesn't specify the NAME.")
endif()
if( _PAR_EXACT AND NOT _PAR_VERSION )
- message(FATAL_ERROR "Call to ecbuild_find_package() requests EXACT but doesn't specify VERSION.")
+ ecbuild_critical("Call to ecbuild_find_package() requests EXACT but doesn't specify VERSION.")
endif()
- # debug_var( _PAR_NAME )
+ # ecbuild_debug_var( _PAR_NAME )
string( TOUPPER ${_PAR_NAME} pkgUPPER )
string( TOLOWER ${_PAR_NAME} pkgLOWER )
@@ -157,9 +157,9 @@ macro( ecbuild_find_package )
set( ${_PAR_NAME}_DIR "$ENV{${_PAR_NAME}_DIR}" )
endif()
- # Find packages quietly unless in DEVELOPER_MODE, LOG_LEVEL is DEBUG or the package is REQUIRED
+ # Find packages quietly unless in DEVELOPER_MODE or LOG_LEVEL is DEBUG
- if( NOT ( DEVELOPER_MODE OR _PAR_REQUIRED ) AND ( ECBUILD_LOG_LEVEL GREATER ${ECBUILD_DEBUG} ) )
+ if( NOT DEVELOPER_MODE AND ( ECBUILD_LOG_LEVEL GREATER ${ECBUILD_DEBUG} ) )
set( _find_quiet QUIET )
endif()
@@ -191,10 +191,10 @@ macro( ecbuild_find_package )
if( NOT ${_PAR_NAME}_FOUND )
if( ${_PAR_NAME}_PATH )
- message( FATAL_ERROR "${_PAR_NAME}_PATH was provided by user but package ${_PAR_NAME} wasn't found" )
+ ecbuild_critical( "${_PAR_NAME}_PATH was provided by user but package ${_PAR_NAME} wasn't found" )
endif()
if( ${pkgUPPER}_PATH )
- message( FATAL_ERROR "${pkgUPPER}_PATH was provided by user but package ${_PAR_NAME} wasn't found" )
+ ecbuild_critical( "${pkgUPPER}_PATH was provided by user but package ${_PAR_NAME} wasn't found" )
endif()
endif()
@@ -250,7 +250,7 @@ macro( ecbuild_find_package )
if( ${_PAR_NAME}_VERSION )
if( _PAR_EXACT )
if( NOT ${_PAR_NAME}_VERSION VERSION_EQUAL _PAR_VERSION )
- message( WARNING "${PROJECT_NAME} requires (exactly) ${_PAR_NAME} = ${_PAR_VERSION} -- found ${${_PAR_NAME}_VERSION}" )
+ ecbuild_warn( "${PROJECT_NAME} requires (exactly) ${_PAR_NAME} = ${_PAR_VERSION} -- found ${${_PAR_NAME}_VERSION}" )
set( _version_acceptable 0 )
endif()
else()
@@ -258,14 +258,14 @@ macro( ecbuild_find_package )
set( _version_acceptable 1 )
else()
if( NOT _PAR_QUIET )
- message( WARNING "${PROJECT_NAME} requires ${_PAR_NAME} >= ${_PAR_VERSION} -- found ${${_PAR_NAME}_VERSION}" )
+ ecbuild_warn( "${PROJECT_NAME} requires ${_PAR_NAME} >= ${_PAR_VERSION} -- found ${${_PAR_NAME}_VERSION}" )
endif()
set( _version_acceptable 0 )
endif()
endif()
else()
if( NOT _PAR_QUIET )
- message( WARNING "${PROJECT_NAME} found ${_PAR_NAME} but no version information, so cannot check if satisfies ${_PAR_VERSION}" )
+ ecbuild_warn( "${PROJECT_NAME} found ${_PAR_NAME} but no version information, so cannot check if satisfies ${_PAR_VERSION}" )
endif()
set( _version_acceptable 0 )
endif()
@@ -278,7 +278,7 @@ macro( ecbuild_find_package )
set( ${pkgUPPER}_FOUND ${${_PAR_NAME}_FOUND} )
else()
if( NOT _PAR_QUIET )
- message( WARNING "${PROJECT_NAME} found ${_PAR_NAME} but with unsuitable version" )
+ ecbuild_warn( "${PROJECT_NAME} found ${_PAR_NAME} but with unsuitable version" )
endif()
set( ${pkgUPPER}_FOUND 0 )
set( ${_PAR_NAME}_FOUND 0 )
@@ -303,21 +303,21 @@ macro( ecbuild_find_package )
if( ${_PAR_NAME}_FOUND OR ${pkgUPPER}_FOUND )
if( NOT _PAR_QUIET )
- message( STATUS "[${_PAR_NAME}] (${${_PAR_NAME}_VERSION})" )
+ ecbuild_info( "[${_PAR_NAME}] (${${_PAR_NAME}_VERSION})" )
foreach( var in ITEMS INCLUDE_DIR INCLUDE_DIRS DEFINITIONS LIBRARY LIBRARIES )
if( ${pkgUPPER}_${var} )
- message( STATUS " ${pkgUPPER}_${var} : [${${pkgUPPER}_${var}}]" )
+ ecbuild_info( " ${pkgUPPER}_${var} : [${${pkgUPPER}_${var}}]" )
elseif( ${_PAR_NAME}_${var} )
- message( STATUS " ${_PAR_NAME}_${var} : [${${_PAR_NAME}_${var}}]" )
+ ecbuild_info( " ${_PAR_NAME}_${var} : [${${_PAR_NAME}_${var}}]" )
endif()
endforeach()
endif()
else()
if( _PAR_REQUIRED )
- message( FATAL_ERROR ${_failed_message} " !! ${PROJECT_NAME} requires package ${_PAR_NAME} !!" )
+ ecbuild_critical( ${_failed_message} " !! ${PROJECT_NAME} requires package ${_PAR_NAME} !!" )
else()
if( NOT _PAR_QUIET )
- message( STATUS ${_failed_message} )
+ ecbuild_warn( ${_failed_message} )
endif()
endif()
endif()
diff --git a/cmake/ecbuild_find_perl.cmake b/cmake/ecbuild_find_perl.cmake
index c615203..97b22f8 100644
--- a/cmake/ecbuild_find_perl.cmake
+++ b/cmake/ecbuild_find_perl.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -45,13 +45,13 @@ macro( ecbuild_find_perl )
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_p_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_find_perl(): \"${_p_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_find_perl(): \"${_p_UNPARSED_ARGUMENTS}\"")
endif()
find_package( Perl )
if( NOT PERL_EXECUTABLE AND _p_REQUIRED )
- message( FATAL_ERROR "Failed to find Perl (REQUIRED)" )
+ ecbuild_critical( "Failed to find Perl (REQUIRED)" )
endif()
if( PERL_EXECUTABLE )
diff --git a/cmake/ecbuild_find_python.cmake b/cmake/ecbuild_find_python.cmake
index c001a7b..48ba28f 100644
--- a/cmake/ecbuild_find_python.cmake
+++ b/cmake/ecbuild_find_python.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -14,7 +14,7 @@
#
# Find Python interpreter, its version and the Python libraries. ::
#
-# ecbuild_find_python( [ VERSION <version> ] [ REQUIRED ] )
+# ecbuild_find_python( [ VERSION <version> ] [ REQUIRED ] [ NO_LIBS ] )
#
# Options
# -------
@@ -25,14 +25,18 @@
# REQUIRED : optional
# fail if Python was not found
#
+# NO_LIBS : optional
+# only search for the Python interpreter, not the libraries
+#
# Output variables
# ----------------
#
-# The following CMake variables are set if perl was found:
+# The following CMake variables are set if python was found:
#
# :PYTHONINTERP_FOUND: Python interpreter was found
# :PYTHONLIBS_FOUND: Python libraries were found
# :PYTHON_FOUND: Python was found (both interpreter and libraries)
+# :PYTHON_EXECUTABLE: Python executable
# :PYTHON_VERSION_MAJOR: major version number
# :PYTHON_VERSION_MINOR: minor version number
# :PYTHON_VERSION_PATCH: patch version number
@@ -45,18 +49,18 @@
set( __test_python ${CMAKE_CURRENT_LIST_DIR}/pymain.c )
-macro( ecbuild_find_python )
+function( ecbuild_find_python )
# parse parameters
- set( options REQUIRED )
+ set( options REQUIRED NO_LIBS )
set( single_value_args VERSION )
set( multi_value_args )
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_p_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_find_python(): \"${_p_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_find_python(): \"${_p_UNPARSED_ARGUMENTS}\"")
endif()
# find python executable
@@ -64,7 +68,7 @@ macro( ecbuild_find_python )
find_package( PythonInterp )
if( NOT PYTHONINTERP_FOUND AND _p_REQUIRED )
- message( FATAL_ERROR "Failed to find any Python interpreter (REQUIRED)" )
+ ecbuild_error( "Failed to find any Python interpreter (REQUIRED)" )
endif()
# find python version
@@ -74,19 +78,19 @@ macro( ecbuild_find_python )
# endif()
# endif()
- # message( STATUS "Python version ${PYTHON_VERSION_STRING}" )
- # debug_var(PYTHON_VERSION_MAJOR)
- # debug_var(PYTHON_VERSION_MINOR)
- # debug_var(PYTHON_VERSION_PATCH)
+ # ecbuild_debug( "Python version ${PYTHON_VERSION_STRING}" )
+ # ecbuild_debug_var(PYTHON_VERSION_MAJOR)
+ # ecbuild_debug_var(PYTHON_VERSION_MINOR)
+ # ecbuild_debug_var(PYTHON_VERSION_PATCH)
if( PYTHONINTERP_FOUND AND DEFINED _p_VERSION )
if( _p_VERSION VERSION_GREATER "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}" )
set( PYTHONINTERP_FOUND 0 )
set( PYTHON_EXECUTABLE "PYTHON_EXECUTABLE-NOTFOUND" )
if( _p_REQUIRED )
- message( FATAL_ERROR "Required python version at least ${_p_VERSION} but found only ${PYTHON_VERSION_STRING}" )
+ ecbuild_critical( "Required python version at least ${_p_VERSION} but found only ${PYTHON_VERSION_STRING}" )
else()
- message( WARNING "Looking for python version at least ${_p_VERSION} but found only ${PYTHON_VERSION_STRING}\nMarking Python as NOTFOUND" )
+ ecbuild_warn( "Looking for python version at least ${_p_VERSION} but found only ${PYTHON_VERSION_STRING}\nMarking Python as NOTFOUND" )
endif()
endif()
endif()
@@ -94,65 +98,77 @@ macro( ecbuild_find_python )
if( PYTHONINTERP_FOUND )
ecbuild_debug( "ecbuild_find_python: Found Python interpreter version ${PYTHON_VERSION_STRING} at ${PYTHON_EXECUTABLE}" )
+ # find where python site-packages are ...
+
+ if( PYTHON_EXECUTABLE )
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+ ecbuild_debug( "ecbuild_find_python: PYTHON_SITE_PACKAGES=${PYTHON_SITE_PACKAGES}" )
+
+ endif()
+ if( PYTHONINTERP_FOUND AND NOT _p_NO_LIBS )
# find python config
if( PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE}-config )
- set(PYTHON_CONFIG ${PYTHON_EXECUTABLE}-config CACHE PATH "" FORCE)
+ set(PYTHON_CONFIG_EXECUTABLE ${PYTHON_EXECUTABLE}-config CACHE PATH "" FORCE)
else()
- find_program( PYTHON_CONFIG NAMES python-config python-config${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} )
+ find_program( PYTHON_CONFIG_EXECUTABLE NAMES python-config python-config${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} )
endif()
+ ecbuild_debug_var( PYTHON_CONFIG_EXECUTABLE )
+
# find python libs
- # The OpenBSD python packages have python-config's
+ # The OpenBSD python packages have python-config's
# that don't reliably report linking flags that will work.
-
- if( PYTHON_CONFIG AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
- ecbuild_debug( "ecbuild_find_python: Searching for Python include directories and libraries using ${PYTHON_CONFIG}" )
-
- execute_process(COMMAND "${PYTHON_CONFIG}" --ldflags
+
+ if( PYTHON_CONFIG_EXECUTABLE AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
+ ecbuild_debug( "ecbuild_find_python: Searching for Python include directories and libraries using ${PYTHON_CONFIG_EXECUTABLE}" )
+
+ execute_process(COMMAND "${PYTHON_CONFIG_EXECUTABLE}" --ldflags
OUTPUT_VARIABLE PYTHON_LIBRARIES
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
- execute_process(COMMAND "${PYTHON_CONFIG}" --includes
- OUTPUT_VARIABLE PYTHON_INCLUDE_DIR
+ execute_process(COMMAND "${PYTHON_CONFIG_EXECUTABLE}" --includes
+ OUTPUT_VARIABLE PYTHON_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
- string(REGEX REPLACE "^[-I]" "" PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
- string(REGEX REPLACE "[ ]-I" " " PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
-
- separate_arguments(PYTHON_INCLUDE_DIR)
+ string(REGEX REPLACE "^[-I]" "" PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIRS}")
+ string(REGEX REPLACE "[ ]-I" " " PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIRS}")
+
+ separate_arguments(PYTHON_INCLUDE_DIRS)
else() # revert to finding pythonlibs the standard way (cmake macro)
ecbuild_debug( "ecbuild_find_python: Searching for Python include directories and libraries using find_package(PythonLibs)" )
-
+
find_package(PythonLibs)
- if( PYTHON_INCLUDE_PATH AND NOT PYTHON_INCLUDE_DIR )
- set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}")
+ if( PYTHON_INCLUDE_PATH AND NOT PYTHON_INCLUDE_DIRS )
+ set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_PATH}")
endif()
endif()
# Remove duplicate include directories
- list(REMOVE_DUPLICATES PYTHON_INCLUDE_DIR)
+ list(REMOVE_DUPLICATES PYTHON_INCLUDE_DIRS)
- # Test if we can link against the Python libraries and include Python.h
- try_compile( PYTHON_LIBS_WORKING ${CMAKE_CURRENT_BINARY_DIR}
- ${__test_python}
- CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${PYTHON_INCLUDE_DIR}"
- LINK_LIBRARIES ${PYTHON_LIBRARIES} )
- # set output variables
+ if( PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS )
+ # Test if we can link against the Python libraries and include Python.h
+ try_compile( PYTHON_LIBS_WORKING ${CMAKE_CURRENT_BINARY_DIR}
+ ${__test_python}
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${PYTHON_INCLUDE_DIRS}"
+ LINK_LIBRARIES ${PYTHON_LIBRARIES} )
- find_package_handle_standard_args( PythonLibs DEFAULT_MSG
- PYTHON_INCLUDE_DIR PYTHON_LIBRARIES PYTHON_LIBS_WORKING )
- ecbuild_debug( "ecbuild_find_python: PYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR}" )
- ecbuild_debug( "ecbuild_find_python: PYTHON_LIBRARIES=${PYTHON_LIBRARIES}" )
+ # set output variables
- set( PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} )
- set( PYTHON_INCLUDE_PATH ${PYTHON_INCLUDE_DIR} )
+ find_package_handle_standard_args( PythonLibs DEFAULT_MSG
+ PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES PYTHON_LIBS_WORKING )
+ ecbuild_debug( "ecbuild_find_python: PYTHON_INCLUDE_DIRS=${PYTHON_INCLUDE_DIRS}" )
+ ecbuild_debug( "ecbuild_find_python: PYTHON_LIBRARIES=${PYTHON_LIBRARIES}" )
+
+ endif()
# Also set PYTHON_FOUND and Python_FOUND for compatibility with ecbuild_add_option
if( PYTHONLIBS_FOUND )
@@ -160,18 +176,30 @@ macro( ecbuild_find_python )
set( Python_FOUND 1 )
endif()
- # find where python site-packages are ...
-
- execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
- ecbuild_debug( "ecbuild_find_python: PYTHON_SITE_PACKAGES=${PYTHON_SITE_PACKAGES}" )
-
endif()
-# debug_var( PYTHONINTERP_FOUND )
-# debug_var( PYTHON_EXECUTABLE )
-# debug_var( PYTHONLIBS_FOUND )
-# debug_var( PYTHON_INCLUDE_DIRS )
-# debug_var( PYTHON_LIBRARIES )
-# debug_var( PYTHON_SITE_PACKAGES )
-
-endmacro( ecbuild_find_python )
+ ecbuild_debug_var( PYTHONINTERP_FOUND )
+ ecbuild_debug_var( PYTHON_FOUND )
+ ecbuild_debug_var( PYTHON_EXECUTABLE )
+ ecbuild_debug_var( PYTHON_CONFIG_EXECUTABLE )
+ ecbuild_debug_var( PYTHON_VERSION_MAJOR )
+ ecbuild_debug_var( PYTHON_VERSION_MINOR )
+ ecbuild_debug_var( PYTHON_VERSION_PATCH )
+ ecbuild_debug_var( PYTHON_VERSION_STRING )
+ ecbuild_debug_var( PYTHON_INCLUDE_DIRS )
+ ecbuild_debug_var( PYTHON_LIBRARIES )
+ ecbuild_debug_var( PYTHON_SITE_PACKAGES )
+
+ set( PYTHONINTERP_FOUND ${PYTHONINTERP_FOUND} PARENT_SCOPE )
+ set( PYTHONLIBS_FOUND ${PYTHONLIBS_FOUND} PARENT_SCOPE )
+ set( PYTHON_FOUND ${PYTHON_FOUND} PARENT_SCOPE )
+ set( PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} PARENT_SCOPE )
+ set( PYTHON_VERSION_MAJOR ${PYTHON_VERSION_MAJOR} PARENT_SCOPE )
+ set( PYTHON_VERSION_MINOR ${PYTHON_VERSION_MINOR} PARENT_SCOPE )
+ set( PYTHON_VERSION_PATCH ${PYTHON_VERSION_PATCH} PARENT_SCOPE )
+ set( PYTHON_VERSION_STRING ${PYTHON_VERSION_STRING} PARENT_SCOPE )
+ set( PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} PARENT_SCOPE )
+ set( PYTHON_LIBRARIES ${PYTHON_LIBRARIES} PARENT_SCOPE )
+ set( PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES} PARENT_SCOPE )
+
+endfunction( ecbuild_find_python )
diff --git a/cmake/ecbuild_generate_config_headers.cmake b/cmake/ecbuild_generate_config_headers.cmake
index 93cbb1f..6bc8301 100644
--- a/cmake/ecbuild_generate_config_headers.cmake
+++ b/cmake/ecbuild_generate_config_headers.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -36,7 +36,7 @@ function( ecbuild_generate_config_headers )
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_generate_config_headers(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_generate_config_headers(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
# generate list of compiler flags
diff --git a/cmake/ecbuild_generate_fortran_interfaces.cmake b/cmake/ecbuild_generate_fortran_interfaces.cmake
new file mode 100644
index 0000000..d586248
--- /dev/null
+++ b/cmake/ecbuild_generate_fortran_interfaces.cmake
@@ -0,0 +1,143 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_generate_fortran_interfaces
+# ===================================
+#
+# Generates interfaces form the Fortran source files. ::
+#
+# ecbuild_generate_fortran_interfaces()
+#
+# Options
+# -------
+#
+# TARGET : required
+# target name
+#
+##############################################################################
+
+function( ecbuild_generate_fortran_interfaces )
+
+ find_program( FCM_EXECUTABLE fcm REQUIRED DOC "Fortran interface generator" )
+
+ if( NOT FCM_EXECUTABLE )
+ ecbuild_error( "ecbuild_generate_fortran_interfaces: fcm executable not found." )
+ endif()
+
+ set( options )
+ set( single_value_args TARGET DESTINATION PARALLEL INCLUDE_DIRS GENERATED SOURCE_DIR FCM_CONFIG_FILE )
+ set( multi_value_args DIRECTORIES )
+
+ cmake_parse_arguments( P "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
+
+ if( NOT DEFINED P_TARGET )
+ ecbuild_error( "ecbuild_generate_fortran_interfaces: TARGET argument missing" )
+ endif()
+
+ if( NOT DEFINED P_DESTINATION )
+ ecbuild_error( "ecbuild_generate_fortran_interfaces: DESTINATION argument missing" )
+ endif()
+
+ if( NOT DEFINED P_DIRECTORIES )
+ ecbuild_error( "ecbuild_generate_fortran_interfaces: DIRECTORIES argument missing" )
+ endif()
+
+ if( NOT DEFINED P_PARALLEL OR (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") )
+ set( P_PARALLEL 1 )
+ endif()
+
+ ecbuild_debug_var( P_PARALLEL )
+
+ if( NOT DEFINED P_SOURCE_DIR )
+ ecbuild_error( "ecbuild_generate_fortran_interfaces: SOURCE_DIR argument missing")
+ endif()
+
+ if( DEFINED P_FCM_CONFIG_FILE )
+ set( FCM_CONFIG_FILE ${P_FCM_CONFIG_FILE} )
+ endif()
+
+ if( NOT FCM_CONFIG_FILE )
+ set( PROJECT_FCM_CONFIG_FILE "${PROJECT_SOURCE_DIR}/cmake/fcm-make-interfaces.cfg" )
+ if( EXISTS ${PROJECT_FCM_CONFIG_FILE} )
+ set( FCM_CONFIG_FILE ${PROJECT_FCM_CONFIG_FILE} )
+ ecbuild_debug( "ecbuild_generate_fortran_interfaces: fcm configuration found in ${PROJECT_FCM_CONFIG_FILE}" )
+ else()
+ ecbuild_debug( "ecbuild_generate_fortran_interfaces: fcm configuration not found in ${PROJECT_FCM_CONFIG_FILE}" )
+ endif()
+ endif()
+
+ if( NOT FCM_CONFIG_FILE )
+ set( DEFAULT_FCM_CONFIG_FILE "${ECBUILD_MACROS_DIR}/fcm-make-interfaces.cfg" )
+ if( EXISTS ${DEFAULT_FCM_CONFIG_FILE} )
+ set( FCM_CONFIG_FILE ${DEFAULT_FCM_CONFIG_FILE} )
+ ecbuild_debug( "ecbuild_generate_fortran_interfaces: fcm configuration found in ${DEFAULT_FCM_CONFIG_FILE}" )
+ else()
+ ecbuild_debug( "ecbuild_generate_fortran_interfaces: fcm configuration not found in ${DEFAULT_FCM_CONFIG_FILE}" )
+ endif()
+ endif()
+
+ ecbuild_debug_var( FCM_CONFIG_FILE )
+
+ if( NOT EXISTS ${FCM_CONFIG_FILE} )
+ ecbuild_error( "ecbuild_generate_fortran_interfaces: needs fcm configuration in ${FCM_CONFIG_FILE}" )
+ endif()
+
+ foreach( _srcdir ${P_DIRECTORIES} )
+ if( _srcdir MATCHES "/$" )
+ ecbuild_critical("ecbuild_generate_fortran_interfaces: directory ${_srcdir} must not end with /")
+ endif()
+ ecbuild_list_add_pattern( LIST fortran_files SOURCE_DIR ${P_SOURCE_DIR} GLOB ${_srcdir}/*.F* )
+ endforeach()
+
+ string( REPLACE ";" " " _srcdirs "${P_DIRECTORIES}" )
+
+ set( _cnt 0 )
+ foreach( file ${_fortran_files} )
+ if( ${${SRC}/file} IS_NEWER_THAN ${${SRC}/file} )
+ set( run_fcm 1 )
+ endif()
+ endforeach()
+
+ foreach( fortran_file ${fortran_files} )
+ #list( APPEND fullpath_fortran_files ${CMAKE_CURRENT_SOURCE_DIR}/${fortran_file} )
+ get_filename_component(base ${fortran_file} NAME_WE)
+ set( interface_file "${CMAKE_CURRENT_BINARY_DIR}/interfaces/include/${base}.intfb.h" )
+ list( APPEND interface_files ${interface_file} )
+ set_source_files_properties( ${interface_file} PROPERTIES GENERATED TRUE )
+ math(EXPR _cnt "${_cnt}+1")
+ endforeach()
+
+ ecbuild_info("Target ${P_TARGET} will generate ${_cnt} interface files using FCM")
+
+
+
+ if( DEFINED P_GENERATED )
+ set( ${P_GENERATED} ${interface_files} PARENT_SCOPE )
+ endif()
+
+ set( include_dir ${CMAKE_CURRENT_BINARY_DIR}/${P_DESTINATION}/interfaces/include )
+ set( ${P_INCLUDE_DIRS} ${include_dir} PARENT_SCOPE )
+
+ execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${include_dir}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
+
+ add_custom_command(
+ OUTPUT "${P_DESTINATION}/${P_TARGET}.timestamp"
+ COMMAND ${FCM_EXECUTABLE} make -j ${P_PARALLEL} --config-file=${FCM_CONFIG_FILE} interfaces.ns-incl=${_srcdirs} interfaces.source=${P_SOURCE_DIR}
+ COMMAND touch "${P_TARGET}.timestamp"
+ DEPENDS ${fortran_files}
+ COMMENT "Generating ${_cnt} interface files for target ${P_TARGET}"
+ WORKING_DIRECTORY ${P_DESTINATION} VERBATIM )
+
+ add_custom_target( ${P_TARGET} DEPENDS ${P_DESTINATION}/${P_TARGET}.timestamp )
+
+
+endfunction( ecbuild_generate_fortran_interfaces )
diff --git a/cmake/ecbuild_generate_rpc.cmake b/cmake/ecbuild_generate_rpc.cmake
index 45a00ba..f06624f 100644
--- a/cmake/ecbuild_generate_rpc.cmake
+++ b/cmake/ecbuild_generate_rpc.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -45,20 +45,20 @@ macro( ecbuild_generate_rpc )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_generate_rpc(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_generate_rpc(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_SOURCE )
- message(FATAL_ERROR "The call to ecbuild_generate_rpc() doesn't specify the SOURCE file.")
+ ecbuild_critical("The call to ecbuild_generate_rpc() doesn't specify the SOURCE file.")
endif()
# optional
# if( NOT _PAR_DEPENDANT )
-# message(FATAL_ERROR "The call to ecbuild_generate_rpc() doesn't specify the DEPENDANT files.")
+# ecbuild_critical("The call to ecbuild_generate_rpc() doesn't specify the DEPENDANT files.")
# endif()
if( NOT DEFINED _PAR_TARGET_H AND NOT DEFINED _PAR_TARGET_C )
- message(FATAL_ERROR "The call to ecbuild_generate_rpc() doesn't specify the _PAR_TARGET_H or _PAR_TARGET_C files.")
+ ecbuild_critical("The call to ecbuild_generate_rpc() doesn't specify the _PAR_TARGET_H or _PAR_TARGET_C files.")
endif()
find_package( RPCGEN REQUIRED )
diff --git a/cmake/ecbuild_generate_yy.cmake b/cmake/ecbuild_generate_yy.cmake
index 5ef2dad..35088fb 100644
--- a/cmake/ecbuild_generate_yy.cmake
+++ b/cmake/ecbuild_generate_yy.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -19,6 +19,7 @@
# LEX <file>
# DEPENDANT <file1> [ <file2> ... ]
# [ SOURCE_DIR <dir> ]
+# [ OUTPUT_DIRECTORY <dir> ]
# [ YACC_TARGET <file> ]
# [ LEX_TARGET <file> ]
# [ YACC_FLAGS <flags> ]
@@ -45,6 +46,9 @@
# SOURCE_DIR : optional, defaults to CMAKE_CURRENT_SOURCE_DIR
# directory where yacc and lex source files are located
#
+# OUTPUT_DIRECTORY : optional, defaults to CMAKE_CURRENT_BINARY_DIR
+# output directory for yacc and lex target files
+#
# YACC_TARGET : optional, defaults to YACC
# base name of the generated yacc target file (without .c extension)
#
@@ -72,29 +76,29 @@ macro( ecbuild_generate_yy )
ecbuild_find_perl( REQUIRED )
set( options )
- set( single_value_args YYPREFIX YACC LEX SOURCE_DIR YACC_TARGET LEX_TARGET LEX_FLAGS YACC_FLAGS FLEX_FLAGS BISON_FLAGS )
+ set( single_value_args YYPREFIX YACC LEX SOURCE_DIR OUTPUT_DIRECTORY YACC_TARGET LEX_TARGET LEX_FLAGS YACC_FLAGS FLEX_FLAGS BISON_FLAGS )
set( multi_value_args DEPENDANT )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_generate_yy(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_generate_yy(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_YYPREFIX )
- message(FATAL_ERROR "The call to ecbuild_generate_yy() doesn't specify the YYPREFIX.")
+ ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the YYPREFIX.")
endif()
if( NOT _PAR_YACC )
- message(FATAL_ERROR "The call to ecbuild_generate_yy() doesn't specify the YACC file.")
+ ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the YACC file.")
endif()
if( NOT _PAR_LEX )
- message(FATAL_ERROR "The call to ecbuild_generate_yy() doesn't specify the LEX file.")
+ ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the LEX file.")
endif()
if( NOT _PAR_DEPENDANT )
- message(FATAL_ERROR "The call to ecbuild_generate_yy() doesn't specify the DEPENDANT files.")
+ ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the DEPENDANT files.")
endif()
set( BASE ${_PAR_YYPREFIX}_${_PAR_YACC} )
@@ -125,19 +129,23 @@ macro( ecbuild_generate_yy )
set ( _PAR_LEX_TARGET ${_PAR_LEX} )
endif()
- set( ${BASE}yy_tmp_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_YACC_TARGET}.tmp.c )
- set( ${BASE}yh_tmp_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_YACC_TARGET}.tmp.h )
- set( ${BASE}yl_tmp_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_LEX_TARGET}.tmp.c )
-
- set( ${BASE}yy_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_YACC_TARGET}.c )
- set( ${BASE}yh_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_YACC_TARGET}.h )
- set( ${BASE}yl_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_LEX_TARGET}.c )
-
if( NOT _PAR_SOURCE_DIR )
set( _PAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
endif()
- add_custom_target( ${_PAR_YYPREFIX}_${DEPENDANT} SOURCES ${_PAR_SOURCE_DIR}/${_PAR_YACC}.y ${_PAR_SOURCE_DIR}/${_PAR_LEX}.l )
+ if( NOT _PAR_OUTPUT_DIRECTORY )
+ set( _PAR_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
+ else()
+ file( MAKE_DIRECTORY ${_PAR_OUTPUT_DIRECTORY} )
+ endif()
+
+ set( ${BASE}yy_tmp_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.tmp.c )
+ set( ${BASE}yh_tmp_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.tmp.h )
+ set( ${BASE}yl_tmp_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_LEX_TARGET}.tmp.c )
+
+ set( ${BASE}yy_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.c )
+ set( ${BASE}yh_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.h )
+ set( ${BASE}yl_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_LEX_TARGET}.c )
if( BISON_FOUND )
bison_target( ${BASE}_parser ${_PAR_SOURCE_DIR}/${_PAR_YACC}.y ${${BASE}yy_tmp_target} COMPILE_FLAGS "${_PAR_BISON_FLAGS}" )
diff --git a/cmake/ecbuild_get_cxx11_flags.cmake b/cmake/ecbuild_get_cxx11_flags.cmake
index 5bfed07..47d0e1a 100644
--- a/cmake/ecbuild_get_cxx11_flags.cmake
+++ b/cmake/ecbuild_get_cxx11_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -65,7 +65,7 @@ function( ecbuild_get_cxx11_flags CXX11_FLAGS )
elseif(has_std_cpp0x)
set(${CXX11_FLAGS} "-std=c++0x" PARENT_SCOPE)
else()
- message(FATAL ERROR "Could not detect C++11 flags")
+ ecbuild_critical("Could not detect C++11 flags")
endif(has_std_gnupp11)
endfunction()
diff --git a/cmake/ecbuild_get_date.cmake b/cmake/ecbuild_get_date.cmake
index ec308a3..730ea54 100644
--- a/cmake/ecbuild_get_date.cmake
+++ b/cmake/ecbuild_get_date.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -24,7 +24,7 @@ macro(ecbuild_get_date RESULT)
execute_process(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\3.\\2.\\1" ${RESULT} ${${RESULT}})
else()
- message(SEND_ERROR "date not implemented")
+ ecbuild_error("date not implemented")
endif()
endmacro(ecbuild_get_date)
@@ -46,7 +46,7 @@ macro(ecbuild_get_timestamp RESULT)
execute_process(COMMAND "date" "+%Y/%m/%d/%H/%M/%S" OUTPUT_VARIABLE _timestamp)
string(REGEX REPLACE "(....)/(..)/(..)/(..)/(..)/(..).*" "\\1\\2\\3\\4\\5\\6" ${RESULT} ${_timestamp})
else()
- message(WARNING "This is NOT UNIX - timestamp not implemented")
+ ecbuild_warn("This is NOT UNIX - timestamp not implemented")
endif()
endmacro(ecbuild_get_timestamp)
diff --git a/cmake/ecbuild_get_resources.cmake b/cmake/ecbuild_get_resources.cmake
index da824d9..f531d82 100644
--- a/cmake/ecbuild_get_resources.cmake
+++ b/cmake/ecbuild_get_resources.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-#
+# (C) Copyright 1996-2016 ECMWF.
+#
# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
@@ -19,17 +19,17 @@ macro( ecbuild_get_resources )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_get_resources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_get_resources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_LIST )
- message( FATAL_ERROR "Missing parameter LIST of resources in macro ecbuild_get_resources()" )
+ ecbuild_critical( "Missing parameter LIST of resources in macro ecbuild_get_resources()" )
endif()
if( NOT _PAR_TO_DIR )
set( _PAR_TO_DIR ${CMAKE_CURRENT_BINARY_DIR} )
endif()
-
+
list( LENGTH _PAR_LIST _rsize )
math( EXPR _max "${_rsize}-1" )
foreach( i RANGE 0 ${_max} 2 )
@@ -39,14 +39,14 @@ macro( ecbuild_get_resources )
list( GET _PAR_LIST ${i} r )
list( GET _PAR_LIST ${in} rh )
-# debug_var( r )
-# debug_var( rh )
+# ecbuild_debug_var( r )
+# ecbuild_debug_var( rh )
get_filename_component( rf ${r} NAME )
file( DOWNLOAD ${r} ${_PAR_TO_DIR}/${rf} EXPECTED_HASH SHA1=${rh} )
endforeach()
-
+
endmacro()
diff --git a/cmake/ecbuild_get_test_data.cmake b/cmake/ecbuild_get_test_data.cmake
index 8106c65..c19a760 100644
--- a/cmake/ecbuild_get_test_data.cmake
+++ b/cmake/ecbuild_get_test_data.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -42,7 +42,7 @@ function( _download_test_data _p_NAME _p_DIRNAME )
else()
if( WARNING_CANNOT_DOWNLOAD_TEST_DATA )
- message( WARNING "Couldn't find curl neither wget -- cannot download test data from server.\nPlease obtain the test data by other means and pleace it in the build directory." )
+ ecbuild_warn( "Couldn't find curl neither wget -- cannot download test data from server.\nPlease obtain the test data by other means and pleace it in the build directory." )
set( WARNING_CANNOT_DOWNLOAD_TEST_DATA 1 CACHE INTERNAL "Couldn't find curl neither wget -- cannot download test data from server" )
mark_as_advanced( WARNING_CANNOT_DOWNLOAD_TEST_DATA )
endif()
@@ -130,7 +130,7 @@ function( ecbuild_get_test_data )
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_p_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_get_test_data(): \"${_p_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_get_test_data(): \"${_p_UNPARSED_ARGUMENTS}\"")
endif()
file( RELATIVE_PATH currdir ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
@@ -138,7 +138,7 @@ function( ecbuild_get_test_data )
### check parameters
if( NOT _p_NAME )
- message(FATAL_ERROR "ecbuild_get_test_data() expects a NAME")
+ ecbuild_critical("ecbuild_get_test_data() expects a NAME")
endif()
if( NOT _p_TARGET )
@@ -151,10 +151,10 @@ function( ecbuild_get_test_data )
set( _p_DIRNAME ${PROJECT_NAME}/${currdir} )
endif()
-# debug_var( _p_TARGET )
-# debug_var( _p_NAME )
-# debug_var( _p_URL )
-# debug_var( _p_DIRNAME )
+# ecbuild_debug_var( _p_TARGET )
+# ecbuild_debug_var( _p_NAME )
+# ecbuild_debug_var( _p_URL )
+# ecbuild_debug_var( _p_DIRNAME )
# download the data
@@ -168,8 +168,6 @@ function( ecbuild_get_test_data )
if( NOT _p_MD5 AND NOT _p_SHA1) # use remote md5
-# message( STATUS " --- getting MD5 sum " )
-
add_custom_command( OUTPUT ${_p_NAME}.localmd5
COMMAND ${CMAKE_COMMAND} -E md5sum ${_p_NAME} > ${_p_NAME}.localmd5
DEPENDS ${_p_NAME} )
@@ -187,8 +185,6 @@ function( ecbuild_get_test_data )
if( _p_MD5 )
-# message( STATUS " --- computing MD5 sum [${_p_MD5}]" )
-
add_custom_command( OUTPUT ${_p_NAME}.localmd5
COMMAND ${CMAKE_COMMAND} -E md5sum ${_p_NAME} > ${_p_NAME}.localmd5
DEPENDS ${_p_NAME} )
@@ -206,8 +202,6 @@ function( ecbuild_get_test_data )
# if( _p_SHA1 )
-## message( STATUS " --- computing SHA1 sum [${_p_SHA1}]" )
-
# find_program( SHASUM NAMES sha1sum shasum )
# if( SHASUM )
# add_custom_command( OUTPUT ${_p_NAME}.localsha1
@@ -313,22 +307,22 @@ function( ecbuild_get_test_multidata )
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_p_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_get_test_data(): \"${_p_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_get_test_data(): \"${_p_UNPARSED_ARGUMENTS}\"")
endif()
### check parameters
if( NOT _p_NAMES )
- message(FATAL_ERROR "ecbuild_get_test_data() expects a NAMES")
+ ecbuild_critical("ecbuild_get_test_data() expects a NAMES")
endif()
if( NOT _p_TARGET )
- message(FATAL_ERROR "ecbuild_get_test_data() expects a TARGET")
+ ecbuild_critical("ecbuild_get_test_data() expects a TARGET")
endif()
-# debug_var( _p_TARGET )
-# debug_var( _p_NAME )
-# debug_var( _p_DIRNAME )
+# ecbuild_debug_var( _p_TARGET )
+# ecbuild_debug_var( _p_NAME )
+# ecbuild_debug_var( _p_DIRNAME )
if( _p_EXTRACT )
set( _extract EXTRACT )
@@ -372,11 +366,11 @@ endfunction()\n\n" )
set( _md5 MD5 ${_md5} )
endif()
- #debug_var(_f)
- #debug_var(_file)
- #debug_var(_dirname)
- #debug_var(_name)
- #debug_var(_md5)
+ #ecbuild_debug_var(_f)
+ #ecbuild_debug_var(_file)
+ #ecbuild_debug_var(_dirname)
+ #ecbuild_debug_var(_name)
+ #ecbuild_debug_var(_md5)
ecbuild_get_test_data(
TARGET __get_data_${_p_TARGET}_${_name}
diff --git a/cmake/ecbuild_git.cmake b/cmake/ecbuild_git.cmake
index 42124db..0a378a6 100644
--- a/cmake/ecbuild_git.cmake
+++ b/cmake/ecbuild_git.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -8,6 +8,8 @@
set( ECBUILD_GIT ON CACHE BOOL "Turn on/off ecbuild_git() function" )
+mark_as_advanced(ECBUILD_GIT)
+
if( ECBUILD_GIT )
find_package(Git)
@@ -78,15 +80,15 @@ macro( ecbuild_git )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if( DEFINED _PAR_BRANCH AND DEFINED _PAR_TAG )
- message( FATAL_ERROR "Cannot defined both BRANCH and TAG in macro ecbuild_git" )
+ ecbuild_critical( "Cannot defined both BRANCH and TAG in macro ecbuild_git" )
endif()
if( _PAR_UPDATE AND _PAR_NOREMOTE )
- message( FATAL_ERROR "Cannot pass both NOREMOTE and UPDATE in macro ecbuild_git" )
+ ecbuild_critical( "Cannot pass both NOREMOTE and UPDATE in macro ecbuild_git" )
endif()
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_git(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_git(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( ECBUILD_GIT )
@@ -100,15 +102,15 @@ macro( ecbuild_git )
if( NOT EXISTS "${_PAR_DIR}" )
- message( STATUS "Cloning ${_PAR_PROJECT} from ${_PAR_URL} into ${_PAR_DIR}...")
+ ecbuild_info( "Cloning ${_PAR_PROJECT} from ${_PAR_URL} into ${_PAR_DIR}...")
execute_process(
COMMAND ${GIT_EXECUTABLE} "clone" ${_PAR_URL} ${clone_args} ${_PAR_DIR} "-q"
RESULT_VARIABLE nok ERROR_VARIABLE error
WORKING_DIRECTORY "${PARENT_DIR}")
if(nok)
- message(FATAL_ERROR "${_PAR_DIR} git clone failed: ${error}\n")
+ ecbuild_critical("${_PAR_DIR} git clone failed:\n ${GIT_EXECUTABLE} clone ${_PAR_URL} ${clone_args} ${_PAR_DIR} -q\n ${error}\n")
endif()
- message( STATUS "${_PAR_DIR} retrieved.")
+ ecbuild_info( "${_PAR_DIR} retrieved.")
set( _needs_switch 1 )
endif()
@@ -122,7 +124,7 @@ macro( ecbuild_git )
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${ABS_PAR_DIR}" )
if(nok)
- message(STATUS "git rev-parse HEAD on ${_PAR_DIR} failed:\n ${error}")
+ ecbuild_info("git rev-parse HEAD on ${_PAR_DIR} failed:\n ${error}")
endif()
execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
@@ -130,10 +132,9 @@ macro( ecbuild_git )
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${ABS_PAR_DIR}" )
if( nok OR _current_branch STREQUAL "" )
- message(STATUS "git rev-parse --abbrev-ref HEAD on ${_PAR_DIR} failed:\n ${error}")
+ ecbuild_info("git rev-parse --abbrev-ref HEAD on ${_PAR_DIR} failed:\n ${error}")
endif()
- #message(STATUS "git describe --exact-match --abbrev=0 @ ${ABS_PAR_DIR}")
execute_process( COMMAND ${GIT_EXECUTABLE} describe --exact-match --abbrev=0
OUTPUT_VARIABLE _current_tag RESULT_VARIABLE nok ERROR_VARIABLE error
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE
@@ -143,18 +144,17 @@ macro( ecbuild_git )
unset( _current_tag )
else()
if( nok )
- message(STATUS "git describe --exact-match --abbrev=0 on ${_PAR_DIR} failed:\n ${error}")
+ ecbuild_info("git describe --exact-match --abbrev=0 on ${_PAR_DIR} failed:\n ${error}")
endif()
endif()
if( NOT _current_tag ) # try nother method
- #message(STATUS "git name-rev --tags --name-only @ ${ABS_PAR_DIR}")
execute_process( COMMAND ${GIT_EXECUTABLE} name-rev --tags --name-only ${_sha1}
OUTPUT_VARIABLE _current_tag RESULT_VARIABLE nok ERROR_VARIABLE error
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${ABS_PAR_DIR}" )
if( nok OR _current_tag STREQUAL "" )
- message(STATUS "git name-rev --tags --name-only on ${_PAR_DIR} failed:\n ${error}")
+ ecbuild_info("git name-rev --tags --name-only on ${_PAR_DIR} failed:\n ${error}")
endif()
endif()
@@ -183,20 +183,11 @@ macro( ecbuild_git )
if( _needs_switch AND IS_DIRECTORY "${_PAR_DIR}/.git" )
- # debug_here( ABS_PAR_DIR )
- # debug_here( _sha1 )
- # debug_here( _current_branch )
- # debug_here( _current_tag )
- # debug_here( _PAR_TAG )
- # debug_here( _PAR_BRANCH )
- # debug_here( _needs_switch )
- # debug_here( _PAR_UPDATE )
-
if( DEFINED _PAR_BRANCH )
set ( _gitref ${_PAR_BRANCH} )
- message(STATUS "Updating ${_PAR_PROJECT} to head of BRANCH ${_PAR_BRANCH}...")
+ ecbuild_info("Updating ${_PAR_PROJECT} to head of BRANCH ${_PAR_BRANCH}...")
else()
- message(STATUS "Updating ${_PAR_PROJECT} to TAG ${_PAR_TAG}...")
+ ecbuild_info("Updating ${_PAR_PROJECT} to TAG ${_PAR_TAG}...")
set ( _gitref ${_PAR_TAG} )
endif()
@@ -204,34 +195,34 @@ macro( ecbuild_git )
if( NOT _PAR_NOREMOTE )
- message(STATUS "git fetch --all @ ${ABS_PAR_DIR}")
+ ecbuild_info("git fetch --all @ ${ABS_PAR_DIR}")
execute_process( COMMAND "${GIT_EXECUTABLE}" fetch --all -q
RESULT_VARIABLE nok ERROR_VARIABLE error
WORKING_DIRECTORY "${ABS_PAR_DIR}")
if(nok)
- message(STATUS "git fetch --all in ${_PAR_DIR} failed:\n ${error}")
+ ecbuild_warn("git fetch --all in ${_PAR_DIR} failed:\n ${error}")
endif()
- message(STATUS "git fetch --all --tags @ ${ABS_PAR_DIR}")
+ ecbuild_info("git fetch --all --tags @ ${ABS_PAR_DIR}")
execute_process( COMMAND "${GIT_EXECUTABLE}" fetch --all --tags -q
RESULT_VARIABLE nok ERROR_VARIABLE error
WORKING_DIRECTORY "${ABS_PAR_DIR}")
if(nok)
- message(STATUS "git fetch --all --tags in ${_PAR_DIR} failed:\n ${error}")
+ ecbuild_warn("git fetch --all --tags in ${_PAR_DIR} failed:\n ${error}")
endif()
else()
- message(STATUS "${_PAR_DIR} marked NOREMOTE : Skipping git fetch")
+ ecbuild_info("${_PAR_DIR} marked NOREMOTE : Skipping git fetch")
endif()
# checking out gitref
- message(STATUS "git checkout ${_gitref} @ ${ABS_PAR_DIR}")
+ ecbuild_info("git checkout ${_gitref} @ ${ABS_PAR_DIR}")
execute_process( COMMAND "${GIT_EXECUTABLE}" checkout -q "${_gitref}"
RESULT_VARIABLE nok ERROR_VARIABLE error
WORKING_DIRECTORY "${ABS_PAR_DIR}")
if(nok)
- message(FATAL_ERROR "git checkout ${_gitref} on ${_PAR_DIR} failed:\n ${error}")
+ ecbuild_critical("git checkout ${_gitref} on ${_PAR_DIR} failed:\n ${GIT_EXECUTABLE} checkout -q ${_gitref}\n ${error}")
endif()
if( DEFINED _PAR_BRANCH AND _PAR_UPDATE ) #############################################################################
@@ -240,7 +231,7 @@ macro( ecbuild_git )
RESULT_VARIABLE nok ERROR_VARIABLE error
WORKING_DIRECTORY "${ABS_PAR_DIR}")
if(nok)
- message(STATUS "git pull of branch ${_PAR_BRANCH} on ${_PAR_DIR} failed:\n ${error}")
+ ecbuild_warn("git pull of branch ${_PAR_BRANCH} on ${_PAR_DIR} failed:\n ${error}")
endif()
endif() ####################################################################################
diff --git a/cmake/ecbuild_install_project.cmake b/cmake/ecbuild_install_project.cmake
index d53f110..2ba472e 100644
--- a/cmake/ecbuild_install_project.cmake
+++ b/cmake/ecbuild_install_project.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -33,7 +33,7 @@
# the project with cpack and exports the configuration and targets for other
# projects to use.
#
-# In a top-level project, the following files are generated:
+# Unless ECBUILD_SKIP_<PNAME>_EXPORT is set, the following files are generated:
#
# :<project>-config.cmake: default project configuration
# :<project>-config-version.cmake: project version number
@@ -49,7 +49,7 @@
# and ``<project>-config-version.cmake``.
#
# In DEVELOPER_MODE, the build tree location is also added to the CMake user
-# package registry.
+# package registry for top level projects.
#
# If the project is added as a subdirectory, the following CMake variables
# are set in the parent scope:
@@ -70,7 +70,6 @@
#
##############################################################################
-
macro( ecbuild_install_project )
set( options )
@@ -80,11 +79,22 @@ macro( ecbuild_install_project )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_install_project(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_install_project(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_NAME )
- message(FATAL_ERROR "The call to ecbuild_install_project() doesn't specify the NAME.")
+ ecbuild_critical("The call to ecbuild_install_project() doesn't specify the NAME.")
+ endif()
+
+ ### EXTRA TARGETS #####################################################
+
+ # added here to avoid adding another macro call at the end of each project,
+
+ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
+
+ ecbuild_define_libs_and_execs_targets()
+ ecbuild_define_links_target()
+
endif()
### PACKAGING ########################################################
@@ -160,6 +170,8 @@ macro( ecbuild_install_project )
PATHS ${ECBUILD_MACROS_DIR}/../toolchains
${ECBUILD_MACROS_DIR}/../share/ecbuild/toolchains )
+ mark_as_advanced( ECBUILD_TOOLCHAIN_DIR )
+
if( ECBUILD_TOOLCHAIN_DIR )
list( APPEND CPACK_SOURCE_INSTALLED_DIRECTORIES "${ECBUILD_TOOLCHAIN_DIR}" "share/ecbuild/toolchains/" )
endif()
@@ -169,6 +181,8 @@ macro( ecbuild_install_project )
PATHS ${ECBUILD_MACROS_DIR}/../bin
${ECBUILD_MACROS_DIR}/../../../bin )
+ mark_as_advanced( ECBUILD_SCRIPT )
+
if( ECBUILD_SCRIPT )
get_filename_component( ECBUILD_BIN_DIR ${ECBUILD_SCRIPT} PATH )
list( APPEND CPACK_SOURCE_INSTALLED_DIRECTORIES "${ECBUILD_BIN_DIR}" "bin/" )
@@ -187,7 +201,7 @@ macro( ecbuild_install_project )
set( ${PNAME}_HAVE_${_f} 1 )
endforeach()
- message( STATUS "${PROJECT_NAME_CAPS}_TPLS: ${${PROJECT_NAME_CAPS}_TPLS}" )
+ ecbuild_info( "${PROJECT_NAME_CAPS}_TPLS: ${${PROJECT_NAME_CAPS}_TPLS}" )
foreach( _tpl ${${PNAME}_TPLS} )
string( TOUPPER ${_tpl} _TPL )
@@ -219,16 +233,9 @@ macro( ecbuild_install_project )
endif()
endforeach()
- # TOP-LEVEL PROJECT EXPORT
-
- if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
-
- # exports the package for use from the build-tree but only in DEVELOPER_MODE
- # inserts <package> into the CMake user package registry
-
- if( DEVELOPER_MODE )
- export( PACKAGE ${PROJECT_NAME} )
- endif()
+ # Generate the project .cmake config files
+ # All variables here must be (sub)project specific in order to work within bundles
+ if ( NOT ECBUILD_SKIP_${PNAME}_EXPORT )
set( _template_config "${ECBUILD_MACROS_DIR}/project-config.cmake.in" )
if( EXISTS ${LNAME}-config.cmake.in )
@@ -242,7 +249,9 @@ macro( ecbuild_install_project )
# project-config-version.cmake -- format ([0-9]+).([0-9]+).([0-9]+)
- set( PACKAGE_VERSION "${${PNAME}_VERSION}" )
+ set( PACKAGE_VERSION "${${PNAME}_VERSION}" )
+ set( PACKAGE_GIT_SHA1 "${${PNAME}_GIT_SHA1}" )
+ set( PACKAGE_GIT_SHA1_SHORT "${${PNAME}_GIT_SHA1_SHORT}" )
configure_file( "${_template_config_version}" "${PROJECT_BINARY_DIR}/${LNAME}-config-version.cmake" @ONLY )
@@ -297,6 +306,7 @@ macro( ecbuild_install_project )
# If <project>-import.cmake.in exist in source tree, configure it to
# the build tree and install the configured version
if( EXISTS "${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}.in" )
+ ecbuild_debug( "Found ${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}.in - configuring to ${PROJECT_BINARY_DIR}/${CONF_IMPORT_FILE}" )
configure_file( "${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}.in"
"${PROJECT_BINARY_DIR}/${CONF_IMPORT_FILE}" @ONLY )
install( FILES "${PROJECT_BINARY_DIR}/${CONF_IMPORT_FILE}"
@@ -304,10 +314,13 @@ macro( ecbuild_install_project )
# Otherwise, if <project>-import.cmake exist in source tree, copy it to
# the build tree and install it
elseif( EXISTS "${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}" )
+ ecbuild_debug( "Found ${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE} - copying to ${PROJECT_BINARY_DIR}/${CONF_IMPORT_FILE}" )
configure_file( "${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}"
"${PROJECT_BINARY_DIR}/${CONF_IMPORT_FILE}" COPYONLY )
install( FILES "${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}"
DESTINATION "${INSTALL_CMAKE_DIR}" )
+ else()
+ ecbuild_debug( "No ${CONF_IMPORT_FILE} found in ${PROJECT_SOURCE_DIR}" )
endif()
set( _lname_config "${PROJECT_BINARY_DIR}/${LNAME}-config.cmake")
@@ -318,13 +331,28 @@ macro( ecbuild_install_project )
file( REMOVE ${_lname_config}.tpls.in )
foreach( _tpl ${${PNAME}_TPLS} )
+
string( TOUPPER ${_tpl} TPL )
- if( ${TPL}_IMPORT_FILE )
+
+ if( ${TPL}_IMPORT_FILE ) # ecBuild packages should trigger this if they export themselves
+
+ ecbuild_debug( "Adding TPL ${TPL} import file to ${_lname_config}.tpls.in" )
set( __import_file "${${TPL}_IMPORT_FILE}" )
file( APPEND "${_lname_config}.tpls.in" "if( NOT ${TPL}_IMPORT_FILE )\n" )
file( APPEND "${_lname_config}.tpls.in" " include( \"${__import_file}\" OPTIONAL )\n" )
file( APPEND "${_lname_config}.tpls.in" "endif()\n" )
+
+ elseif( ${TPL}_CONFIG ) # cmake built packages (e.g. CGAL) may have exported their targets
+
+ ecbuild_debug( "Adding TPL ${TPL} import file to ${_lname_config}.tpls.in" )
+ set( __import_file "${${TPL}_CONFIG}" )
+ file( APPEND "${_lname_config}.tpls.in" "if( NOT ${TPL}_CONFIG )\n" )
+ file( APPEND "${_lname_config}.tpls.in" " include( \"${__import_file}\" OPTIONAL )\n" )
+ file( APPEND "${_lname_config}.tpls.in" " set( ${TPL}_CONFIG \"${__import_file}\" )\n" )
+ file( APPEND "${_lname_config}.tpls.in" "endif()\n" )
+
endif()
+
endforeach()
if( EXISTS "${_lname_config}.tpls.in" )
@@ -361,14 +389,30 @@ macro( ecbuild_install_project )
# install the export
if( ${PROJECT_NAME}_ALL_EXES OR ${PROJECT_NAME}_ALL_LIBS )
- install( EXPORT ${CMAKE_PROJECT_NAME}-targets DESTINATION "${INSTALL_CMAKE_DIR}" )
+ install( EXPORT ${PROJECT_NAME}-targets
+ DESTINATION "${INSTALL_CMAKE_DIR}" )
+ endif()
+
+ endif() # if ( NOT ECBUILD_SKIP_${PNAME}_EXPORT )
+
+ # exports the package for use from the build-tree but only in DEVELOPER_MODE
+ # inserts <package> into the CMake user package registry
+
+ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
+
+ if( DEVELOPER_MODE )
+ export( PACKAGE ${PROJECT_NAME} )
endif()
else()
+ # export variables for upper projects
+
set( ${PNAME}_FOUND TRUE PARENT_SCOPE )
set( ${PROJECT_NAME}_FOUND TRUE PARENT_SCOPE )
set( ${PNAME}_VERSION ${${PNAME}_VERSION} PARENT_SCOPE )
+ set( ${PNAME}_GIT_SHA1 ${${PNAME}_GIT_SHA1} PARENT_SCOPE )
+ set( ${PNAME}_GIT_SHA1_SHORT ${${PNAME}_GIT_SHA1_SHORT} PARENT_SCOPE )
set( ${PROJECT_NAME}_VERSION ${${PNAME}_VERSION} PARENT_SCOPE )
set( ${PNAME}_INCLUDE_DIRS ${${PNAME}_INCLUDE_DIRS} PARENT_SCOPE )
set( ${PNAME}_LIBRARIES ${${PNAME}_LIBRARIES} PARENT_SCOPE )
@@ -382,6 +426,7 @@ macro( ecbuild_install_project )
foreach( _f ${${PNAME}_FEATURES} )
set( ${PNAME}_HAVE_${_f} ${${PNAME}_HAVE_${_f}} PARENT_SCOPE )
endforeach()
- endif()
+
+ endif()
endmacro( ecbuild_install_project )
diff --git a/cmake/ecbuild_list_add_pattern.cmake b/cmake/ecbuild_list_add_pattern.cmake
new file mode 100644
index 0000000..0f68217
--- /dev/null
+++ b/cmake/ecbuild_list_add_pattern.cmake
@@ -0,0 +1,102 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_list_add_pattern
+# ========================
+#
+# Exclude items from a list that match a list of patterns. ::
+#
+# ecbuild_list_add_pattern( LIST <input_list>
+# GLOB <pattern1> [ <pattern2> ... ]
+# [ SOURCE_DIR <source_dir> ]
+# [ QUIET ] )
+#
+# Options
+# -------
+#
+# LIST : required
+# list variable to be appended to
+#
+# GLOB : required
+# Regex pattern of exclusion
+#
+# SOURCE_DIR : optional
+# Directory from where to start search
+#
+# QUIET : optional
+# Don't warn if patterns don't match
+#
+##############################################################################
+
+function( ecbuild_list_add_pattern )
+
+ set( options QUIET )
+ set( single_value_args LIST SOURCE_DIR )
+ set( multi_value_args GLOB )
+
+ cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
+
+ if(_p_UNPARSED_ARGUMENTS)
+ ecbuild_critical("Unknown keywords given to ecbuild_list_add_pattern(): \"${_p_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ if( NOT _p_LIST )
+ ecbuild_critical("The call to ecbuild_list_add_pattern() doesn't specify the LIST.")
+ endif()
+
+ if( NOT _p_GLOB )
+ ecbuild_critical("The call to ecbuild_list_add_pattern() doesn't specify the GLOB.")
+ endif()
+
+ #####
+
+ set( input_list ${${_p_LIST}} )
+ unset( matched_files )
+
+ foreach( pattern ${_p_GLOB} )
+
+ if( IS_ABSOLUTE ${pattern} )
+ ecbuild_debug( "ecbuild_list_add_pattern: Adding ${pattern}" )
+ file( GLOB_RECURSE matched_files ${pattern} )
+ else()
+
+ if(_p_SOURCE_DIR)
+ if( IS_ABSOLUTE ${_p_SOURCE_DIR} )
+ ecbuild_debug( "ecbuild_list_add_pattern: Adding ${_p_SOURCE_DIR}/${pattern}" )
+ file( GLOB_RECURSE matched_files ${_p_SOURCE_DIR}/${pattern} )
+ else()
+ ecbuild_debug( "ecbuild_list_add_pattern: Adding ${_p_SOURCE_DIR}/${pattern}" )
+ file( GLOB_RECURSE matched_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${_p_SOURCE_DIR}/${pattern} )
+ endif()
+ else()
+ ecbuild_debug( "ecbuild_list_add_pattern: Adding ${pattern} ")
+ file( GLOB_RECURSE matched_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${pattern} )
+ endif()
+
+ endif()
+
+ if(matched_files)
+ ecbuild_debug( "ecbuild_list_add_pattern: Found ${matched_files}" )
+ list( APPEND input_list ${matched_files} )
+ list( REMOVE_DUPLICATES input_list )
+ set( ${_p_LIST} ${input_list} PARENT_SCOPE )
+ else()
+ if(NOT _p_QUIET)
+ ecbuild_warn( "ecbuild_list_add_pattern: no matches found for patterns ${pattern}" )
+ else()
+ ecbuild_debug( "ecbuild_list_add_pattern:no matches found for patterns ${pattern}" )
+ endif()
+ endif()
+
+ endforeach()
+
+
+endfunction(ecbuild_list_add_pattern)
diff --git a/cmake/ecbuild_list_exclude_pattern.cmake b/cmake/ecbuild_list_exclude_pattern.cmake
new file mode 100644
index 0000000..7e02f47
--- /dev/null
+++ b/cmake/ecbuild_list_exclude_pattern.cmake
@@ -0,0 +1,88 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_list_exclude_pattern
+# ============================
+#
+# Exclude items from a list that match a list of patterns. ::
+#
+# ecbuild_list_exclude_pattern( LIST <input_list>
+# REGEX <regex1> [ <regex2> ... ]
+# [ QUIET ] )
+#
+# Options
+# -------
+#
+# LIST : required
+# list variable to be cleaned
+#
+# REGEX : required
+# Regex pattern of exclusions
+#
+# QUIET : optional
+# Don't warn if patterns don't match
+#
+##############################################################################
+
+function( ecbuild_list_exclude_pattern )
+
+ set( options QUIET )
+ set( single_value_args LIST )
+ set( multi_value_args REGEX )
+
+ cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
+
+ if(_p_UNPARSED_ARGUMENTS)
+ ecbuild_critical("Unknown keywords given to ecbuild_list_exclude_pattern(): \"${_p_UNPARSED_ARGUMENTS}\"")
+ endif()
+
+ if( NOT _p_LIST )
+ ecbuild_critical("The call to ecbuild_list_exclude_pattern() doesn't specify the LIST.")
+ endif()
+
+ if( NOT _p_REGEX )
+ ecbuild_critical("The call to ecbuild_list_exclude_pattern() doesn't specify the REGEX.")
+ endif()
+
+ #####
+
+ set( result "" )
+ set( matches_found 0 )
+
+ # ecbuild_debug_var(_p_REGEX)
+
+ foreach( item ${${_p_LIST}} )
+
+ set( _keep 1 )
+
+ foreach( pattern ${_p_REGEX} )
+ if( ${item} MATCHES ${pattern} )
+ set( _keep 0 )
+ set( matches_found 1 )
+ endif()
+ endforeach()
+ if( _keep )
+ list( APPEND result ${item} )
+# else()
+# ecbuild_warn( "removing ${item}" )
+ endif()
+
+ endforeach()
+
+ if( matches_found )
+ set( ${_p_LIST} ${result} PARENT_SCOPE )
+ else()
+ if( NOT _p_QUIET )
+ ecbuild_warn( "ecbuild_list_exclude_pattern: no matches found for patterns ${_p_REGEX} in ${_p_LIST}" )
+ endif()
+ endif()
+
+endfunction(ecbuild_list_exclude_pattern)
diff --git a/cmake/ecbuild_list_extra_search_paths.cmake b/cmake/ecbuild_list_extra_search_paths.cmake
index 0768a48..b81f062 100644
--- a/cmake/ecbuild_list_extra_search_paths.cmake
+++ b/cmake/ecbuild_list_extra_search_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -14,11 +14,11 @@
function( ecbuild_list_extra_search_paths pkg var )
- message( DEPRECATION " ecbuild_list_extra_search_paths should no longer be"
- " used and is going to be removed in a future version of ecBuild." )
+ ecbuild_deprecate( " ecbuild_list_extra_search_paths should no longer be"
+ " used and is going to be removed in a future version of ecBuild." )
- # debug_var( pkg )
- # debug_var( var )
+ # ecbuild_debug_var( pkg )
+ # ecbuild_debug_var( var )
string( TOUPPER ${pkg} _PKG )
@@ -75,7 +75,7 @@ function( ecbuild_list_extra_search_paths pkg var )
ecbuild_debug("ecbuild_list_extra_search_paths(${pkg}): setting ${var} to ${${var}}")
set( ${var} ${${var}} PARENT_SCOPE )
-# debug_var( ${var} )
+# ecbuild_debug_var( ${var} )
endfunction()
diff --git a/cmake/ecbuild_list_macros.cmake b/cmake/ecbuild_list_macros.cmake
index a4152c7..176a161 100644
--- a/cmake/ecbuild_list_macros.cmake
+++ b/cmake/ecbuild_list_macros.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-#
+# (C) Copyright 1996-2016 ECMWF.
+#
# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
@@ -56,35 +56,3 @@ function( MAP_GET _map _key _var )
set( ${_var} "${_${_map}_${_key}}" PARENT_SCOPE )
endfunction(MAP_GET)
-##############################################################################
-# function to remove items from a list that match a list of patterns
-#
-# examples:
-#
-# ecbuild_list_remove_pattern( mylist "foo;bar" VAR )
-#
-
-function(ecbuild_list_remove_pattern _list _patterns _var)
-
-#debug_var( _list )
-#debug_var( _patterns )
-#debug_var( _var )
-
- foreach( _elem ${_list} )
- set( _keep TRUE)
- foreach( _pat ${_patterns} )
- if( ${_elem} MATCHES ${_pat} )
- set( _keep FALSE)
- endif()
- endforeach()
- if( _keep )
- list( APPEND _result ${_elem} )
- endif()
-
- endforeach()
-
-#debug_var( _result )
-
- set( ${_var} "${_result}" PARENT_SCOPE )
-
-endfunction(ecbuild_list_remove_pattern)
diff --git a/cmake/ecbuild_log.cmake b/cmake/ecbuild_log.cmake
index fbb2349..ec99495 100644
--- a/cmake/ecbuild_log.cmake
+++ b/cmake/ecbuild_log.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -12,30 +12,52 @@
# Logging
# =======
#
-# ecBuild provides macros for logging based on a log level set by the user,
+# ecBuild provides functions for logging based on a log level set by the user,
# similar to the Python logging module:
#
-# :ecbuild_debug: logs a ``STATUS`` message if log level <= ``DEBUG``
-# :ecbuild_info: logs a ``STATUS`` message if log level <= ``INFO``
-# :ecbuild_warn: logs a ``WARNING`` message if log level <= ``WARN``
-# :ecbuild_error: logs a ``SEND_ERROR`` message if log level <= ``ERROR``
-# :ecbuild_critical: logs a ``FATAL_ERROR`` message if log level <= ``CRITICAL``
+# :ecbuild_debug: logs a ``STATUS`` message if log level <= ``DEBUG``
+# :ecbuild_info: logs a ``STATUS`` message if log level <= ``INFO``
+# :ecbuild_warn: logs a ``WARNING`` message if log level <= ``WARN``
+# :ecbuild_error: logs a ``SEND_ERROR`` message if log level <= ``ERROR``
+# :ecbuild_critical: logs a ``FATAL_ERROR`` message if log level <= ``CRITICAL``
+# :ecbuild_deprecate: logs a ``DEPRECATION`` message
+#
+# Furthermore there are auxilliary functions for outputting CMake variables,
+# CMake lists and environment variables if the log level is ``DEBUG``:
+#
+# :ecbuild_debug_var: logs given CMake variables if log level <= ``DEBUG``
+# :ecbuild_debug_list: logs given CMake lists if log level <= ``DEBUG``
+# :ecbuild_debug_env_var: logs given environment variables if log level <= ``DEBUG``
+#
+# To log a message to the ecBuild log file only at a given log level, use ::
+#
+# ecbuild_log( <level> <msg> )
#
# Input variables
# ---------------
#
# CMake variables controlling logging behaviour:
#
+# ECBUILD_LOG_FILE : path
+# set the log file, defaults to ``${CMAKE_BINARY_DIR}/ecbuild.log``
+#
+# All ecBuild log functions write their messages to this log file with a time
+# stamp. Messages emitted by CMake directly cannot be logged to file.
+#
# ECBUILD_LOG_LEVEL : string, one of DEBUG, INFO, WARN, ERROR, CRITICAL, OFF
-# set the desired log level, OFF to disable logging altogether
+# desired log level, defaults to ``INFO``, ``OFF`` to disable logging
#
# ECBUILD_NO_COLOUR : bool
# if set, does not colour log output (by default log output is coloured)
#
+# ECBUILD_NO_DEPRECATIONS : bool
+# if set, does not output deprecation messages (only set this if you *really*
+# know what you are doing!)
+#
# Usage
# -----
#
-# The macros ``ecbuild_debug`` and ``ecbuild_info`` can be used to output
+# The functions ``ecbuild_debug`` and ``ecbuild_info`` can be used to output
# messages which are not printed by default. Many ecBuild macros use this
# facility to log debugging hints. When debugging a CMake run, users can use
# ``-DECBUILD_LOG_LEVEL=DEBUG`` to get detailed diagnostics.
@@ -70,7 +92,7 @@ set(ECBUILD_ERROR 40)
set(ECBUILD_CRITICAL 50)
if( NOT DEFINED ECBUILD_LOG_LEVEL )
- set(ECBUILD_LOG_LEVEL ${ECBUILD_WARN})
+ set(ECBUILD_LOG_LEVEL ${ECBUILD_INFO})
elseif( NOT ECBUILD_LOG_LEVEL )
set(ECBUILD_LOG_LEVEL 60)
elseif( ECBUILD_LOG_LEVEL STREQUAL "DEBUG" )
@@ -88,42 +110,147 @@ else()
set(ECBUILD_LOG_LEVEL ${ECBUILD_WARN})
endif()
+if( NOT DEFINED ECBUILD_LOG_FILE )
+ set( ECBUILD_LOG_FILE ${CMAKE_BINARY_DIR}/ecbuild.log )
+endif()
+
##############################################################################
-macro( ecbuild_debug MSG )
+function( ecbuild_log LEVEL )
+ string( REPLACE ";" " " MSG "${ARGN}" )
+ string( TIMESTAMP _time )
+ file( APPEND ${ECBUILD_LOG_FILE} "${_time} - ${LEVEL} - ${MSG}\n" )
+endfunction( ecbuild_log )
+
+##############################################################################
+
+function( ecbuild_debug )
+ string( REPLACE ";" " " MSG "${ARGV}" )
+ ecbuild_log(DEBUG "${MSG}")
if( ECBUILD_LOG_LEVEL LESS 11)
message(STATUS "${Blue}DEBUG - ${MSG}${ColourReset}")
endif()
-endmacro( ecbuild_debug )
+endfunction( ecbuild_debug )
##############################################################################
-macro( ecbuild_info MSG )
+function( ecbuild_info )
+ string( REPLACE ";" " " MSG "${ARGV}" )
+ ecbuild_log(INFO "${MSG}")
if( ECBUILD_LOG_LEVEL LESS 21)
- message(STATUS "${Green}INFO - ${MSG}${ColourReset}")
+ message(STATUS "${MSG}")
endif()
-endmacro( ecbuild_info )
+endfunction( ecbuild_info )
##############################################################################
-macro( ecbuild_warn MSG )
+function( ecbuild_warn )
+ string( REPLACE ";" " " MSG "${ARGV}" )
+ ecbuild_log(WARNING "${MSG}")
if( ECBUILD_LOG_LEVEL LESS 31)
message(WARNING "${Yellow}WARN - ${MSG}${ColourReset}")
endif()
-endmacro( ecbuild_warn )
+endfunction( ecbuild_warn )
##############################################################################
-macro( ecbuild_error MSG )
+function( ecbuild_error )
+ string( REPLACE ";" " " MSG "${ARGV}" )
+ ecbuild_log(ERROR "${MSG}")
if( ECBUILD_LOG_LEVEL LESS 41)
message(SEND_ERROR "${BoldRed}ERROR - ${MSG}${ColourReset}")
endif()
-endmacro( ecbuild_error )
+endfunction( ecbuild_error )
+
+##############################################################################
+
+function( ecbuild_deprecate )
+ string(REPLACE ";" " " MSG ${ARGV})
+ ecbuild_log(DEPRECATION "${MSG}")
+ if( NOT ECBUILD_NO_DEPRECATIONS )
+ message(DEPRECATION "${BoldRed}${MSG}${ColourReset}")
+ endif()
+endfunction( ecbuild_deprecate )
##############################################################################
-macro( ecbuild_critical MSG )
+function( ecbuild_critical )
+ string(REPLACE ";" " " MSG ${ARGV})
+ ecbuild_log(FATAL_ERROR "${MSG}")
if( ECBUILD_LOG_LEVEL LESS 51)
message(FATAL_ERROR "${BoldMagenta}CRITICAL - ${MSG}${ColourReset}")
endif()
-endmacro( ecbuild_critical )
+endfunction( ecbuild_critical )
+
+##############################################################################
+# function for debugging CMake variables
+
+function( ecbuild_debug_var )
+ foreach( VAR ${ARGV} )
+ ecbuild_log(DEBUG "${VAR} : ${${VAR}}")
+ if( ECBUILD_LOG_LEVEL LESS 11)
+ message(STATUS "${Blue}DEBUG - ${VAR} : ${${VAR}}${ColourReset}")
+ endif()
+ endforeach()
+endfunction()
+
+##############################################################################
+# function for debugging CMake lists
+
+function( ecbuild_debug_list )
+ foreach( VAR ${ARGV} )
+ ecbuild_log(DEBUG "${VAR} : ${${VAR}}")
+ foreach( _elem ${${VAR}} )
+ ecbuild_log( DEBUG " ${_elem}" )
+ endforeach()
+ if( ECBUILD_LOG_LEVEL LESS 11)
+ message( STATUS "${Blue}DEBUG - ${VAR}" )
+ foreach( _elem ${${VAR}} )
+ message( STATUS " ${_elem}" )
+ endforeach()
+ message(STATUS "${ColourReset}")
+ endif()
+ endforeach()
+endfunction()
+
+##############################################################################
+# function for debugging environment variables
+
+function( ecbuild_debug_env_var )
+ foreach( VAR ${ARGV} )
+ ecbuild_log(DEBUG "ENV ${VAR} : $ENV{${VAR}}")
+ if( ECBUILD_LOG_LEVEL LESS 11)
+ message(STATUS "${Blue}DEBUG - ENV ${VAR} [$ENV{${VAR}}]${ColourReset}")
+ endif()
+ endforeach()
+endfunction()
+
+##############################################################################
+# macro for debugging a cmake variable
+
+macro( debug_var VAR )
+
+ message( WARNING "DEPRECATED debug_var() -- ${VAR} [${${VAR}}]" )
+
+endmacro()
+
+##############################################################################
+# macro for debugging a cmake list
+
+macro( debug_list VAR )
+
+ message( WARNING "DEPRECATED debug_list() -- ${VAR}:" )
+ foreach( _elem ${${VAR}} )
+ message( WARNING " ${_elem}" )
+ endforeach()
+
+endmacro()
+
+##############################################################################
+# macro for debugging a environment variable within cmake
+
+macro( debug_env_var VAR )
+
+ message( WARNING "DEPRECATED debug_env_var() -- ENV ${VAR} [$ENV{${VAR}}]" )
+
+endmacro()
diff --git a/cmake/ecbuild_pkgconfig.cmake b/cmake/ecbuild_pkgconfig.cmake
index 6db3726..6f62977 100644
--- a/cmake/ecbuild_pkgconfig.cmake
+++ b/cmake/ecbuild_pkgconfig.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -312,7 +312,7 @@ function( ecbuild_pkgconfig )
string( TOLOWER ${PROJECT_NAME} LNAME )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_add_executable(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_add_executable(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
unset( PKGCONFIG_LANGUAGES )
@@ -412,7 +412,7 @@ function( ecbuild_pkgconfig )
endif()
configure_file( ${_PAR_TEMPLATE} "${CMAKE_BINARY_DIR}/${_PAR_FILENAME}" @ONLY )
- message( STATUS "pkg-config file created: ${_PAR_FILENAME}" )
+ ecbuild_info( "pkg-config file created: ${_PAR_FILENAME}" )
install( FILES ${CMAKE_BINARY_DIR}/${_PAR_FILENAME}
DESTINATION ${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}/pkgconfig/
diff --git a/cmake/ecbuild_policies.cmake b/cmake/ecbuild_policies.cmake
index 06f856b..36ab7fe 100644
--- a/cmake/ecbuild_policies.cmake
+++ b/cmake/ecbuild_policies.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -6,13 +6,17 @@
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
-###############################################################################
-# define cmake policies
+##############################################################################
+#
+# ecBuild Policies
+# ================
#
# NOTE: This file needs to be included with NO_POLICY_SCOPE or it will have no
# effect!
# NOTE: Policies 1 through 17 will be set to NEW by requiring CMake 2.8.4 i.e.
# calling cmake_minimum_required( VERSION 2.8.4 FATAL_ERROR )
+#
+##############################################################################
# allow for empty spaces around library names
if( POLICY CMP0004 )
diff --git a/cmake/ecbuild_print_summary.cmake b/cmake/ecbuild_print_summary.cmake
index d4bffba..4cf05cc 100644
--- a/cmake/ecbuild_print_summary.cmake
+++ b/cmake/ecbuild_print_summary.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -28,9 +28,9 @@ macro( ecbuild_print_summary )
if( EXISTS ${PROJECT_SOURCE_DIR}/project_summary.cmake )
- message( STATUS "---------------------------------------------------------" )
- message( STATUS "Project ${PROJECT_NAME} summary" )
- message( STATUS "---------------------------------------------------------" )
+ ecbuild_info( "---------------------------------------------------------" )
+ ecbuild_info( "Project ${PROJECT_NAME} summary" )
+ ecbuild_info( "---------------------------------------------------------" )
include( ${PROJECT_SOURCE_DIR}/project_summary.cmake )
@@ -38,58 +38,56 @@ macro( ecbuild_print_summary )
if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
- ecbuild_define_links_target()
-
get_property( langs GLOBAL PROPERTY ENABLED_LANGUAGES )
- message( STATUS "---------------------------------------------------------" )
+ ecbuild_info( "---------------------------------------------------------" )
if( NOT ${DEVELOPER_MODE} )
- message( STATUS "Build summary" )
+ ecbuild_info( "Build summary" )
else()
- message( STATUS "Build summary -- ( DEVELOPER_MODE )" )
+ ecbuild_info( "Build summary -- ( DEVELOPER_MODE )" )
endif()
- message( STATUS "---------------------------------------------------------" )
+ ecbuild_info( "---------------------------------------------------------" )
- message( STATUS "system : [${BUILD_SITE}] [${CMAKE_SYSTEM}] [${EC_OS_NAME}.${EC_OS_BITS}]" )
- message( STATUS "processor : [${CMAKE_SYSTEM_PROCESSOR}]" )
+ ecbuild_info( "system : [${BUILD_SITE}] [${CMAKE_SYSTEM}] [${EC_OS_NAME}.${EC_OS_BITS}]" )
+ ecbuild_info( "processor : [${CMAKE_SYSTEM_PROCESSOR}]" )
if( EC_BIG_ENDIAN )
- message( STATUS "endiness : Big Endian -- IEEE [${IEEE_BE}]" )
+ ecbuild_info( "endiness : Big Endian -- IEEE [${IEEE_BE}]" )
endif()
if( EC_LITTLE_ENDIAN )
- message( STATUS "endiness : Little Endian -- IEEE [${IEEE_LE}]" )
+ ecbuild_info( "endiness : Little Endian -- IEEE [${IEEE_LE}]" )
endif()
- message( STATUS "build type : [${CMAKE_BUILD_TYPE}]" )
- message( STATUS "timestamp : [${EC_BUILD_TIMESTAMP}]" )
- message( STATUS "install prefix : [${CMAKE_INSTALL_PREFIX}]" )
+ ecbuild_info( "build type : [${CMAKE_BUILD_TYPE}]" )
+ ecbuild_info( "timestamp : [${EC_BUILD_TIMESTAMP}]" )
+ ecbuild_info( "install prefix : [${CMAKE_INSTALL_PREFIX}]" )
if( EC_LINK_DIR )
- message( STATUS "links prefix : [${EC_LINK_DIR}]" )
+ ecbuild_info( "links prefix : [${EC_LINK_DIR}]" )
endif()
- message( STATUS "---------------------------------------------------------" )
+ ecbuild_info( "---------------------------------------------------------" )
foreach( lang ${langs} )
- message( STATUS "${lang} -- ${CMAKE_${lang}_COMPILER_ID} ${CMAKE_${lang}_COMPILER_VERSION}" )
- message( STATUS " compiler : ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_FLAGS} ${CMAKE_${lang}_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}" )
- message( STATUS " link flags : ${CMAKE_${lang}_LINK_FLAGS}" )
+ ecbuild_info( "${lang} -- ${CMAKE_${lang}_COMPILER_ID} ${CMAKE_${lang}_COMPILER_VERSION}" )
+ ecbuild_info( " compiler : ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_FLAGS} ${CMAKE_${lang}_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}" )
+ ecbuild_info( " link flags : ${CMAKE_${lang}_LINK_FLAGS}" )
endforeach()
- message( STATUS "linker : ${CMAKE_LINKER}")
- message( STATUS "ar : ${CMAKE_AR}")
- message( STATUS "ranlib : ${CMAKE_RANLIB}")
- message( STATUS "link flags" )
- message( STATUS " executable [${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
- message( STATUS " shared lib [${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
- message( STATUS " static lib [${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
- message( STATUS "install rpath : ${CMAKE_INSTALL_RPATH}" )
+ ecbuild_info( "linker : ${CMAKE_LINKER}")
+ ecbuild_info( "ar : ${CMAKE_AR}")
+ ecbuild_info( "ranlib : ${CMAKE_RANLIB}")
+ ecbuild_info( "link flags" )
+ ecbuild_info( " executable [${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
+ ecbuild_info( " shared lib [${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
+ ecbuild_info( " static lib [${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
+ ecbuild_info( "install rpath : ${CMAKE_INSTALL_RPATH}" )
get_directory_property( defs COMPILE_DEFINITIONS )
- message( STATUS "common definitions: ${defs}" )
+ ecbuild_info( "common definitions: ${defs}" )
- message( STATUS "---------------------------------------------------------" )
+ ecbuild_info( "---------------------------------------------------------" )
### FEATURE SUMMARY
- # debug_var( CMAKE_VERSION )
+ # ecbuild_debug_var( CMAKE_VERSION )
if( ${CMAKE_VERSION} VERSION_LESS "2.8.6" )
feature_summary( WHAT ALL )
else()
@@ -101,6 +99,6 @@ macro( ecbuild_print_summary )
# issue warnings / errors in case there are unused project files
ecbuild_warn_unused_files()
- endif( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
+ endif()
endmacro( ecbuild_print_summary )
diff --git a/cmake/ecbuild_project_files.cmake b/cmake/ecbuild_project_files.cmake
index fbf3015..3e4b3d2 100644
--- a/cmake/ecbuild_project_files.cmake
+++ b/cmake/ecbuild_project_files.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-#
+# (C) Copyright 1996-2016 ECMWF.
+#
# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-# In applying this licence, ECMWF does not waive the privileges and immunities
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
@@ -50,7 +50,7 @@ macro( ecbuild_declare_project_files )
if( CHECK_UNUSED_FILES )
foreach( _afile ${ARGV} )
- # debug_var( _afile )
+ # ecbuild_debug_var( _afile )
get_property( _src_gen SOURCE ${_afile} PROPERTY GENERATED )
@@ -62,7 +62,7 @@ macro( ecbuild_declare_project_files )
if( EXISTS ${_abspath} )
list( REMOVE_ITEM EC_UNUSED_FILES ${_abspath} )
else()
- message( FATAL_ERROR "In directory ${CMAKE_CURRENT_SOURCE_DIR} file ${_afile} was declared in CMakeLists.txt but not found" )
+ ecbuild_critical( "In directory ${CMAKE_CURRENT_SOURCE_DIR} file ${_afile} was declared in CMakeLists.txt but not found" )
endif()
endif()
diff --git a/cmake/ecbuild_remove_fortran_flags.cmake b/cmake/ecbuild_remove_fortran_flags.cmake
new file mode 100644
index 0000000..74c8832
--- /dev/null
+++ b/cmake/ecbuild_remove_fortran_flags.cmake
@@ -0,0 +1,61 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_remove_fortran_flags
+# =========================
+#
+# Remove Fortran compiler flags from CMAKE_Fortran_FLAGS. ::
+#
+# ecbuild_remove_fortran_flags( <flag1> [ <flag2> ... ] [ BUILD <build> ] )
+#
+# Options
+# -------
+#
+# BUILD : optional
+# remove flags from ``CMAKE_Fortran_FLAGS_<build>`` instead of
+# ``CMAKE_Fortran_FLAGS``
+#
+##############################################################################
+
+include( CheckFortranCompilerFlag )
+macro( ecbuild_remove_fortran_flags m_flags )
+
+ set( _flags ${m_flags} )
+ if( _flags AND CMAKE_Fortran_COMPILER_LOADED )
+
+ set( single_value_args BUILD )
+ set( multi_value_args )
+ cmake_parse_arguments( _PAR "" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
+
+ string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_CAPS )
+ string( TOUPPER ${_PAR_BUILD} _PAR_BUILD_CAPS )
+
+ if( _PAR_BUILD AND (CMAKE_BUILD_TYPE_CAPS MATCHES "${_PAR_BUILD_CAPS}") )
+
+ foreach( _flag ${_flags} )
+ string(REGEX REPLACE " *${_flag} *" " " CMAKE_Fortran_FLAGS_${_PAR_BUILD} ${CMAKE_Fortran_FLAGS_${_PAR_BUILD}})
+ ecbuild_debug( "Fortran FLAG [${_flag}] removed from build type ${_PAR_BUILD}" )
+ endforeach()
+
+ elseif( NOT _PAR_BUILD )
+
+ foreach( _flag ${_flags} )
+ string(REGEX REPLACE " *${_flag} *" " " CMAKE_Fortran_FLAGS ${CMAKE_Fortran_FLAGS} )
+ ecbuild_debug( "Fortran FLAG [${_flag}] removed" )
+ endforeach()
+
+ endif()
+
+ endif()
+ unset( _flags )
+
+endmacro()
+
diff --git a/cmake/ecbuild_requires_macro_version.cmake b/cmake/ecbuild_requires_macro_version.cmake
index ef13d64..1603446 100644
--- a/cmake/ecbuild_requires_macro_version.cmake
+++ b/cmake/ecbuild_requires_macro_version.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -21,7 +21,7 @@
macro( ecbuild_requires_macro_version req_vrs )
if( ECBUILD_MACRO_VERSION VERSION_LESS ${req_vrs} )
- message( FATAL_ERROR "${PROJECT_NAME} needs ecbuild macro version >= ${req_vrs}" )
+ ecbuild_critical( "${PROJECT_NAME} needs ecbuild macro version >= ${req_vrs}" )
endif()
endmacro()
diff --git a/cmake/ecbuild_separate_sources.cmake b/cmake/ecbuild_separate_sources.cmake
index 55c6d8f..b56db63 100644
--- a/cmake/ecbuild_separate_sources.cmake
+++ b/cmake/ecbuild_separate_sources.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -48,15 +48,15 @@ macro( ecbuild_separate_sources )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_PAR_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_separate_sources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_separate_sources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _PAR_TARGET )
- message(FATAL_ERROR "The call to ecbuild_separate_sources() doesn't specify the TARGET.")
+ ecbuild_critical("The call to ecbuild_separate_sources() doesn't specify the TARGET.")
endif()
if( NOT _PAR_SOURCES )
- message(FATAL_ERROR "The call to ecbuild_separate_sources() doesn't specify the SOURCES.")
+ ecbuild_critical("The call to ecbuild_separate_sources() doesn't specify the SOURCES.")
endif()
foreach( src ${_PAR_SOURCES} )
@@ -83,9 +83,9 @@ macro( ecbuild_separate_sources )
endif()
endforeach()
-# debug_var( ${_PAR_TARGET}_h_srcs )
-# debug_var( ${_PAR_TARGET}_c_srcs )
-# debug_var( ${_PAR_TARGET}_cxx_srcs )
-# debug_var( ${_PAR_TARGET}_f_srcs )
+# ecbuild_debug_var( ${_PAR_TARGET}_h_srcs )
+# ecbuild_debug_var( ${_PAR_TARGET}_c_srcs )
+# ecbuild_debug_var( ${_PAR_TARGET}_cxx_srcs )
+# ecbuild_debug_var( ${_PAR_TARGET}_f_srcs )
endmacro( ecbuild_separate_sources )
diff --git a/cmake/ecbuild_setup_test_framework.cmake b/cmake/ecbuild_setup_test_framework.cmake
index 538a433..c14b2f9 100644
--- a/cmake/ecbuild_setup_test_framework.cmake
+++ b/cmake/ecbuild_setup_test_framework.cmake
@@ -2,7 +2,7 @@ ecbuild_add_option( FEATURE TESTS
DEFAULT ON
DESCRIPTION "Enable the unit tests" )
-if( ENABLE_TESTS )
+if( ENABLE_TESTS AND CMAKE_CXX_COMPILER_LOADED )
# Try to find compiled boost
@@ -23,11 +23,11 @@ if( ENABLE_TESTS )
set( HAVE_BOOST_UNIT_TEST 1 )
set( BOOST_UNIT_TEST_FRAMEWORK_LINKED 1 )
- message( STATUS "Using Boost for unit tests:\n INC [${Boost_INCLUDE_DIRS}]\n LIB [${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}]" )
+ ecbuild_info( "Using Boost for unit tests:\n INC [${Boost_INCLUDE_DIRS}]\n LIB [${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}]" )
else()
- message( STATUS "Boost unit test framework -- NOT FOUND" )
+ ecbuild_info( "Boost unit test framework -- NOT FOUND" )
set( HAVE_BOOST_UNIT_TEST 0 )
@@ -39,3 +39,7 @@ if( ENABLE_TESTS )
endif()
endif()
+
+if( NOT ENABLE_TESTS )
+ ecbuild_info("Tests have been disabled")
+endif()
diff --git a/cmake/ecbuild_source_flags.cmake b/cmake/ecbuild_source_flags.cmake
new file mode 100644
index 0000000..2414765
--- /dev/null
+++ b/cmake/ecbuild_source_flags.cmake
@@ -0,0 +1,30 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+set( __gen_source_flags ${CMAKE_CURRENT_LIST_DIR}/gen_source_flags.py )
+
+# Calls gen_source_flags.py to generate a CMake file with the per
+# source file flags for a given target.
+function( ecbuild_source_flags OUT TARGET DEFAULT_FLAGS SOURCES )
+
+ if( NOT PYTHONINTERP_FOUND OR PYTHON_VERSION VERSION_LESS 2.7 )
+ find_package( PythonInterp 2.7 REQUIRED )
+ endif()
+
+ set( OUTFILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_source_flags.cmake )
+
+ if( ECBUILD_LOG_LEVEL LESS 11)
+ set( __debug "--debug" )
+ endif()
+ execute_process( COMMAND ${PYTHON_EXECUTABLE} ${__gen_source_flags}
+ ${ECBUILD_SOURCE_FLAGS} ${OUTFILE} "${DEFAULT_FLAGS}"
+ ${SOURCES} "${__debug}" )
+
+ set( ${OUT} ${OUTFILE} PARENT_SCOPE )
+
+endfunction()
diff --git a/cmake/ecbuild_system.cmake b/cmake/ecbuild_system.cmake
index ca4f4fa..a4361f7 100644
--- a/cmake/ecbuild_system.cmake
+++ b/cmake/ecbuild_system.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -28,7 +28,7 @@ endif()
########################################################################################################
# ecbuild versioning support
-set( ECBUILD_CMAKE_MINIMUM "2.8.4" )
+set( ECBUILD_CMAKE_MINIMUM "2.8.10" )
if( ${CMAKE_VERSION} VERSION_LESS ${ECBUILD_CMAKE_MINIMUM} )
message(FATAL_ERROR "${PROJECT_NAME} requires at least CMake ${ECBUILD_CMAKE_MINIMUM} -- you are using ${CMAKE_COMMAND} [${CMAKE_VERSION}]\n Please, get a newer version of CMake @ www.cmake.org" )
endif()
@@ -59,16 +59,23 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
set( ECBUILD_PROJECTS "" CACHE INTERNAL "list of ecbuild (sub)projects that use ecbuild" )
- message( STATUS "ecbuild ${ecbuild_VERSION_STR}\t${ECBUILD_MACROS_DIR}" )
- message( STATUS "cmake ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}\t${CMAKE_COMMAND}" )
+ # Include log macros since these are used right away
+ include( ecbuild_log )
+
+ ecbuild_info( "ecbuild ${ecbuild_VERSION_STR}\t${ECBUILD_MACROS_DIR}" )
+ ecbuild_info( "cmake ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}\t${CMAKE_COMMAND}" )
if( CMAKE_TOOLCHAIN_FILE )
- message( STATUS "toolchain ${CMAKE_TOOLCHAIN_FILE}" )
+ ecbuild_info( "toolchain ${CMAKE_TOOLCHAIN_FILE}" )
+ endif()
+
+ if( ECBUILD_CONFIG )
+ ecbuild_info( "config ${ECBUILD_CONFIG}" )
endif()
if( ECBUILD_CACHE )
- include( ${ECBUILD_CACHE} )
- message( STATUS "cache ${ECBUILD_CACHE}" )
+ include( ${ECBUILD_CACHE} )
+ ecbuild_info( "cache ${ECBUILD_CACHE}" )
endif()
message( STATUS "---------------------------------------------------------" )
@@ -93,7 +100,7 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
enable_testing()
# keep this until we modify the meaning to 'check' if installation worked
- add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND} -V )
+ add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND} )
############################################################################################
# define valid build types
@@ -121,19 +128,19 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
# include(CMakePrintSystemInformation) # available in cmake 2.8.4
if( CMAKE_CXX_COMPILER_LOADED )
- include(CheckIncludeFileCXX)
- include(CheckCXXCompilerFlag)
- include(CheckCXXSourceCompiles)
- include(CheckCXXSourceRuns)
+ include(CheckIncludeFileCXX)
+ include(CheckCXXCompilerFlag)
+ include(CheckCXXSourceCompiles)
+ include(CheckCXXSourceRuns)
endif()
if( CMAKE_Fortran_COMPILER_LOADED )
set( CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/module CACHE PATH "directory for all fortran modules." )
- include(CheckFortranFunctionExists)
- if( CMAKE_C_COMPILER_LOADED AND ENABLE_FORTRAN_C_INTERFACE )
- include(FortranCInterface)
- endif()
- set( EC_HAVE_FORTRAN 1 )
+ include(CheckFortranFunctionExists)
+ if( CMAKE_C_COMPILER_LOADED AND ENABLE_FORTRAN_C_INTERFACE )
+ include(FortranCInterface)
+ endif()
+ set( EC_HAVE_FORTRAN 1 )
endif()
include(FeatureSummary) # support features in cmake
@@ -144,17 +151,17 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
# backport of cmake > 2.8.4 functions
if( "${CMAKE_VERSION}" VERSION_LESS "2.8.6" )
- include( ${CMAKE_CURRENT_LIST_DIR}/2.8/CMakePushCheckState.cmake )
+ include( ${CMAKE_CURRENT_LIST_DIR}/2.8/CMakePushCheckState.cmake )
else()
- include(CMakePushCheckState)
+ include(CMakePushCheckState)
endif()
############################################################################################
# add our macros
- include( ecbuild_debug_var )
- include( ecbuild_log )
include( ecbuild_list_macros )
+ include( ecbuild_list_add_pattern )
+ include( ecbuild_list_exclude_pattern )
include( ecbuild_check_c_source_return )
include( ecbuild_check_cxx_source_return )
@@ -167,6 +174,7 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
include( ecbuild_generate_config_headers )
include( ecbuild_generate_rpc )
include( ecbuild_generate_yy )
+ include( ecbuild_generate_fortran_interfaces )
include( ecbuild_echo_targets )
include( ecbuild_features )
include( ecbuild_add_option )
@@ -202,30 +210,38 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
include( ecbuild_find_fortranlibs )
include( ecbuild_git )
include( ecbuild_enable_fortran )
+ include( ecbuild_source_flags )
include( ecbuild_bundle )
include( ecbuild_pkgconfig )
include( ecbuild_cache )
+ include( ecbuild_remove_fortran_flags )
include( ${CMAKE_CURRENT_LIST_DIR}/contrib/GetGitRevisionDescription.cmake )
############################################################################################
# kickstart the build system
- ecbuild_prepare_cache()
+ if( ECBUILD_CONFIG )
+ include( ${ECBUILD_CONFIG} )
+ endif()
+
+ ecbuild_prepare_cache()
include( ecbuild_define_options ) # define build options
+ include( ecbuild_compiler_flags ) # compiler flags
include( ecbuild_check_compiler ) # check for compiler characteristics
include( ecbuild_check_os ) # check for os characteristics
include( ecbuild_check_functions ) # check for available functions
- include( ecbuild_define_paths ) # define installation paths
- include( ecbuild_links_target ) # define the links target
+ include( ecbuild_define_paths ) # defines installation paths
+ include( ecbuild_define_libs_and_execs_target ) # defines the top level execs and libs
+ include( ecbuild_define_links_target ) # defines the links target
include( ecbuild_setup_test_framework ) # setup test framework
include( ecbuild_define_uninstall ) # define uninstall target
ecbuild_flush_cache()
############################################################################################
- # define the build timestamp
+ # define the build timestamp, unless the user provided one via EC_BUILD_TIMESTAMP
if( NOT DEFINED EC_BUILD_TIMESTAMP )
ecbuild_get_timestamp( EC_BUILD_TIMESTAMP )
@@ -234,5 +250,17 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
message( STATUS "---------------------------------------------------------" )
-endif()
+else()
+ # Allow subprojects with different compilation flags. This could be done by defining
+ # set( ECBUILD_C_FLAGS_DEBUG "-O0" )
+ # or
+ # set( ECBUILD_CONFIG "<subproject-config>.cmake" )
+ if( ECBUILD_CONFIG )
+ message( STATUS "---------------------------------------------------------" )
+ ecbuild_info( "config ${ECBUILD_CONFIG}" )
+ include( ${ECBUILD_CONFIG} )
+ endif()
+ include( ecbuild_compiler_flags )
+
+endif()
diff --git a/cmake/ecbuild_use_package.cmake b/cmake/ecbuild_use_package.cmake
index acbe495..6bd2bed 100644
--- a/cmake/ecbuild_use_package.cmake
+++ b/cmake/ecbuild_use_package.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -87,15 +87,15 @@ macro( ecbuild_use_package )
cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
if(_p_UNPARSED_ARGUMENTS)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_use_package(): \"${_p_UNPARSED_ARGUMENTS}\"")
+ ecbuild_critical("Unknown keywords given to ecbuild_use_package(): \"${_p_UNPARSED_ARGUMENTS}\"")
endif()
if( NOT _p_PROJECT )
- message(FATAL_ERROR "The call to ecbuild_use_package() doesn't specify the PROJECT.")
+ ecbuild_critical("The call to ecbuild_use_package() doesn't specify the PROJECT.")
endif()
if( _p_EXACT AND NOT _p_VERSION )
- message(FATAL_ERROR "Call to ecbuild_use_package() requests EXACT but doesn't specify VERSION.")
+ ecbuild_critical("Call to ecbuild_use_package() requests EXACT but doesn't specify VERSION.")
endif()
# try to find the package as a subproject and build it
@@ -105,6 +105,7 @@ macro( ecbuild_use_package )
# user defined dir with subprojects
if( NOT DEFINED ${pkgUPPER}_SOURCE AND DEFINED SUBPROJECT_DIRS )
+ ecbuild_warn("ecbuild_use_package(): setting SUBPROJECT_DIRS is deprecated")
ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): scanning subproject directories ${SUBPROJECT_DIRS}")
foreach( dir ${SUBPROJECT_DIRS} )
if( EXISTS ${dir}/${_p_PROJECT} AND EXISTS ${dir}/${_p_PROJECT}/CMakeLists.txt )
@@ -119,7 +120,7 @@ macro( ecbuild_use_package )
if( DEFINED ${pkgUPPER}_SOURCE )
if( NOT EXISTS ${${pkgUPPER}_SOURCE} OR NOT EXISTS ${${pkgUPPER}_SOURCE}/CMakeLists.txt )
- message( FATAL_ERROR "User defined source directory '${${pkgUPPER}_SOURCE}' for project '${_p_PROJECT}' does not exist or does not contain a CMakeLists.txt file." )
+ ecbuild_critical("User defined source directory '${${pkgUPPER}_SOURCE}' for project '${_p_PROJECT}' does not exist or does not contain a CMakeLists.txt file.")
endif()
set( ${pkgUPPER}_subproj_dir_ "${${pkgUPPER}_SOURCE}" )
@@ -187,6 +188,8 @@ macro( ecbuild_use_package )
set( ${pkgUPPER}_FOUND 1 )
set( ${_p_PROJECT}_VERSION ${${pkgUPPER}_VERSION} )
+ list( APPEND ${pkgUPPER}_INCLUDE_DIRS ${${pkgUPPER}_TPL_INCLUDE_DIRS} )
+
endif()
endif()
@@ -198,7 +201,7 @@ macro( ecbuild_use_package )
ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 2) project was already added as subproject, check version is acceptable")
if( NOT ${pkgUPPER}_FOUND )
- message( FATAL_ERROR "${_p_PROJECT} was already included as sub-project but ${pkgUPPER}_FOUND isn't set -- this is likely a BUG in ecbuild" )
+ ecbuild_critical( "${_p_PROJECT} was already included as sub-project but ${pkgUPPER}_FOUND isn't set -- this is likely a BUG in ecbuild" )
endif()
# check version is acceptable
@@ -221,26 +224,26 @@ macro( ecbuild_use_package )
# test version for Cases 1,2,3
- # debug_var( _p_PROJECT )
- # debug_var( _p_VERSION )
- # debug_var( ${pkgUPPER}_VERSION )
- # debug_var( ${_p_PROJECT}_VERSION )
- # debug_var( _just_added )
- # debug_var( _do_version_check )
- # debug_var( _source_description )
- # debug_var( ${pkgUPPER}_FOUND )
- # debug_var( ${pkgUPPER}_previous_subproj_ )
+ # ecbuild_debug_var( _p_PROJECT )
+ # ecbuild_debug_var( _p_VERSION )
+ # ecbuild_debug_var( ${pkgUPPER}_VERSION )
+ # ecbuild_debug_var( ${_p_PROJECT}_VERSION )
+ # ecbuild_debug_var( _just_added )
+ # ecbuild_debug_var( _do_version_check )
+ # ecbuild_debug_var( _source_description )
+ # ecbuild_debug_var( ${pkgUPPER}_FOUND )
+ # ecbuild_debug_var( ${pkgUPPER}_previous_subproj_ )
if( _p_VERSION AND _do_version_check )
if( _p_EXACT )
if( NOT ${_p_PROJECT}_VERSION VERSION_EQUAL _p_VERSION )
- message( FATAL_ERROR "${PROJECT_NAME} requires (exactly) ${_p_PROJECT} = ${_p_VERSION} -- detected as ${_source_description} ${${_p_PROJECT}_VERSION}" )
+ ecbuild_critical( "${PROJECT_NAME} requires (exactly) ${_p_PROJECT} = ${_p_VERSION} -- detected as ${_source_description} ${${_p_PROJECT}_VERSION}" )
endif()
else()
if( _p_VERSION VERSION_LESS ${_p_PROJECT}_VERSION OR _p_VERSION VERSION_EQUAL ${_p_PROJECT}_VERSION )
- message( STATUS "${PROJECT_NAME} requires ${_p_PROJECT} >= ${_p_VERSION} -- detected as ${_source_description} ${${_p_PROJECT}_VERSION}" )
+ ecbuild_info( "${PROJECT_NAME} requires ${_p_PROJECT} >= ${_p_VERSION} -- detected as ${_source_description} ${${_p_PROJECT}_VERSION}" )
else()
- message( FATAL_ERROR "${PROJECT_NAME} requires ${_p_PROJECT} >= ${_p_VERSION} -- detected only ${_source_description} ${${_p_PROJECT}_VERSION}" )
+ ecbuild_critical( "${PROJECT_NAME} requires ${_p_PROJECT} >= ${_p_VERSION} -- detected only ${_source_description} ${${_p_PROJECT}_VERSION}" )
endif()
endif()
endif()
diff --git a/cmake/ecbuild_version.h.in b/cmake/ecbuild_version.h.in
index 3ed96ce..70c5f0a 100644
--- a/cmake/ecbuild_version.h.in
+++ b/cmake/ecbuild_version.h.in
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 1996-2015 ECMWF.
+ * (C) Copyright 1996-2016 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/ecbuild_warn_unused_files.cmake b/cmake/ecbuild_warn_unused_files.cmake
index 084adb3..314a006 100644
--- a/cmake/ecbuild_warn_unused_files.cmake
+++ b/cmake/ecbuild_warn_unused_files.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -48,24 +48,24 @@ macro( ecbuild_warn_unused_files )
# if unused files where found, put the list on the file
if( EC_UNUSED_FILES )
- message( STATUS "")
- message( STATUS " !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
- message( STATUS " !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
- message( STATUS "")
- message( STATUS " Unused source files found:")
+ ecbuild_info("")
+ ecbuild_info(" !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
+ ecbuild_info(" !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
+ ecbuild_info("")
+ ecbuild_info(" Unused source files found:")
foreach( AFILE ${EC_UNUSED_FILES} )
- message( STATUS " ${AFILE}")
+ ecbuild_info(" ${AFILE}")
file( APPEND ${UNUSED_FILE} "${AFILE}\n" )
endforeach()
- message( STATUS "")
- message( STATUS " List dumped to ${UNUSED_FILE}")
- message( STATUS "")
- message( STATUS " !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
- message( STATUS " !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
- message( STATUS "")
+ ecbuild_info("")
+ ecbuild_info(" List dumped to ${UNUSED_FILE}")
+ ecbuild_info("")
+ ecbuild_info(" !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
+ ecbuild_info(" !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
+ ecbuild_info("")
if( UNUSED_FILES_LEVEL STREQUAL "ERROR" )
- message( FATAL_ERROR "\n Aborted build system configuration. \n Add unused files to the build system or remove them." )
+ ecbuild_critical( "\n Aborted build system configuration. \n Add unused files to the build system or remove them." )
endif()
endif()
diff --git a/cmake/fcm-make-interfaces.cfg b/cmake/fcm-make-interfaces.cfg
new file mode 100644
index 0000000..a73363a
--- /dev/null
+++ b/cmake/fcm-make-interfaces.cfg
@@ -0,0 +1,31 @@
+# FCM configuration file used to auto-generate interface files
+# for F77 and F90 files.
+# Interface files will have the extention ".intfb.h"
+# Results will be in a directory "interfaces/include" relative to cwd
+
+# Usage: fcm make --config-file=<path -to-this-file> \
+# interfaces.ns-incl="<space-sep-list-of-dirs>"
+
+$SRC{?} = $HERE
+
+step.class[interfaces] = build
+steps = interfaces
+
+interfaces.target{task} = ext-iface
+interfaces.target{category} = include
+
+interfaces.source = $SRC
+
+# Exclude all
+interfaces.ns-excl = /
+
+# Include some
+# interfaces.ns-incl = <list of dirs passed at command-line>
+
+# Extention of interface files
+interfaces.prop{file-ext.f90-interface} = .intfb.h
+
+# Do not follow includes
+interfaces.prop{no-dep.f.module} = *
+interfaces.prop{no-dep.include} = *
+
diff --git a/cmake/gen_source_flags.py b/cmake/gen_source_flags.py
new file mode 100644
index 0000000..b976d31
--- /dev/null
+++ b/cmake/gen_source_flags.py
@@ -0,0 +1,84 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+"""
+Generate .cmake file to set source-file specific compiler flags based on
+rules defined in a JSON file.
+"""
+
+from argparse import ArgumentParser
+from fnmatch import fnmatch
+import logging
+from json import JSONDecoder
+from os import path
+
+log = logging.getLogger('gen_source_flags')
+
+
+def match(source, pattern, op, flags, indent=0):
+ if fnmatch(source, pattern):
+
+ suff = '' if op[0] in ('+', '=', '/') else ' (nested pattern)'
+ log.debug('%s-> pattern "%s" matches "%s"%s',
+ ' ' * (indent + 1), pattern, source, suff)
+
+ if op[0] == "+":
+ flags += [flag for flag in op[1:] if flag not in flags]
+ log.debug('%sappending %s --> flags: %s', ' ' * (indent + 2), op[1:], flags)
+
+ elif op[0] == "=":
+ flags = op[1:]
+ log.debug('%ssetting %s --> flags: %s', ' ' * (indent + 2), op[1:], flags)
+
+ elif op[0] == "/":
+ flags = [flag for flag in flags if flag not in op[1:]]
+ log.debug('%sremoving %s --> flags: %s', ' ' * (indent + 2), op[1:], flags)
+
+ else: # Nested rule
+ log.debug('%sapplying nested rules for "%s" (flags: %s)',
+ ' ' * (indent + 2), pattern, flags)
+ for nested_pattern, nested_op in op:
+ flags = match(source, nested_pattern, nested_op, flags, indent + 2)
+
+ return flags
+
+
+def generate(rules, out, default_flags, sources, debug=False):
+ logging.basicConfig(level=logging.DEBUG if debug else logging.INFO,
+ format='-- %(levelname)s - %(name)s: %(message)s')
+
+ with open(path.expanduser(rules)) as f:
+ rules = JSONDecoder(object_pairs_hook=list).decode(f.read())
+
+ with open(path.expanduser(out), 'w') as f:
+ for source in sources:
+ log.debug('%s (default flags: "%s")', source, default_flags)
+ flags = default_flags.split()
+ for pattern, op in rules:
+ flags = match(source, pattern, op, flags)
+
+ if flags:
+ log.debug(' ==> setting flags for %s to %s', source, ' '.join(flags))
+ f.write('set_source_files_properties(%s PROPERTIES COMPILE_FLAGS "%s")\n'
+ % (source, ' '.join(flags)))
+ else:
+ log.debug(' ==> flags for %s empty', source)
+
+
+def main():
+ """Parse arguments"""
+ parser = ArgumentParser(description=__doc__)
+ parser.add_argument('rules', metavar='RULES.json', help='JSON rules file')
+ parser.add_argument('out', metavar='OUT.cmake', help='CMake script to generate')
+ parser.add_argument('default_flags', help='Default compiler flags to use')
+ parser.add_argument('sources', metavar='file', nargs='+', help='Path to file to apply rules to')
+ parser.add_argument('--debug', '-d', action='store_true', help='Log debug messages')
+ generate(**vars(parser.parse_args()))
+
+if __name__ == '__main__':
+ main()
diff --git a/cmake/include/ecbuild/boost_test_framework.h b/cmake/include/ecbuild/boost_test_framework.h
index 8cbd8e9..f593b70 100644
--- a/cmake/include/ecbuild/boost_test_framework.h
+++ b/cmake/include/ecbuild/boost_test_framework.h
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 1996-2015 ECMWF.
+ * (C) Copyright 1996-2016 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/cmake/project-config.cmake.in b/cmake/project-config.cmake.in
index 03f875b..6d48728 100644
--- a/cmake/project-config.cmake.in
+++ b/cmake/project-config.cmake.in
@@ -1,11 +1,13 @@
# Config file for the @PROJECT_NAME@ package
# Defines the following variables:
#
-# @PNAME at _INCLUDE_DIRS - include directories
-# @PNAME at _DEFINITIONS - preprocessor definitions
-# @PNAME at _LIBRARIES - libraries to link against
-# @PNAME at _FEATURES - list of enabled features
-# @PNAME at _VERSION - version of the package
+# @PNAME at _INCLUDE_DIRS - include directories
+# @PNAME at _DEFINITIONS - preprocessor definitions
+# @PNAME at _LIBRARIES - libraries to link against
+# @PNAME at _FEATURES - list of enabled features
+# @PNAME at _VERSION - version of the package
+# @PNAME at _GIT_SHA1 - Git revision of the package
+# @PNAME at _GIT_SHA1_SHORT - short Git revision of the package
#
# Also defines @PROJECT_NAME@ third-party library dependencies:
# @PNAME at _TPLS - package names of third-party library dependencies
@@ -26,12 +28,16 @@ set( @PNAME at _TPL_INCLUDE_DIRS "@CONF_TPL_INCLUDE_DIRS@" )
set( @PNAME at _TPL_DEFINITIONS "@CONF_TPL_DEFINITIONS@" )
set( @PNAME at _TPL_LIBRARIES "@CONF_TPL_LIBRARIES@" )
+set( @PNAME at _VERSION "@PACKAGE_VERSION@" )
+set( @PNAME at _GIT_SHA1 "@PACKAGE_GIT_SHA1@" )
+set( @PNAME at _GIT_SHA1_SHORT "@PACKAGE_GIT_SHA1_SHORT@" )
+
### export include paths as absolute paths
set( @PNAME at _INCLUDE_DIRS "" )
foreach( path ${@PNAME at _SELF_INCLUDE_DIRS} )
- get_filename_component( abspath ${path} ABSOLUTE )
- list( APPEND @PNAME at _INCLUDE_DIRS ${abspath} )
+ get_filename_component( abspath ${path} ABSOLUTE )
+ list( APPEND @PNAME at _INCLUDE_DIRS ${abspath} )
endforeach()
list( APPEND @PNAME at _INCLUDE_DIRS ${@PNAME at _TPL_INCLUDE_DIRS} )
@@ -47,7 +53,7 @@ set( @PNAME at _LIBRARIES ${@PNAME at _SELF_LIBRARIES} ${@PNAME at _TPL_LIBRARIE
set( @PNAME at _FEATURES "@CONF_FEATURES@" )
foreach( _f ${@PNAME at _FEATURES} )
- set( @PNAME at _HAVE_${_f} 1 )
+ set( @PNAME at _HAVE_${_f} 1 )
endforeach()
# Has this configuration been exported from a build tree?
@@ -58,22 +64,22 @@ if( EXISTS ${@PNAME at _CMAKE_DIR}/@CONF_IMPORT_FILE@ )
include( ${@PNAME at _IMPORT_FILE} )
endif()
+# here goes the imports of the TPL's
+
+include( ${CMAKE_CURRENT_LIST_FILE}.tpls OPTIONAL )
+
# insert definitions for IMPORTED targets
if( NOT @PROJECT_NAME at _BINARY_DIR )
if( @PNAME at _IS_BUILD_DIR_EXPORT )
- include( "@TOP_PROJECT_TARGETS_FILE@" OPTIONAL )
- else()
- include( "${@PNAME at _CMAKE_DIR}/@CMAKE_PROJECT_NAME at -targets.cmake" )
- endif()
+ include( "@TOP_PROJECT_TARGETS_FILE@" OPTIONAL )
+ else()
+ include( "${@PNAME at _CMAKE_DIR}/@PROJECT_NAME at -targets.cmake" )
+ endif()
endif()
-# here goes the imports of the TPL's
-
-include( ${CMAKE_CURRENT_LIST_FILE}.tpls OPTIONAL )
-
# publish this file as imported
set( @PNAME at _IMPORT_FILE ${CMAKE_CURRENT_LIST_FILE} )
@@ -82,9 +88,10 @@ mark_as_advanced( @PNAME at _IMPORT_FILE )
# set @PROJECT_NAME at _BASE_DIR for final installations or build directories
if( NOT @PROJECT_NAME@ )
- if( @PNAME at _IS_BUILD_DIR_EXPORT )
- set( @PROJECT_NAME at _BASE_DIR @CMAKE_BINARY_DIR@ )
- else()
- set( @PROJECT_NAME at _BASE_DIR @CMAKE_INSTALL_PREFIX@ )
- endif()
+ if( @PNAME at _IS_BUILD_DIR_EXPORT )
+ set( @PROJECT_NAME at _BASE_DIR @CMAKE_BINARY_DIR@ )
+ else()
+ get_filename_component( abspath ${CMAKE_CURRENT_LIST_DIR}/../../.. ABSOLUTE )
+ set( @PROJECT_NAME at _BASE_DIR ${abspath} )
+ endif()
endif()
diff --git a/cmake/sg.pl b/cmake/sg.pl
index 8a64bf4..6bce843 100755
--- a/cmake/sg.pl
+++ b/cmake/sg.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl
#!/usr/local/share/perl56
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/fc_type.grib b/fc_type.grib
deleted file mode 100755
index f794995..0000000
Binary files a/fc_type.grib and /dev/null differ
diff --git a/project_summary.cmake b/project_summary.cmake
index 95ccab6..ce240e5 100644
--- a/project_summary.cmake
+++ b/project_summary.cmake
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
if(Boost_FOUND)
message( STATUS " Boost include : [${Boost_INCLUDE_DIRS}]" )
endif()
diff --git a/python/Magics/Magics_interface.cc b/python/Magics/Magics_interface.cc
index d1ed8bb..d0e65b3 100755
--- a/python/Magics/Magics_interface.cc
+++ b/python/Magics/Magics_interface.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#include <magics_api.h>
void init() {
diff --git a/python/Magics/macro.py b/python/Magics/macro.py
index f15ed31..aa1fdca 100644
--- a/python/Magics/macro.py
+++ b/python/Magics/macro.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
import os
import Magics
import numpy
diff --git a/python/Magics/metgram.py b/python/Magics/metgram.py
index 56a27cc..ab87ef2 100644
--- a/python/Magics/metgram.py
+++ b/python/Magics/metgram.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
import simplejson
import tempfile
import os
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
index 1e12d66..52924b9 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
@@ -1,4 +1,12 @@
####################################################################
+# ARCHITECTURE
+####################################################################
+set( CMAKE_SIZEOF_VOID_P 8 )
+
+# Disable relative rpaths as aprun does not respect it
+set( ENABLE_RELATIVE_RPATHS OFF CACHE STRING "Disable relative rpaths" FORCE )
+
+####################################################################
# COMPILER
####################################################################
@@ -8,15 +16,19 @@ CMAKE_FORCE_C_COMPILER ( cc Cray )
CMAKE_FORCE_CXX_COMPILER ( CC Cray )
CMAKE_FORCE_Fortran_COMPILER ( ftn Cray )
-link_libraries("$ENV{CC_X86_64}/lib/x86-64/libcray-c++-rts.so")
-link_libraries("-lmpichf90_cray")
-link_libraries("-lmpichcxx_cray")
-
set( ECBUILD_FIND_MPI OFF )
set( ECBUILD_TRUST_FLAGS ON )
####################################################################
-# FLAGS COMMON TO ALL BUILD TYPES
+# MPI
+####################################################################
+
+set( MPIEXEC "aprun" )
+set( MPIEXEC_NUMPROC_FLAG "-n" )
+set( MPIEXEC_NUMTHREAD_FLAG "-d" )
+
+####################################################################
+# OpenMP FLAGS
####################################################################
set( OMP_C_FLAGS "-homp" )
@@ -27,49 +39,12 @@ set( OMPSTUBS_C_FLAGS "-hnoomp" )
set( OMPSTUBS_CXX_FLAGS "-hnoomp" )
set( OMPSTUBS_Fortran_FLAGS "-hnoomp" )
-set( CMAKE_C_FLAGS "" CACHE STRING "" FORCE )
-set( CMAKE_CXX_FLAGS "" CACHE STRING "" FORCE )
-set( CMAKE_Fortran_FLAGS "-emf -rmoid" CACHE STRING "" FORCE ) # -emf activates .mods and uses lower case -rmoid produces a listing file
-
-####################################################################
-# RELEASE FLAGS
-####################################################################
-
-set( ECBUILD_C_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-set( ECBUILD_CXX_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-set( ECBUILD_Fortran_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-
####################################################################
-# BIT REPRODUCIBLE FLAGS
+# Fortran FLAGS
####################################################################
-set( ECBUILD_C_FLAGS_BIT "-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1 -DNDEBUG" )
-set( ECBUILD_CXX_FLAGS_BIT "-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1 -DNDEBUG" )
-set( ECBUILD_Fortran_FLAGS_BIT "-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1 -DNDEBUG" )
-
-####################################################################
-# RELWITHDEBINFO FLAGS
-####################################################################
-
-set( ECBUILD_C_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
-set( ECBUILD_CXX_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
-set( ECBUILD_Fortran_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
-
-####################################################################
-# DEBUG FLAGS
-####################################################################
-
-set( ECBUILD_C_FLAGS_DEBUG "-O0 -G0" )
-set( ECBUILD_CXX_FLAGS_DEBUG "-O0 -G0" )
-set( ECBUILD_Fortran_FLAGS_DEBUG "-O0 -G0" )
-
-####################################################################
-# PRODUCTION FLAGS
-####################################################################
-
-set( ECBUILD_C_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
-set( ECBUILD_CXX_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
-set( ECBUILD_Fortran_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
+# -emf activates .mods and uses lower case -rmoid produces a listing file
+set( ECBUILD_Fortran_FLAGS "-emf -rmoid" )
####################################################################
# LINK FLAGS
@@ -78,4 +53,4 @@ set( ECBUILD_Fortran_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
set( ECBUILD_C_LINK_FLAGS "-Wl,-Map,loadmap -Wl,--as-needed -Ktrap=fp" )
set( ECBUILD_CXX_LINK_FLAGS "-Wl,-Map,loadmap -Wl,--as-needed -Ktrap=fp" )
set( ECBUILD_Fortran_LINK_FLAGS "-Wl,-Map,loadmap -Wl,--as-needed -Ktrap=fp" )
-
+set( ECBUILD_CXX_IMPLICIT_LINK_LIBRARIES "$ENV{CC_X86_64}/lib/x86-64/libcray-c++-rts.so" CACHE STRING "" )
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake b/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
index 3c890d5..3f69f06 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
@@ -1,4 +1,12 @@
####################################################################
+# ARCHITECTURE
+####################################################################
+set( CMAKE_SIZEOF_VOID_P 8 )
+
+# Disable relative rpaths as aprun does not respect it
+set( ENABLE_RELATIVE_RPATHS OFF CACHE STRING "Disable relative rpaths" FORCE )
+
+####################################################################
# COMPILER
####################################################################
@@ -12,56 +20,28 @@ set( ECBUILD_FIND_MPI OFF )
set( ECBUILD_TRUST_FLAGS ON )
####################################################################
-# FLAGS COMMON TO ALL BUILD TYPES
-####################################################################
-
-set( OMP_C_FLAGS "-fopenmp" )
-set( OMP_CXX_FLAGS "-fopenmp" )
-set( OMP_Fortran_FLAGS "-fopenmp" )
-
-set( CMAKE_C_FLAGS "" CACHE STRING "" FORCE )
-set( CMAKE_CXX_FLAGS "" CACHE STRING "" FORCE )
-set( CMAKE_Fortran_FLAGS "" CACHE STRING "" FORCE )
-
-####################################################################
-# RELEASE FLAGS
+# MPI
####################################################################
-#set( ECBUILD_C_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-#set( ECBUILD_CXX_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-#set( ECBUILD_Fortran_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
+set( MPIEXEC "aprun" )
+set( MPIEXEC_NUMPROC_FLAG "-n" )
+set( MPIEXEC_NUMTHREAD_FLAG "-d" )
####################################################################
-# BIT REPRODUCIBLE FLAGS
+# OpenMP FLAGS
####################################################################
-set( ECBUILD_C_FLAGS_BIT "-g -O2 -m64 -march=native -DNDEBUG" )
-set( ECBUILD_CXX_FLAGS_BIT "-g -O2 -m64 -march=native -DNDEBUG" )
-set( ECBUILD_Fortran_FLAGS_BIT "-g -O2 -m64 -march=native -DNDEBUG -fno-range-check -ffree-line-length-300 -fconvert=big-endian" )
-
-####################################################################
-# RELWITHDEBINFO FLAGS
-####################################################################
-
-#set( ECBUILD_C_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
-#set( ECBUILD_CXX_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
-#set( ECBUILD_Fortran_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
+set( OMP_C_FLAGS "-fopenmp" )
+set( OMP_CXX_FLAGS "-fopenmp" )
+set( OMP_Fortran_FLAGS "-fopenmp" )
####################################################################
# DEBUG FLAGS
####################################################################
-#set( ECBUILD_C_FLAGS_DEBUG "-O0 -G0" )
-#set( ECBUILD_CXX_FLAGS_DEBUG "-O0 -G0" )
-#set( ECBUILD_Fortran_FLAGS_DEBUG "-O0 -G0" )
-
-####################################################################
-# PRODUCTION FLAGS
-####################################################################
-
-#set( ECBUILD_C_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
-#set( ECBUILD_CXX_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
-#set( ECBUILD_Fortran_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
+set( ECBUILD_C_FLAGS_DEBUG "-O0 -g -ftrapv" )
+set( ECBUILD_CXX_FLAGS_DEBUG "-O0 -g -ftrapv" )
+set( ECBUILD_Fortran_FLAGS_DEBUG "-ffree-line-length-none -O0 -g -fcheck=bounds -fbacktrace -finit-real=snan -ffpe-trap=invalid,zero,overflow" )
####################################################################
# LINK FLAGS
@@ -70,4 +50,3 @@ set( ECBUILD_Fortran_FLAGS_BIT "-g -O2 -m64 -march=native -DNDEBUG -fno-range-c
set( ECBUILD_C_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
set( ECBUILD_CXX_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
set( ECBUILD_Fortran_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
-
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake b/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
index 485b122..01c6267 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
@@ -1,4 +1,13 @@
####################################################################
+# ARCHITECTURE
+####################################################################
+set( CMAKE_SIZEOF_VOID_P 8 )
+
+# Disable relative rpaths as aprun does not respect it
+set( ENABLE_RELATIVE_RPATHS OFF CACHE STRING "Disable relative rpaths" FORCE )
+
+
+####################################################################
# COMPILER
####################################################################
@@ -12,27 +21,31 @@ set( ECBUILD_FIND_MPI OFF )
set( ECBUILD_TRUST_FLAGS ON )
####################################################################
-# FLAGS COMMON TO ALL BUILD TYPES
+# MPI
####################################################################
-set( OMP_C_FLAGS "-qopenmp -qopenmp-threadprivate=compat -qopenmp-report=2 -qopt-report-phase=vec,openmp" )
-set( OMP_CXX_FLAGS "-qopenmp -qopenmp-threadprivate=compat -qopenmp-report=2 -qopt-report-phase=vec,openmp" )
-set( OMP_Fortran_FLAGS " -openmp -openmp-threadprivate=compat -openmp-report=2 -opt-report-phase=vec,openmp" ) # -[q] is missing on purpose, ifort does not take -q as flag
+set( MPIEXEC "aprun" )
+set( MPIEXEC_NUMPROC_FLAG "-n" )
+set( MPIEXEC_NUMTHREAD_FLAG "-d" )
-# for diagnostics:
-# -diag-enable=vec -diag-file -Winline
+####################################################################
+# OpenMP FLAGS
+####################################################################
-set( CMAKE_C_FLAGS "-fp-speculation=strict -fp-model precise -traceback" CACHE STRING "" FORCE )
-set( CMAKE_CXX_FLAGS "-fp-speculation=strict -fp-model precise -traceback" CACHE STRING "" FORCE )
-set( CMAKE_Fortran_FLAGS "-fp-speculation=strict -fp-model precise -convert big_endian -assume byterecl -traceback -fpe0" CACHE STRING "" FORCE )
+set( OMP_C_FLAGS "-openmp -openmp-threadprivate=compat" )
+set( OMP_CXX_FLAGS "-openmp -openmp-threadprivate=compat" )
+set( OMP_Fortran_FLAGS "-openmp -openmp-threadprivate=compat" )
####################################################################
-# RELEASE FLAGS
+# COMMON FLAGS
####################################################################
-#set( ECBUILD_C_FLAGS_RELEASE "not implemented" )
-#set( ECBUILD_CXX_FLAGS_RELEASE "not implemented" )
-#set( ECBUILD_Fortran_FLAGS_RELEASE "not implemented" )
+# for diagnostics:
+# -diag-enable=vec -diag-file -Winline
+
+set( ECBUILD_C_FLAGS "-fp-speculation=strict -fp-model precise -traceback")
+set( ECBUILD_CXX_FLAGS "-fp-speculation=strict -fp-model precise -traceback" )
+set( ECBUILD_Fortran_FLAGS "-fp-speculation=strict -fp-model source -convert big_endian -assume byterecl -traceback -fpe0" )
####################################################################
# BIT REPRODUCIBLE FLAGS
@@ -43,28 +56,13 @@ set( ECBUILD_CXX_FLAGS_BIT "-O2 -xAVX -finline-function -finline-limit=500"
set( ECBUILD_Fortran_FLAGS_BIT "-O2 -xAVX -finline-function -finline-limit=500 -align array64byte" )
####################################################################
-# RELWITHDEBINFO FLAGS
-####################################################################
-
-#set( ECBUILD_C_FLAGS_RELWITHDEBINFO "not implemented" )
-#set( ECBUILD_CXX_FLAGS_RELWITHDEBINFO "not implemented" )
-#set( ECBUILD_Fortran_FLAGS_RELWITHDEBINFO "not implemented" )
-
-####################################################################
# DEBUG FLAGS
####################################################################
-set( ECBUILD_C_FLAGS_DEBUG "-g -O0" )
-set( ECBUILD_CXX_FLAGS_DEBUG "-g -O0" )
-set( ECBUILD_Fortran_FLAGS_DEBUG "-g -O0" ) # ??? -align array64byte
-
-####################################################################
-# PRODUCTION FLAGS
-####################################################################
-
-#set( ECBUILD_C_FLAGS_PRODUCTION "not implemented" )
-#set( ECBUILD_CXX_FLAGS_PRODUCTION "not implemented" )
-#set( ECBUILD_Fortran_FLAGS_PRODUCTION "not implemented" )
+set( ECBUILD_C_FLAGS_DEBUG "-O0 -g -traceback -fp-trap=common" )
+set( ECBUILD_CXX_FLAGS_DEBUG "-O0 -g -traceback -fp-trap=common" )
+# -check all implies -check bounds
+set( ECBUILD_Fortran_FLAGS_DEBUG "-O0 -g -traceback -warn all -heap-arrays -fpe-all=0 -fpe:0 -check all" )
####################################################################
# LINK FLAGS
@@ -73,4 +71,3 @@ set( ECBUILD_Fortran_FLAGS_DEBUG "-g -O0" ) # ??? -align array64byte
set( ECBUILD_C_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
set( ECBUILD_CXX_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
set( ECBUILD_Fortran_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
-
diff --git a/share/magics/centre.xml b/share/magics/centre.xml
index a5415cb..b7a8e51 100644
--- a/share/magics/centre.xml
+++ b/share/magics/centre.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<centres>
<centre code='98'
short_title='ECMWF'
diff --git a/share/magics/efi/Africa_All32parameters_0.js b/share/magics/efi/Africa_All32parameters_0.js
index 340f97c..4420e05 100644
--- a/share/magics/efi/Africa_All32parameters_0.js
+++ b/share/magics/efi/Africa_All32parameters_0.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Africa_All32parameters_1.js b/share/magics/efi/Africa_All32parameters_1.js
index 340f97c..4420e05 100644
--- a/share/magics/efi/Africa_All32parameters_1.js
+++ b/share/magics/efi/Africa_All32parameters_1.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Africa_All32parameters_2.js b/share/magics/efi/Africa_All32parameters_2.js
index 340f97c..4420e05 100644
--- a/share/magics/efi/Africa_All32parameters_2.js
+++ b/share/magics/efi/Africa_All32parameters_2.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Africa_All32parameters_3.js b/share/magics/efi/Africa_All32parameters_3.js
index 340f97c..4420e05 100644
--- a/share/magics/efi/Africa_All32parameters_3.js
+++ b/share/magics/efi/Africa_All32parameters_3.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Africa_All32parameters_4.js b/share/magics/efi/Africa_All32parameters_4.js
index 340f97c..4420e05 100644
--- a/share/magics/efi/Africa_All32parameters_4.js
+++ b/share/magics/efi/Africa_All32parameters_4.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Africa_All32parameters_5.js b/share/magics/efi/Africa_All32parameters_5.js
index 340f97c..4420e05 100644
--- a/share/magics/efi/Africa_All32parameters_5.js
+++ b/share/magics/efi/Africa_All32parameters_5.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Asia_All32parameters_0.js b/share/magics/efi/Asia_All32parameters_0.js
index d9b8ac0..239826c 100644
--- a/share/magics/efi/Asia_All32parameters_0.js
+++ b/share/magics/efi/Asia_All32parameters_0.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Asia_All32parameters_1.js b/share/magics/efi/Asia_All32parameters_1.js
index d9b8ac0..239826c 100644
--- a/share/magics/efi/Asia_All32parameters_1.js
+++ b/share/magics/efi/Asia_All32parameters_1.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Asia_All32parameters_2.js b/share/magics/efi/Asia_All32parameters_2.js
index d9b8ac0..239826c 100644
--- a/share/magics/efi/Asia_All32parameters_2.js
+++ b/share/magics/efi/Asia_All32parameters_2.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Asia_All32parameters_3.js b/share/magics/efi/Asia_All32parameters_3.js
index d9b8ac0..239826c 100644
--- a/share/magics/efi/Asia_All32parameters_3.js
+++ b/share/magics/efi/Asia_All32parameters_3.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Asia_All32parameters_4.js b/share/magics/efi/Asia_All32parameters_4.js
index d9b8ac0..239826c 100644
--- a/share/magics/efi/Asia_All32parameters_4.js
+++ b/share/magics/efi/Asia_All32parameters_4.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Asia_All32parameters_5.js b/share/magics/efi/Asia_All32parameters_5.js
index d9b8ac0..239826c 100644
--- a/share/magics/efi/Asia_All32parameters_5.js
+++ b/share/magics/efi/Asia_All32parameters_5.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Australia_All32parameters_0.js b/share/magics/efi/Australia_All32parameters_0.js
index 6bc99d6..242f4b5 100644
--- a/share/magics/efi/Australia_All32parameters_0.js
+++ b/share/magics/efi/Australia_All32parameters_0.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 371.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Australia_All32parameters_1.js b/share/magics/efi/Australia_All32parameters_1.js
index 6bc99d6..242f4b5 100644
--- a/share/magics/efi/Australia_All32parameters_1.js
+++ b/share/magics/efi/Australia_All32parameters_1.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 371.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Australia_All32parameters_2.js b/share/magics/efi/Australia_All32parameters_2.js
index 6bc99d6..242f4b5 100644
--- a/share/magics/efi/Australia_All32parameters_2.js
+++ b/share/magics/efi/Australia_All32parameters_2.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 371.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Australia_All32parameters_3.js b/share/magics/efi/Australia_All32parameters_3.js
index 6bc99d6..242f4b5 100644
--- a/share/magics/efi/Australia_All32parameters_3.js
+++ b/share/magics/efi/Australia_All32parameters_3.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 371.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Australia_All32parameters_4.js b/share/magics/efi/Australia_All32parameters_4.js
index 6bc99d6..242f4b5 100644
--- a/share/magics/efi/Australia_All32parameters_4.js
+++ b/share/magics/efi/Australia_All32parameters_4.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 371.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Australia_All32parameters_5.js b/share/magics/efi/Australia_All32parameters_5.js
index 6bc99d6..242f4b5 100644
--- a/share/magics/efi/Australia_All32parameters_5.js
+++ b/share/magics/efi/Australia_All32parameters_5.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 371.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Europe_All32parameters_0.js b/share/magics/efi/Europe_All32parameters_0.js
index bb567ea..b201c89 100644
--- a/share/magics/efi/Europe_All32parameters_0.js
+++ b/share/magics/efi/Europe_All32parameters_0.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 358.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Europe_All32parameters_1.js b/share/magics/efi/Europe_All32parameters_1.js
index bb567ea..b201c89 100644
--- a/share/magics/efi/Europe_All32parameters_1.js
+++ b/share/magics/efi/Europe_All32parameters_1.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 358.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Europe_All32parameters_2.js b/share/magics/efi/Europe_All32parameters_2.js
index bb567ea..b201c89 100644
--- a/share/magics/efi/Europe_All32parameters_2.js
+++ b/share/magics/efi/Europe_All32parameters_2.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 358.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Europe_All32parameters_3.js b/share/magics/efi/Europe_All32parameters_3.js
index bb567ea..b201c89 100644
--- a/share/magics/efi/Europe_All32parameters_3.js
+++ b/share/magics/efi/Europe_All32parameters_3.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 358.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Europe_All32parameters_4.js b/share/magics/efi/Europe_All32parameters_4.js
index bb567ea..b201c89 100644
--- a/share/magics/efi/Europe_All32parameters_4.js
+++ b/share/magics/efi/Europe_All32parameters_4.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 358.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Europe_All32parameters_5.js b/share/magics/efi/Europe_All32parameters_5.js
index bb567ea..b201c89 100644
--- a/share/magics/efi/Europe_All32parameters_5.js
+++ b/share/magics/efi/Europe_All32parameters_5.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 358.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Global_All32parameters_0.js b/share/magics/efi/Global_All32parameters_0.js
index f425af0..e9a1783 100644
--- a/share/magics/efi/Global_All32parameters_0.js
+++ b/share/magics/efi/Global_All32parameters_0.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 340.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Global_All32parameters_1.js b/share/magics/efi/Global_All32parameters_1.js
index f425af0..e9a1783 100644
--- a/share/magics/efi/Global_All32parameters_1.js
+++ b/share/magics/efi/Global_All32parameters_1.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 340.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Global_All32parameters_2.js b/share/magics/efi/Global_All32parameters_2.js
index f425af0..e9a1783 100644
--- a/share/magics/efi/Global_All32parameters_2.js
+++ b/share/magics/efi/Global_All32parameters_2.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 340.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Global_All32parameters_3.js b/share/magics/efi/Global_All32parameters_3.js
index f425af0..e9a1783 100644
--- a/share/magics/efi/Global_All32parameters_3.js
+++ b/share/magics/efi/Global_All32parameters_3.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 340.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Global_All32parameters_4.js b/share/magics/efi/Global_All32parameters_4.js
index f425af0..e9a1783 100644
--- a/share/magics/efi/Global_All32parameters_4.js
+++ b/share/magics/efi/Global_All32parameters_4.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 340.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/Global_All32parameters_5.js b/share/magics/efi/Global_All32parameters_5.js
index f425af0..e9a1783 100644
--- a/share/magics/efi/Global_All32parameters_5.js
+++ b/share/magics/efi/Global_All32parameters_5.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 340.;
magics_left = 60;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/North32America_All32parameters_0.js b/share/magics/efi/North32America_All32parameters_0.js
index 0c28440..e551119 100644
--- a/share/magics/efi/North32America_All32parameters_0.js
+++ b/share/magics/efi/North32America_All32parameters_0.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/North32America_All32parameters_1.js b/share/magics/efi/North32America_All32parameters_1.js
index 0c28440..e551119 100644
--- a/share/magics/efi/North32America_All32parameters_1.js
+++ b/share/magics/efi/North32America_All32parameters_1.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/North32America_All32parameters_2.js b/share/magics/efi/North32America_All32parameters_2.js
index 0c28440..e551119 100644
--- a/share/magics/efi/North32America_All32parameters_2.js
+++ b/share/magics/efi/North32America_All32parameters_2.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/North32America_All32parameters_3.js b/share/magics/efi/North32America_All32parameters_3.js
index 0c28440..e551119 100644
--- a/share/magics/efi/North32America_All32parameters_3.js
+++ b/share/magics/efi/North32America_All32parameters_3.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/North32America_All32parameters_4.js b/share/magics/efi/North32America_All32parameters_4.js
index 0c28440..e551119 100644
--- a/share/magics/efi/North32America_All32parameters_4.js
+++ b/share/magics/efi/North32America_All32parameters_4.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/North32America_All32parameters_5.js b/share/magics/efi/North32America_All32parameters_5.js
index 0c28440..e551119 100644
--- a/share/magics/efi/North32America_All32parameters_5.js
+++ b/share/magics/efi/North32America_All32parameters_5.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 384.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/South32America_All32parameters_0.js b/share/magics/efi/South32America_All32parameters_0.js
index f8a0a15..a43cf5c 100644
--- a/share/magics/efi/South32America_All32parameters_0.js
+++ b/share/magics/efi/South32America_All32parameters_0.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 385.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/South32America_All32parameters_1.js b/share/magics/efi/South32America_All32parameters_1.js
index f8a0a15..a43cf5c 100644
--- a/share/magics/efi/South32America_All32parameters_1.js
+++ b/share/magics/efi/South32America_All32parameters_1.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 385.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/South32America_All32parameters_2.js b/share/magics/efi/South32America_All32parameters_2.js
index f8a0a15..a43cf5c 100644
--- a/share/magics/efi/South32America_All32parameters_2.js
+++ b/share/magics/efi/South32America_All32parameters_2.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 385.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/South32America_All32parameters_3.js b/share/magics/efi/South32America_All32parameters_3.js
index f8a0a15..a43cf5c 100644
--- a/share/magics/efi/South32America_All32parameters_3.js
+++ b/share/magics/efi/South32America_All32parameters_3.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 385.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/South32America_All32parameters_4.js b/share/magics/efi/South32America_All32parameters_4.js
index f8a0a15..a43cf5c 100644
--- a/share/magics/efi/South32America_All32parameters_4.js
+++ b/share/magics/efi/South32America_All32parameters_4.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 385.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/South32America_All32parameters_5.js b/share/magics/efi/South32America_All32parameters_5.js
index f8a0a15..a43cf5c 100644
--- a/share/magics/efi/South32America_All32parameters_5.js
+++ b/share/magics/efi/South32America_All32parameters_5.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
magics_height = 385.;
magics_left = 60.;
magics_outside = function (x, y) {
diff --git a/share/magics/efi/efi_template.js b/share/magics/efi/efi_template.js
index e20a765..e3ee733 100644
--- a/share/magics/efi/efi_template.js
+++ b/share/magics/efi/efi_template.js
@@ -1 +1,11 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
HELLO: I am a template!
diff --git a/share/magics/level.xml b/share/magics/level.xml
index e28537e..599375d 100644
--- a/share/magics/level.xml
+++ b/share/magics/level.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<levels>
<level code='100'
short_title='hPa'
diff --git a/share/magics/satellite.xml b/share/magics/satellite.xml
index e4696f5..8bf9d27 100644
--- a/share/magics/satellite.xml
+++ b/share/magics/satellite.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<satellites>
<identifier code='52'
short_title='Met5'
diff --git a/share/magics/table_128.xml b/share/magics/table_128.xml
index b590beb..acfdbe7 100644
--- a/share/magics/table_128.xml
+++ b/share/magics/table_128.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='128'>
<param code='1' mars=''
@@ -1295,5 +1305,12 @@
original_unit='m s**-1' derived_unit=''
vector1='0' vector2='0'
contour_interval='0.0' specification=''/>
+ <param code='260510' mars=''
+ short_title=''
+ long_title=''
+ scaling='1.0' offset='-273.16'
+ original_unit='K' derived_unit='deg c'
+ />
</table>
+
</center>
diff --git a/share/magics/table_129.xml b/share/magics/table_129.xml
index bde9c08..6a9bb49 100644
--- a/share/magics/table_129.xml
+++ b/share/magics/table_129.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='129'>
<param code='1' mars=''
diff --git a/share/magics/table_130.xml b/share/magics/table_130.xml
index c3fdb9f..951414c 100644
--- a/share/magics/table_130.xml
+++ b/share/magics/table_130.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='130'>
<param code='208' mars=''
diff --git a/share/magics/table_131.xml b/share/magics/table_131.xml
index 0984502..bded925 100644
--- a/share/magics/table_131.xml
+++ b/share/magics/table_131.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='131'>
<param code='6' mars=''
diff --git a/share/magics/table_132.xml b/share/magics/table_132.xml
index 927769d..e40d46a 100644
--- a/share/magics/table_132.xml
+++ b/share/magics/table_132.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='132'>
<param code='49' mars=''
diff --git a/share/magics/table_140.xml b/share/magics/table_140.xml
index 80db9bf..f9b12d4 100644
--- a/share/magics/table_140.xml
+++ b/share/magics/table_140.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='140'>
<param code='219' mars=''
diff --git a/share/magics/table_150.xml b/share/magics/table_150.xml
index 5d0f6ae..4b0d01d 100644
--- a/share/magics/table_150.xml
+++ b/share/magics/table_150.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='150'>
<param code='129' mars=''
diff --git a/share/magics/table_151.xml b/share/magics/table_151.xml
index baff493..79e25aa 100644
--- a/share/magics/table_151.xml
+++ b/share/magics/table_151.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='151'>
<param code='129' mars=''
diff --git a/share/magics/table_160.xml b/share/magics/table_160.xml
index 68c18d4..acfaba5 100644
--- a/share/magics/table_160.xml
+++ b/share/magics/table_160.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='160'>
<param code='127' mars=''
diff --git a/share/magics/table_162.xml b/share/magics/table_162.xml
index c69d509..c0f5278 100644
--- a/share/magics/table_162.xml
+++ b/share/magics/table_162.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='162'>
</table>
diff --git a/share/magics/table_170.xml b/share/magics/table_170.xml
index 709c31b..280c53c 100644
--- a/share/magics/table_170.xml
+++ b/share/magics/table_170.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='170'>
<param code='129' mars=''
diff --git a/share/magics/table_171.xml b/share/magics/table_171.xml
index 1d2f8eb..cbfbd4a 100644
--- a/share/magics/table_171.xml
+++ b/share/magics/table_171.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='171'>
<param code='1' mars=''
diff --git a/share/magics/table_172.xml b/share/magics/table_172.xml
index e78c8a4..4658b3d 100644
--- a/share/magics/table_172.xml
+++ b/share/magics/table_172.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='172'>
<param code='44' mars=''
diff --git a/share/magics/table_173.xml b/share/magics/table_173.xml
index 34f0c21..49cae92 100644
--- a/share/magics/table_173.xml
+++ b/share/magics/table_173.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='173'>
</table>
diff --git a/share/magics/table_174.xml b/share/magics/table_174.xml
index b9ab057..93170fa 100644
--- a/share/magics/table_174.xml
+++ b/share/magics/table_174.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='174'>
<param code='31' mars=''
diff --git a/share/magics/table_175.xml b/share/magics/table_175.xml
index 0de2d12..3ff77c3 100644
--- a/share/magics/table_175.xml
+++ b/share/magics/table_175.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='175'>
<param code='31' mars=''
diff --git a/share/magics/table_180.xml b/share/magics/table_180.xml
index 95a08df..6eae232 100644
--- a/share/magics/table_180.xml
+++ b/share/magics/table_180.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='180'>
<param code='129' mars=''
diff --git a/share/magics/table_190.xml b/share/magics/table_190.xml
index 94781f6..84a550d 100644
--- a/share/magics/table_190.xml
+++ b/share/magics/table_190.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='190'>
<param code='129' mars=''
diff --git a/share/magics/table_2.xml b/share/magics/table_2.xml
index 250ca94..1ba5851 100644
--- a/share/magics/table_2.xml
+++ b/share/magics/table_2.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='7'>
<table code='2'>
<param code='11' mars=''
diff --git a/share/magics/table_200.xml b/share/magics/table_200.xml
index 38a5572..59ee3f6 100644
--- a/share/magics/table_200.xml
+++ b/share/magics/table_200.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='200'>
<param code='1' mars=''
diff --git a/share/magics/table_210.xml b/share/magics/table_210.xml
index 7c66d79..e3c4579 100644
--- a/share/magics/table_210.xml
+++ b/share/magics/table_210.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='210'>
<param code='1' mars=''
diff --git a/share/magics/table_254.xml b/share/magics/table_254.xml
index 84fadd2..4e5db71 100644
--- a/share/magics/table_254.xml
+++ b/share/magics/table_254.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='46'>
<table code='254'>
<param code='128' mars=''
diff --git a/share/magics/table_260.xml b/share/magics/table_260.xml
index 173661d..9638402 100644
--- a/share/magics/table_260.xml
+++ b/share/magics/table_260.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<center code='98'>
<table code='260'>
<param code='510' mars=''
diff --git a/share/magics/title_template.xml b/share/magics/title_template.xml
index b392dad..a7dfaaf 100644
--- a/share/magics/title_template.xml
+++ b/share/magics/title_template.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<!-- Default title -->
<title>
diff --git a/share/magics/type.xml b/share/magics/type.xml
index f24d6e8..e80eb02 100644
--- a/share/magics/type.xml
+++ b/share/magics/type.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<types>
<type code='2'
short_title='AN'
diff --git a/share/magics/web/magics.js b/share/magics/web/magics.js
index 68ac336..a964b39 100644
--- a/share/magics/web/magics.js
+++ b/share/magics/web/magics.js
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*jslint white: false, onevar:false */
function magics_factory(params) {
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6bf3b1c..77d5d07 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -188,8 +188,7 @@ if( metview )
${CMAKE_CURRENT_SOURCE_DIR}/drivers
${CMAKE_CURRENT_SOURCE_DIR}/decoders
${CMAKE_CURRENT_SOURCE_DIR}/terralib
- ${CMAKE_CURRENT_SOURCE_DIR}/terralib/kernel
- ${CMAKE_CURRENT_SOURCE_DIR}/terralib/utils
+ ${CMAKE_CURRENT_SOURCE_DIR}/terralib/kernel
${CMAKE_CURRENT_SOURCE_DIR}/libMagWrapper )
@@ -236,8 +235,6 @@ if( metview )
terralib/kernel/TeSingleton.h
terralib/kernel/TeDatum.h
terralib/kernel/TeUtils.h
- terralib/kernel/TeProgress.h
- terralib/kernel/TeProgressBase.h
DESTINATION ${INSTALL_INCLUDE_DIR})
diff --git a/src/MagicsDouble.cc b/src/MagicsDouble.cc
old mode 100755
new mode 100644
index c202604..c8a9341
--- a/src/MagicsDouble.cc
+++ b/src/MagicsDouble.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*
@@ -44,7 +36,7 @@
For more information you should read the <a href="">installation guide</a>.
- \section interfaces Magics++ interfaces
+ \section interfaces Magics interfaces
Magics++ offers different interfaces to access its graphics
functionality: C++ (for higher-level applicatiosn such as Metview), C, Fortran 77
@@ -79,20 +71,13 @@
\section copyright License
- Copyright 2007-2014 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
+ (C) Copyright 1996-2016 ECMWF.
+
+ This software is licensed under the terms of the Apache Licence Version 2.0
+ which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ In applying this licence, ECMWF does not waive the privileges and immunities
+ granted to it by virtue of its status as an intergovernmental organisation nor
+ does it submit to any jurisdiction.
*/
diff --git a/src/MagicsSingle.cc b/src/MagicsSingle.cc
index 9eb2f51..e2cf133 100644
--- a/src/MagicsSingle.cc
+++ b/src/MagicsSingle.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*
diff --git a/src/VectorOfPointers.h b/src/VectorOfPointers.h
index ff90a6e..5dbc761 100644
--- a/src/VectorOfPointers.h
+++ b/src/VectorOfPointers.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\author <a href="http://ootips.org/yonat/4dev/">Yonat Sharon</a>
diff --git a/src/basic/BasicGraphicsObject.cc b/src/basic/BasicGraphicsObject.cc
index 201dba0..9de9aec 100644
--- a/src/basic/BasicGraphicsObject.cc
+++ b/src/basic/BasicGraphicsObject.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File BasicGraphicsObject.cc
// Magics Team - ECMWF 2004
diff --git a/src/basic/BasicGraphicsObject.h b/src/basic/BasicGraphicsObject.h
index a4f5293..dcf1304 100644
--- a/src/basic/BasicGraphicsObject.h
+++ b/src/basic/BasicGraphicsObject.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BasicGraphicsObject.h
\brief Implementation of BasicGraphicsObject class.
diff --git a/src/basic/BasicSceneObject.cc b/src/basic/BasicSceneObject.cc
index 3e094fc..734a974 100644
--- a/src/basic/BasicSceneObject.cc
+++ b/src/basic/BasicSceneObject.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BasicSceneObject.cc
\brief Implementation of the Template class BasicSceneObject.
diff --git a/src/basic/BasicSceneObject.h b/src/basic/BasicSceneObject.h
index 5366ddb..74e9cba 100644
--- a/src/basic/BasicSceneObject.h
+++ b/src/basic/BasicSceneObject.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BasicSceneObject.h
\brief Definition of the Template class BasicSceneObject.
diff --git a/src/basic/BasicSceneVisitor.cc b/src/basic/BasicSceneVisitor.cc
index acdff02..0d27b8f 100644
--- a/src/basic/BasicSceneVisitor.cc
+++ b/src/basic/BasicSceneVisitor.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file BasicSceneVisitor.cc
\brief Implementation of the Template class BasicSceneVisitor.
diff --git a/src/basic/BasicSceneVisitor.h b/src/basic/BasicSceneVisitor.h
index b5dc22b..53a66b3 100644
--- a/src/basic/BasicSceneVisitor.h
+++ b/src/basic/BasicSceneVisitor.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file BasicSceneVisitor.h
\brief Definition of the Template class BasicSceneVisitor.
diff --git a/src/basic/DataConverter.cc b/src/basic/DataConverter.cc
index 51f3038..72a6ce7 100644
--- a/src/basic/DataConverter.cc
+++ b/src/basic/DataConverter.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file DataConverter.cc
\brief Implementation of the Template class DataConverter.
diff --git a/src/basic/DataConverter.h b/src/basic/DataConverter.h
index d24d8f4..a7d17cd 100644
--- a/src/basic/DataConverter.h
+++ b/src/basic/DataConverter.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file DataConverter.h
\brief Definition of the Template class DataConverter.
diff --git a/src/basic/DisplayManager.cc b/src/basic/DisplayManager.cc
index 6ec4614..fa9dffc 100644
--- a/src/basic/DisplayManager.cc
+++ b/src/basic/DisplayManager.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file DisplayManager.cc
\brief Implementation of the Template class DisplayManager.
diff --git a/src/basic/DisplayManager.h b/src/basic/DisplayManager.h
index 131e7c0..9b9d4da 100644
--- a/src/basic/DisplayManager.h
+++ b/src/basic/DisplayManager.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file DisplayManager.h
\brief Definition of the Template class DisplayManager.
diff --git a/src/basic/FortranMagics.cc b/src/basic/FortranMagics.cc
index 647f06a..fd8a7e9 100644
--- a/src/basic/FortranMagics.cc
+++ b/src/basic/FortranMagics.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file FortranMagics.cc
\brief Implementation of the Template class FortranMagics.
diff --git a/src/basic/FortranMagics.h b/src/basic/FortranMagics.h
index d910b39..20c6233 100644
--- a/src/basic/FortranMagics.h
+++ b/src/basic/FortranMagics.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file FortranMagics.h
\brief Definition of the Template class FortranMagics.
diff --git a/src/basic/HistoVisitor.cc b/src/basic/HistoVisitor.cc
index fa38299..3097f6a 100644
--- a/src/basic/HistoVisitor.cc
+++ b/src/basic/HistoVisitor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ViewNode.cc
\brief Implementation of the Template class ViewNode.
diff --git a/src/basic/HistoVisitor.h b/src/basic/HistoVisitor.h
index 143df48..511744c 100644
--- a/src/basic/HistoVisitor.h
+++ b/src/basic/HistoVisitor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\brief Definition of the Template class ViewNode.
diff --git a/src/basic/ImportObjectHandler.cc b/src/basic/ImportObjectHandler.cc
index 38fafeb..84f6fe9 100644
--- a/src/basic/ImportObjectHandler.cc
+++ b/src/basic/ImportObjectHandler.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file ImportObjectHandler.cc
\brief Implementation of the Template class ImportObjectHandler.
diff --git a/src/basic/ImportObjectHandler.h b/src/basic/ImportObjectHandler.h
index cdaa727..f1d01af 100644
--- a/src/basic/ImportObjectHandler.h
+++ b/src/basic/ImportObjectHandler.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file ImportObjectHandler.h
\brief Definition of the Template class ImportObjectHandler.
diff --git a/src/basic/Layer.cc b/src/basic/Layer.cc
index cbc6371..8aed461 100644
--- a/src/basic/Layer.cc
+++ b/src/basic/Layer.cc
@@ -1,20 +1,12 @@
-
-/*****************
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************* LICENSE *******************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "Layer.h"
#include "BaseDriver.h"
diff --git a/src/basic/Layer.h b/src/basic/Layer.h
index c45d8a1..a06e525 100644
--- a/src/basic/Layer.h
+++ b/src/basic/Layer.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BasicGraphicsObject.h
\brief Implementation of BasicGraphicsObject class.
diff --git a/src/basic/LayoutManager.cc b/src/basic/LayoutManager.cc
index ef78212..3b0eb3e 100644
--- a/src/basic/LayoutManager.cc
+++ b/src/basic/LayoutManager.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file LayoutManager.h
\brief Implementation of the Template class LayoutManager.
diff --git a/src/basic/LayoutManager.h b/src/basic/LayoutManager.h
index 7a2601b..ef831ad 100644
--- a/src/basic/LayoutManager.h
+++ b/src/basic/LayoutManager.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file LayoutManager.h
\brief Definition of the Template class LayoutManager.
diff --git a/src/basic/LegendVisitor.cc b/src/basic/LegendVisitor.cc
index 090b6df..608c7b3 100644
--- a/src/basic/LegendVisitor.cc
+++ b/src/basic/LegendVisitor.cc
@@ -145,6 +145,15 @@ void LineEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& ou
line_->push_back(PaperPoint(x+0.5, y));
out.push_back(line_);
}
+void RainbowEntry::rowBox(const PaperPoint& point, BasicGraphicsObjectContainer& out)
+{
+ double x = point.x();
+ double y = point.y();
+
+ line_->push_back(PaperPoint(x-0.5, y+0.5));
+ line_->push_back(PaperPoint(x+0.5, y+0.5));
+ out.push_back(line_);
+}
void LineEntry::columnBox(const PaperPoint& point, BasicGraphicsObjectContainer& out)
{
double x = point.x();
@@ -204,14 +213,18 @@ void LegendVisitor::build()
legend->push_back(titlePosition_);
legend_->push_back(legend);
}
+
+ if ( !empty() ) {
+ if ( use_min_ ) {
+ front()->userText(use_min_text_);
+ }
+ if ( use_max_ ) {
+ back()->userText(use_max_text_);
+ }
- if ( use_min_ ) {
- front()->userText(use_min_text_);
- }
- if ( use_max_ ) {
- back()->userText(use_max_text_);
+ back()->units(units_text_);
}
-
+
for(vector<LegendEntry*>::const_iterator entry = begin(); entry != end(); ++entry)
{
(*entry)->width(text_width_);
@@ -234,7 +247,7 @@ void LegendVisitor::build()
user = utext;
else
user = ( label != lines_.end() ) ? *label: "";
- string automatic = (*entry)->label();
+ string automatic = (*entry)->label() + (*entry)->units();
if ( composition == compositions_.end() )
{
@@ -1259,9 +1272,6 @@ void SimpleSymbolEntry::set(const PaperPoint& point, BasicGraphicsObjectContaine
}
-
-
-
const string& LegendEntry::label() const
{
if ( !label_.empty() || !fromto_)
@@ -1407,3 +1417,4 @@ BoxEntry::~BoxEntry() {} //{ delete box_; }
ArrowEntry::~ArrowEntry() {} //{ delete arrow_; }
DoubleLineEntry::~DoubleLineEntry() {} //{ { delete line1_; delete line2_; }
LineEntry::~LineEntry() {} //{ delete line_;}
+RainbowEntry::~RainbowEntry() {} //{ delete line_;}
\ No newline at end of file
diff --git a/src/basic/LegendVisitor.h b/src/basic/LegendVisitor.h
index 165dcc5..fd62ca8 100644
--- a/src/basic/LegendVisitor.h
+++ b/src/basic/LegendVisitor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LegendVisitor.h
\brief Definition of the Template class LegendNode.
@@ -70,7 +62,7 @@ public:
virtual void rowHisto(const PaperPoint& point, BasicGraphicsObjectContainer& out, const Colour&) {rowBox(point, out);}
virtual void columnHisto(const PaperPoint& point, BasicGraphicsObjectContainer& out, const Colour&) {columnBox(point, out);}
- virtual bool needContinuousText() { return false; }
+ virtual bool needContinuousText(Text&) { return false; }
virtual bool needText() { return true; }
virtual const string& label() const;
virtual void interpret(string&) const {}
@@ -80,6 +72,8 @@ public:
void userText(const string& text) { userText_ = text; }
const string& userText() { return userText_; }
+ const string& units() { return units_; }
+ void units(const string& units) { units_ = units; }
void font(const MagFont& font) { font_ = font; }
void angle(double angle) { angle_ = angle; }
@@ -116,6 +110,7 @@ protected:
HistogramLegendMethod* histogram_;
string userText_;
+ string units_;
double from_;
double to_;
string format_;
@@ -210,12 +205,22 @@ public:
void set(const PaperPoint&, BasicGraphicsObjectContainer&);
virtual void rowBox(const PaperPoint&, BasicGraphicsObjectContainer&);
virtual void columnBox(const PaperPoint&, BasicGraphicsObjectContainer&);
- bool needContinuousText() { return true; }
+ bool needContinuousText(Text& text) { text.setJustification(MLEFT); return true; }
~LineEntry();
protected:
Polyline* line_;
Colour colour();
};
+class RainbowEntry : public LineEntry
+{
+public:
+ RainbowEntry(double label, Polyline* line = 0 ) :
+ LineEntry(label, line) { }
+ bool needContinuousText(Text&) { return true; }
+ void rowBox(const PaperPoint&, BasicGraphicsObjectContainer&);
+
+ ~RainbowEntry();
+};
class DoubleLineEntry : public LegendEntry
@@ -232,7 +237,7 @@ public:
void set(const PaperPoint&, BasicGraphicsObjectContainer&);
virtual void rowBox(const PaperPoint&, BasicGraphicsObjectContainer&);
virtual void columnBox(const PaperPoint&, BasicGraphicsObjectContainer&);
- bool needContinuousText() { return true; }
+ bool needContinuousText(Text& text) { text.setJustification(MLEFT); return true; }
~DoubleLineEntry();
protected:
Polyline* line1_;
@@ -256,7 +261,7 @@ public:
void set(const PaperPoint&, BasicGraphicsObjectContainer&);
virtual void rowBox(const PaperPoint&, BasicGraphicsObjectContainer&);
virtual void columnBox(const PaperPoint&, BasicGraphicsObjectContainer&);
- bool needContinuousText() { return false; }
+ bool needContinuousText(Text&) { return false; }
PaperPoint leftTextBox(const PaperPoint&);
protected:
Arrow* arrow_;
@@ -278,7 +283,7 @@ public:
void set(const PaperPoint&, BasicGraphicsObjectContainer&);
virtual void rowBox(const PaperPoint&, BasicGraphicsObjectContainer&);
virtual void columnBox(const PaperPoint&, BasicGraphicsObjectContainer&);
- bool needContinuousText() { return false; }
+ bool needContinuousText(Text&) { return false; }
PaperPoint leftTextBox(const PaperPoint&);
protected:
Flag* flag_;
diff --git a/src/basic/MagicsEvent.h b/src/basic/MagicsEvent.h
index 03eae7b..d8951dd 100644
--- a/src/basic/MagicsEvent.h
+++ b/src/basic/MagicsEvent.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file MagicsEvent.h
\brief Definition of the Template class MagicsEvent.
diff --git a/src/basic/MagicsObserver.h b/src/basic/MagicsObserver.h
index b1c63cf..82cf9a6 100644
--- a/src/basic/MagicsObserver.h
+++ b/src/basic/MagicsObserver.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file MagicsObserver.h
\brief Definition of the Template class MagicsObserver.
diff --git a/src/basic/MagnifierVisitor.cc b/src/basic/MagnifierVisitor.cc
index 358a8ff..b97cc0f 100644
--- a/src/basic/MagnifierVisitor.cc
+++ b/src/basic/MagnifierVisitor.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file MagnifierVisitor.h
\brief Implementation of the Template class MagnifierVisitor.
diff --git a/src/basic/MagnifierVisitor.h b/src/basic/MagnifierVisitor.h
index b48f794..95e26be 100644
--- a/src/basic/MagnifierVisitor.h
+++ b/src/basic/MagnifierVisitor.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file MagnifierVisitor.h
\brief Definition of the Template class NoMagnifierVisitor.
diff --git a/src/basic/MultiVisdef.cc b/src/basic/MultiVisdef.cc
index 1e01106..ede6df5 100644
--- a/src/basic/MultiVisdef.cc
+++ b/src/basic/MultiVisdef.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file MultiVisdef.cc
\brief Implementation of the Template class MultiVisdef.
diff --git a/src/basic/MultiVisdef.h b/src/basic/MultiVisdef.h
index 9f37c1a..6f779a3 100644
--- a/src/basic/MultiVisdef.h
+++ b/src/basic/MultiVisdef.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file MultiVisdef.h
\brief Definition of the Template class MultiVisdef.
diff --git a/src/basic/ParameterSettings.cc b/src/basic/ParameterSettings.cc
index 0262775..252d605 100644
--- a/src/basic/ParameterSettings.cc
+++ b/src/basic/ParameterSettings.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ParameterSettings.cc
\brief Implementation of parameter settings.
diff --git a/src/basic/ParameterSettings.h b/src/basic/ParameterSettings.h
index 5a2faeb..7fa4e67 100644
--- a/src/basic/ParameterSettings.h
+++ b/src/basic/ParameterSettings.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ParameterSettings.h
\brief Definition of parameter settings.
diff --git a/src/basic/PreviewVisitor.cc b/src/basic/PreviewVisitor.cc
index 65742f4..ddc84ef 100644
--- a/src/basic/PreviewVisitor.cc
+++ b/src/basic/PreviewVisitor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ViewNode.cc
\brief Implementation of the Template class ViewNode.
diff --git a/src/basic/PreviewVisitor.h b/src/basic/PreviewVisitor.h
index 09b3633..2c2e4e9 100644
--- a/src/basic/PreviewVisitor.h
+++ b/src/basic/PreviewVisitor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\brief Definition of the Template class ViewNode.
diff --git a/src/basic/RootSceneNode.cc b/src/basic/RootSceneNode.cc
index 7a79aae..07bcf8c 100644
--- a/src/basic/RootSceneNode.cc
+++ b/src/basic/RootSceneNode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file RootSceneNode.cc
\brief Implementation of the Template class RootSceneNode.
diff --git a/src/basic/RootSceneNode.h b/src/basic/RootSceneNode.h
index 9832894..a370b5b 100644
--- a/src/basic/RootSceneNode.h
+++ b/src/basic/RootSceneNode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file RootSceneNode.h
\brief Definition of the Template class RootSceneNode.
diff --git a/src/basic/SceneNode.cc b/src/basic/SceneNode.cc
index 1f6676e..b647c7f 100644
--- a/src/basic/SceneNode.cc
+++ b/src/basic/SceneNode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SceneNode.cc
\brief Implementation of the Template class SceneNode.
diff --git a/src/basic/SceneNode.h b/src/basic/SceneNode.h
index fb38739..264e702 100644
--- a/src/basic/SceneNode.h
+++ b/src/basic/SceneNode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SceneNode.h
\brief Definition of the Template class SceneNode.
diff --git a/src/basic/SceneVisitor.cc b/src/basic/SceneVisitor.cc
index 4022efd..1f259c1 100644
--- a/src/basic/SceneVisitor.cc
+++ b/src/basic/SceneVisitor.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file SceneVisitor.cc
\brief Implementation of the Template class SceneVisitor.
diff --git a/src/basic/SceneVisitor.h b/src/basic/SceneVisitor.h
index 8e3428b..26e8b29 100644
--- a/src/basic/SceneVisitor.h
+++ b/src/basic/SceneVisitor.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file SceneVisitor.h
\brief Definition of the Template class SceneVisitor.
diff --git a/src/basic/TagHandler.cc b/src/basic/TagHandler.cc
index 978b082..48329a0 100644
--- a/src/basic/TagHandler.cc
+++ b/src/basic/TagHandler.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TagHandler.cc
\brief Implementation of the Template class TagHandler.
diff --git a/src/basic/TagHandler.h b/src/basic/TagHandler.h
index bba47fa..ecdf1bd 100644
--- a/src/basic/TagHandler.h
+++ b/src/basic/TagHandler.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TagHandler.h
\brief Definition of the Template class TagHandler.
diff --git a/src/basic/TextVisitor.cc b/src/basic/TextVisitor.cc
index 819be60..fe030c0 100644
--- a/src/basic/TextVisitor.cc
+++ b/src/basic/TextVisitor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TextVisitor.cc
\brief Implementation of the Template class TextVisitor.
diff --git a/src/basic/TextVisitor.h b/src/basic/TextVisitor.h
index 2ceae4f..8cf047c 100644
--- a/src/basic/TextVisitor.h
+++ b/src/basic/TextVisitor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TextVisitor.h
\brief Definition of the Template class TextNode.
diff --git a/src/basic/ViewNode.cc b/src/basic/ViewNode.cc
index a3636a5..96d1f91 100644
--- a/src/basic/ViewNode.cc
+++ b/src/basic/ViewNode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ViewNode.cc
\brief Implementation of the Template class ViewNode.
diff --git a/src/basic/ViewNode.h b/src/basic/ViewNode.h
index ecc4936..00770e6 100644
--- a/src/basic/ViewNode.h
+++ b/src/basic/ViewNode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ViewNode.h
\brief Definition of the Template class ViewNode.
diff --git a/src/basic/Visdef.h b/src/basic/Visdef.h
index 84936a5..0ebb2d6 100644
--- a/src/basic/Visdef.h
+++ b/src/basic/Visdef.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Visdef.h
\brief Definition of the Template class Visdef.
diff --git a/src/basic/VisualAction.cc b/src/basic/VisualAction.cc
index f703deb..3b220c3 100644
--- a/src/basic/VisualAction.cc
+++ b/src/basic/VisualAction.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file VisualAction.h
\brief Implementation of the Template class ActionNode.
diff --git a/src/basic/VisualAction.h b/src/basic/VisualAction.h
index c5fe22e..d94a0a1 100644
--- a/src/basic/VisualAction.h
+++ b/src/basic/VisualAction.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file VisualAction.h
\brief Definition of the Template class ActionNode.
diff --git a/src/basic/WebFormat.cc b/src/basic/WebFormat.cc
index d4839a4..9686145 100644
--- a/src/basic/WebFormat.cc
+++ b/src/basic/WebFormat.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "WebFormat.h"
#include "MagJSon.h"
diff --git a/src/basic/WebFormat.h b/src/basic/WebFormat.h
index 90d2d14..2c142c4 100644
--- a/src/basic/WebFormat.h
+++ b/src/basic/WebFormat.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagML.h
\brief Definition of the Template class MagML.
diff --git a/src/basic/XmlMagics.cc b/src/basic/XmlMagics.cc
index 0fb5f2a..d2f3430 100644
--- a/src/basic/XmlMagics.cc
+++ b/src/basic/XmlMagics.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XmlMagics.cc
\brief Implementation of the Template class XmlMagics.
diff --git a/src/basic/XmlMagics.h b/src/basic/XmlMagics.h
index d4ac638..7f1f784 100644
--- a/src/basic/XmlMagics.h
+++ b/src/basic/XmlMagics.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XmlMagics.h
\brief Definition of the Template class XmlMagics.
diff --git a/src/common/AnimationRules.cc b/src/common/AnimationRules.cc
index 3747b5f..355c51f 100644
--- a/src/common/AnimationRules.cc
+++ b/src/common/AnimationRules.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file FrameLoop.cc
\brief Implementation of the Template class FrameLoop.
diff --git a/src/common/AnimationRules.h b/src/common/AnimationRules.h
index 3de0644..7c54419 100644
--- a/src/common/AnimationRules.h
+++ b/src/common/AnimationRules.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file FrameLoop.h
\brief Definition of the Template class FrameLoop.
diff --git a/src/common/Arrow.h b/src/common/Arrow.h
index c1e585b..b4e447b 100644
--- a/src/common/Arrow.h
+++ b/src/common/Arrow.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Arrow.h
\brief Definition of the Template class Arrow.
diff --git a/src/common/ArrowProperties.cc b/src/common/ArrowProperties.cc
index 2fd6904..3245395 100644
--- a/src/common/ArrowProperties.cc
+++ b/src/common/ArrowProperties.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ArrowProperties.cc
\brief Implementation of the Template class Arrow.
diff --git a/src/common/ArrowProperties.h b/src/common/ArrowProperties.h
index bd64ccc..349264f 100644
--- a/src/common/ArrowProperties.h
+++ b/src/common/ArrowProperties.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ArrowProperties.h
\brief Definition of the Template class Arrow.
diff --git a/src/common/AutoLock.h b/src/common/AutoLock.h
index b41d64a..95c9941 100755
--- a/src/common/AutoLock.h
+++ b/src/common/AutoLock.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File AutoLock.h
// Baudouin Raoult - ECMWF May 96
diff --git a/src/common/AutoLocker.cc b/src/common/AutoLocker.cc
index 83f54f4..b237f17 100644
--- a/src/common/AutoLocker.cc
+++ b/src/common/AutoLocker.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/* #define CHECK_DEAD_LOCKS */
diff --git a/src/common/AutomaticPlotManager.cc b/src/common/AutomaticPlotManager.cc
index d05dc5e..b1cf2ae 100644
--- a/src/common/AutomaticPlotManager.cc
+++ b/src/common/AutomaticPlotManager.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AutomaticPlotManager.cc
\brief Implementation of the Template class AutomaticPlotManager.
diff --git a/src/common/AutomaticPlotManager.h b/src/common/AutomaticPlotManager.h
index 5af828e..466ffe0 100644
--- a/src/common/AutomaticPlotManager.h
+++ b/src/common/AutomaticPlotManager.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AutomaticPlotManager.h
\brief Definition of the Template class AutomaticPlotManager.
diff --git a/src/common/BackgroundColour.h b/src/common/BackgroundColour.h
index edc5de9..79deaf3 100644
--- a/src/common/BackgroundColour.h
+++ b/src/common/BackgroundColour.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BackgroundColour.h
\brief Definition of Colour class.
diff --git a/src/common/BaseParameter.cc b/src/common/BaseParameter.cc
index 1c3978d..d4d7d70 100644
--- a/src/common/BaseParameter.cc
+++ b/src/common/BaseParameter.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BaseParameter.cc
\brief Definition of Parameter base class.
diff --git a/src/common/BaseParameter.h b/src/common/BaseParameter.h
index 1a9885c..c92cb2b 100644
--- a/src/common/BaseParameter.h
+++ b/src/common/BaseParameter.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BaseParameter.h
\brief Definition of Parameter base class.
diff --git a/src/common/BasePointsHandler.cc b/src/common/BasePointsHandler.cc
index 0bd575f..2da908a 100644
--- a/src/common/BasePointsHandler.cc
+++ b/src/common/BasePointsHandler.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BasePointsHandler.h
\brief Definition of the Template base class AbstractPoints.
diff --git a/src/common/BasePointsHandler.h b/src/common/BasePointsHandler.h
index 243f599..54841c5 100644
--- a/src/common/BasePointsHandler.h
+++ b/src/common/BasePointsHandler.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BasePointsHandler.h
\brief Definition of the Template base class AbstractPoints.
diff --git a/src/common/BinaryObject.cc b/src/common/BinaryObject.cc
index b7cba5d..ddc841e 100644
--- a/src/common/BinaryObject.cc
+++ b/src/common/BinaryObject.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file BinaryObject.cc
\brief Implementation of the Template class BinaryObject.
diff --git a/src/common/BinaryObject.h b/src/common/BinaryObject.h
index 6fed606..53a2a19 100644
--- a/src/common/BinaryObject.h
+++ b/src/common/BinaryObject.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file BinaryObject.h
\brief Definition of the Template class BinaryObject.
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 8cddf67..1c95c39 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -74,7 +74,7 @@ list( APPEND _common_srcs
# projection
GeoRectangularProjection.cc PolarStereographicProjection.cc TaylorProjection.cc
- GeoRectangularProjection.h PolarStereographicProjection.h SatelliteProjection.h TaylorProjection.h
+ GeoRectangularProjection.h PolarStereographicProjection.h TaylorProjection.h
Proj4Projection.cc Proj4Projection.h
# unused
diff --git a/src/common/CartesianTransformation.cc b/src/common/CartesianTransformation.cc
index 0c0391a..8d228a6 100644
--- a/src/common/CartesianTransformation.cc
+++ b/src/common/CartesianTransformation.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CartesianTransformation.cc
\brief Implementation of the Template class CartesianTransformation.
diff --git a/src/common/CartesianTransformation.h b/src/common/CartesianTransformation.h
index 15af735..8af328b 100644
--- a/src/common/CartesianTransformation.h
+++ b/src/common/CartesianTransformation.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CartesianTransformation.h
\brief Definition of the Template class CartesianTransformation.
diff --git a/src/common/Clipper.h b/src/common/Clipper.h
index 8b4be54..d4068c4 100644
--- a/src/common/Clipper.h
+++ b/src/common/Clipper.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Clipper.h
\brief Definition of the clipping.
diff --git a/src/common/Colour.cc b/src/common/Colour.cc
index 70f1568..647fa0a 100644
--- a/src/common/Colour.cc
+++ b/src/common/Colour.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Colour.cc
\brief Implementation of Colour class.
diff --git a/src/common/Colour.h b/src/common/Colour.h
index 5fb51ec..face946 100644
--- a/src/common/Colour.h
+++ b/src/common/Colour.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Colour.h
\brief Definition of Colour class.
diff --git a/src/common/ColourTable.cc b/src/common/ColourTable.cc
index afd5046..ac3356d 100644
--- a/src/common/ColourTable.cc
+++ b/src/common/ColourTable.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTable.cc
\brief Implementation of the Template class ColourTable.
diff --git a/src/common/ColourTable.h b/src/common/ColourTable.h
index 8001681..7766a49 100644
--- a/src/common/ColourTable.h
+++ b/src/common/ColourTable.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTable.h
\brief Definition of the Template class ColourTable.
diff --git a/src/common/ColourTableDefinition.h b/src/common/ColourTableDefinition.h
index 65e3d39..248d64b 100644
--- a/src/common/ColourTableDefinition.h
+++ b/src/common/ColourTableDefinition.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTableDefinition.h
\brief Definition of the Template class ColourTableDefinition.
diff --git a/src/common/ColourTableDefinitionCompute.cc b/src/common/ColourTableDefinitionCompute.cc
index 1eb2291..1eb8f72 100644
--- a/src/common/ColourTableDefinitionCompute.cc
+++ b/src/common/ColourTableDefinitionCompute.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTableDefinitionCompute.cc
\brief Implementation of the Template class ColourTableDefinitionCompute.
diff --git a/src/common/ColourTableDefinitionCompute.h b/src/common/ColourTableDefinitionCompute.h
index f452a77..0869ee4 100644
--- a/src/common/ColourTableDefinitionCompute.h
+++ b/src/common/ColourTableDefinitionCompute.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTableDefinitionCompute.h
\brief Definition of the Template class ColourTableDefinitionCompute.
diff --git a/src/common/ColourTableDefinitionComputeInterface.h b/src/common/ColourTableDefinitionComputeInterface.h
index 9ee3dba..f58efc6 100644
--- a/src/common/ColourTableDefinitionComputeInterface.h
+++ b/src/common/ColourTableDefinitionComputeInterface.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTableDefinitionComputeInterface.h
\brief Definition of the Template class ColourTableDefinitionComputeInterface.
diff --git a/src/common/ColourTableDefinitionList.cc b/src/common/ColourTableDefinitionList.cc
index a4bfb9a..53a93e1 100644
--- a/src/common/ColourTableDefinitionList.cc
+++ b/src/common/ColourTableDefinitionList.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTableDefinitionList.cc
\brief Implementation of the Template class ColourTableDefinitionList.
diff --git a/src/common/ColourTableDefinitionList.h b/src/common/ColourTableDefinitionList.h
index 30e94ee..ae7dd7f 100644
--- a/src/common/ColourTableDefinitionList.h
+++ b/src/common/ColourTableDefinitionList.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTableDefinitionList.h
\brief Definition of the Template class ColourTableDefinitionList.
diff --git a/src/common/ColourTableDefinitionListInterface.h b/src/common/ColourTableDefinitionListInterface.h
index 6373152..41b7b71 100644
--- a/src/common/ColourTableDefinitionListInterface.h
+++ b/src/common/ColourTableDefinitionListInterface.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTableDefinitionListInterface.h
\brief Definition of the Template class ColourTableDefinitionListInterface.
diff --git a/src/common/Coordinate.cc b/src/common/Coordinate.cc
index cd8220e..c9b1c6e 100644
--- a/src/common/Coordinate.cc
+++ b/src/common/Coordinate.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Coordinate.cc
\brief Implementation of the Template class Coordinate.
diff --git a/src/common/Coordinate.h b/src/common/Coordinate.h
index ebd5226..5162440 100644
--- a/src/common/Coordinate.h
+++ b/src/common/Coordinate.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Coordinate.h
\brief Definition of the Template class Coordinate.
diff --git a/src/common/CustomisedPoint.h b/src/common/CustomisedPoint.h
index ad25158..4db9f93 100644
--- a/src/common/CustomisedPoint.h
+++ b/src/common/CustomisedPoint.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CustomisedPoint.h
\brief Definition of the Template class CustomisedPoint.
diff --git a/src/common/Data.cc b/src/common/Data.cc
index 738961b..4bd3438 100644
--- a/src/common/Data.cc
+++ b/src/common/Data.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Data.h
\brief Definition of the Abstract template class Data.
diff --git a/src/common/Data.h b/src/common/Data.h
index 9041c50..c1147a2 100644
--- a/src/common/Data.h
+++ b/src/common/Data.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Data.h
\brief Definition of the Abstract template class Data.
diff --git a/src/common/DataStats.cc b/src/common/DataStats.cc
index d14dcd2..b0e9865 100644
--- a/src/common/DataStats.cc
+++ b/src/common/DataStats.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file DataStats.cc
\brief Implementation of the class DataStats.
diff --git a/src/common/DataStats.h b/src/common/DataStats.h
index a361607..f299deb 100644
--- a/src/common/DataStats.h
+++ b/src/common/DataStats.h
@@ -1,21 +1,12 @@
-
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file DataStats.h
\brief Definition of the class dataStats.
diff --git a/src/common/Decoder.h b/src/common/Decoder.h
index d1b2f88..62c44e7 100644
--- a/src/common/Decoder.h
+++ b/src/common/Decoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Decoder.h
\brief Definition of the Abstract template class Decoder.
diff --git a/src/common/Dimension.cc b/src/common/Dimension.cc
index e1b17d8..2ccc810 100644
--- a/src/common/Dimension.cc
+++ b/src/common/Dimension.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Dimension.h
\brief Implementation of the Template class Dimension.
diff --git a/src/common/Dimension.h b/src/common/Dimension.h
index e4a6ef6..2d87665 100644
--- a/src/common/Dimension.h
+++ b/src/common/Dimension.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Dimension.h
\brief Definition of the Template class Dimension.
diff --git a/src/common/DriverStatic.cc b/src/common/DriverStatic.cc
index 27a64d0..d701078 100644
--- a/src/common/DriverStatic.cc
+++ b/src/common/DriverStatic.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file DriverStatic.cc
\brief Implementation of the Template class DriverStatic.
diff --git a/src/common/DriverStatic.h b/src/common/DriverStatic.h
index cb0abde..450d86d 100644
--- a/src/common/DriverStatic.h
+++ b/src/common/DriverStatic.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file DriverStatic.h
\brief Definition of the Template class DriverStatic.
diff --git a/src/common/Factory.cc b/src/common/Factory.cc
index b6eeee4..0285139 100644
--- a/src/common/Factory.cc
+++ b/src/common/Factory.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Factory.cc
\brief Definition of Parameter base class.
diff --git a/src/common/Factory.h b/src/common/Factory.h
index 6a67cc5..63a463b 100644
--- a/src/common/Factory.h
+++ b/src/common/Factory.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Factory.h
\brief Definition of Factory class.
diff --git a/src/common/Flag.cc b/src/common/Flag.cc
index fcc7eb0..22da5ef 100644
--- a/src/common/Flag.cc
+++ b/src/common/Flag.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Flag.cc
\brief Implementation of the Template class Flag.
diff --git a/src/common/Flag.h b/src/common/Flag.h
index 154b087..a30dde6 100644
--- a/src/common/Flag.h
+++ b/src/common/Flag.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Flag.h
\brief Definition of the Template class Flag.
diff --git a/src/common/Frame.cc b/src/common/Frame.cc
index ea31f0e..714b1d0 100644
--- a/src/common/Frame.cc
+++ b/src/common/Frame.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Frame.h
\brief Implementation of the Template class Frame.
diff --git a/src/common/Frame.h b/src/common/Frame.h
index acdb73d..de3cd60 100644
--- a/src/common/Frame.h
+++ b/src/common/Frame.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Frame.h
\brief Definition of the Template class Frame.
diff --git a/src/common/FrameBase.cc b/src/common/FrameBase.cc
index 8838cdd..063bed6 100644
--- a/src/common/FrameBase.cc
+++ b/src/common/FrameBase.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file FrameBase.cc
\brief Implementation of the Template class FrameBase.
diff --git a/src/common/FrameBase.h b/src/common/FrameBase.h
index eefb5d2..2e1652f 100644
--- a/src/common/FrameBase.h
+++ b/src/common/FrameBase.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file FrameBase.h
\brief Definition of the Template class FrameBase.
diff --git a/src/common/FrameLoop.cc b/src/common/FrameLoop.cc
index 839058e..b80cf49 100644
--- a/src/common/FrameLoop.cc
+++ b/src/common/FrameLoop.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file FrameLoop.cc
\brief Implementation of the Template class FrameLoop.
diff --git a/src/common/FrameLoop.h b/src/common/FrameLoop.h
index 013a704..e0e1850 100644
--- a/src/common/FrameLoop.h
+++ b/src/common/FrameLoop.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file FrameLoop.h
\brief Definition of the Template class FrameLoop.
diff --git a/src/common/FullPaperPoint.h b/src/common/FullPaperPoint.h
index 963fdbb..2dba01a 100644
--- a/src/common/FullPaperPoint.h
+++ b/src/common/FullPaperPoint.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PaperPoint.h
\brief Definition of Point (x, y, z, v).
diff --git a/src/common/GeoPoint.h b/src/common/GeoPoint.h
index 519d409..569cb8f 100644
--- a/src/common/GeoPoint.h
+++ b/src/common/GeoPoint.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File UserPoint
// Sylvie Lamy-Thepaut ECMWF 2002
diff --git a/src/common/GeoRectangularProjection.cc b/src/common/GeoRectangularProjection.cc
index 7046007..b866181 100644
--- a/src/common/GeoRectangularProjection.cc
+++ b/src/common/GeoRectangularProjection.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GeoRectangularProjection.cc
\brief Implementation of GeoRectangularProjection.
diff --git a/src/common/GeoRectangularProjection.h b/src/common/GeoRectangularProjection.h
index 84ee067..c1c223b 100644
--- a/src/common/GeoRectangularProjection.h
+++ b/src/common/GeoRectangularProjection.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file GeoRectangularProjection.h
diff --git a/src/common/GribInterpretor.h b/src/common/GribInterpretor.h
index 10c0783..3a42871 100644
--- a/src/common/GribInterpretor.h
+++ b/src/common/GribInterpretor.h
@@ -1,22 +1,12 @@
-
-
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Matrix.h
\brief Implementation of the Template class Matrix.
diff --git a/src/common/HeightTableDefinition.h b/src/common/HeightTableDefinition.h
index 6a506bd..e8602fa 100644
--- a/src/common/HeightTableDefinition.h
+++ b/src/common/HeightTableDefinition.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HeightTableDefinition.h
\brief Definition of Colour class.
diff --git a/src/common/Image.h b/src/common/Image.h
index 74e4576..03ab021 100644
--- a/src/common/Image.h
+++ b/src/common/Image.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Image.h
\brief Definition of the Template class Image.
diff --git a/src/common/ImageProperties.h b/src/common/ImageProperties.h
index 1525a66..9123a28 100644
--- a/src/common/ImageProperties.h
+++ b/src/common/ImageProperties.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ImageProperties.h
\brief Definition of the Template class ImageProperties.
diff --git a/src/common/ImportObject.cc b/src/common/ImportObject.cc
index 45a4d64..8fbcbf5 100644
--- a/src/common/ImportObject.cc
+++ b/src/common/ImportObject.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ImportObject.h
\brief Implementation of the Template class ImportObject.
diff --git a/src/common/ImportObject.h b/src/common/ImportObject.h
index ce44641..1770def 100644
--- a/src/common/ImportObject.h
+++ b/src/common/ImportObject.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ImportObject.h
\brief Definition of the Template class ImportObject.
diff --git a/src/common/InteractiveSet.cc b/src/common/InteractiveSet.cc
index 4afa5ec..a1fb21d 100644
--- a/src/common/InteractiveSet.cc
+++ b/src/common/InteractiveSet.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File InteractiveSet.cc
// Magics Team - ECMWF 2004
diff --git a/src/common/InteractiveSet.h b/src/common/InteractiveSet.h
index 3a9457e..c5d22d8 100644
--- a/src/common/InteractiveSet.h
+++ b/src/common/InteractiveSet.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file InteractiveSet.h
\brief Implementation of InteractiveSet class.
diff --git a/src/common/IntervalMap.h b/src/common/IntervalMap.h
index 141d845..78fa321 100644
--- a/src/common/IntervalMap.h
+++ b/src/common/IntervalMap.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file IntervalMap.h
\brief Definition of the Template class IntervalMap
diff --git a/src/common/Label.cc b/src/common/Label.cc
index 58e6e3b..99820ca 100644
--- a/src/common/Label.cc
+++ b/src/common/Label.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Label.h
\brief Implementation of the Template class Label.
diff --git a/src/common/Label.h b/src/common/Label.h
index 258c909..4857ad7 100644
--- a/src/common/Label.h
+++ b/src/common/Label.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Label.h
\brief Definition of the Template class Label.
diff --git a/src/common/Layout.cc b/src/common/Layout.cc
index d69c8ec..b86c314 100644
--- a/src/common/Layout.cc
+++ b/src/common/Layout.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Layout.cc
\brief Implementation of the Template class Layout.
diff --git a/src/common/Layout.h b/src/common/Layout.h
index f138062..872c07e 100644
--- a/src/common/Layout.h
+++ b/src/common/Layout.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Layout.h
\brief Definition of the Template class Layout.
diff --git a/src/common/LevelTableDefinition.h b/src/common/LevelTableDefinition.h
index 2604a46..0ac137c 100644
--- a/src/common/LevelTableDefinition.h
+++ b/src/common/LevelTableDefinition.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LevelTableDefinition.h
\brief Definition of Colour class.
diff --git a/src/common/LogoPlotting.cc b/src/common/LogoPlotting.cc
index 9da5368..f1ea695 100644
--- a/src/common/LogoPlotting.cc
+++ b/src/common/LogoPlotting.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LogoPlotting.cc
\brief Implementation of the Template class LogoPlotting.
diff --git a/src/common/LogoPlotting.h b/src/common/LogoPlotting.h
index 5698cb9..25ecf38 100644
--- a/src/common/LogoPlotting.h
+++ b/src/common/LogoPlotting.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LogoPlotting.h
\brief Definition of the Template class LogoPlotting.
diff --git a/src/common/LogoPlottingBase.h b/src/common/LogoPlottingBase.h
index 13e3de5..a2fc3c4 100644
--- a/src/common/LogoPlottingBase.h
+++ b/src/common/LogoPlottingBase.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagLogoPlottingBase.h
\brief Definition of the Template class MagLogoPlottingBase.
diff --git a/src/common/MagException.cc b/src/common/MagException.cc
index 6693d5c..cba1bc3 100644
--- a/src/common/MagException.cc
+++ b/src/common/MagException.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File Exception
// Sylvie Lamy-Thepaut - ECMWF Mar 02
diff --git a/src/common/MagException.h b/src/common/MagException.h
index ca10b16..b7e159f 100644
--- a/src/common/MagException.h
+++ b/src/common/MagException.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef MagicsException_H
#define MagicsException_H
diff --git a/src/common/MagExceptions.cc b/src/common/MagExceptions.cc
index f0a9c9f..b5b96e0 100644
--- a/src/common/MagExceptions.cc
+++ b/src/common/MagExceptions.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include <signal.h>
diff --git a/src/common/MagExceptions.h b/src/common/MagExceptions.h
index a46a4dc..c9a08c5 100644
--- a/src/common/MagExceptions.h
+++ b/src/common/MagExceptions.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef MagMagExceptions_H
#define MagMagExceptions_H
diff --git a/src/common/MagFont.cc b/src/common/MagFont.cc
index f966334..6f2b6b3 100644
--- a/src/common/MagFont.cc
+++ b/src/common/MagFont.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagFont.cc
\brief Implementation of the Template class MagFont.
diff --git a/src/common/MagFont.h b/src/common/MagFont.h
index 1204620..307d528 100644
--- a/src/common/MagFont.h
+++ b/src/common/MagFont.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagFont.h
\brief Definition of the Template class MagFont.
diff --git a/src/common/MagLog.cc b/src/common/MagLog.cc
index 1d1c213..a82b6aa 100644
--- a/src/common/MagLog.cc
+++ b/src/common/MagLog.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagLog.cc
\brief Implementation of the MagLog class.
diff --git a/src/common/MagLog.h b/src/common/MagLog.h
index 84e3ee1..afeca27 100644
--- a/src/common/MagLog.h
+++ b/src/common/MagLog.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagLog.h
\brief Definition of log class.
diff --git a/src/common/MagTranslator.h b/src/common/MagTranslator.h
index 8570b7e..eec3bdd 100644
--- a/src/common/MagTranslator.h
+++ b/src/common/MagTranslator.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagTranslator.h
\brief Definition of MagTranslator class.
diff --git a/src/common/MagicsCalls.cc b/src/common/MagicsCalls.cc
index 962dffe..5f4b41a 100644
--- a/src/common/MagicsCalls.cc
+++ b/src/common/MagicsCalls.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagicsCalls.cc
\brief Implementation of Fortran and C interface
diff --git a/src/common/MagicsFormat.cc b/src/common/MagicsFormat.cc
index 9bf1345..b49cf85 100644
--- a/src/common/MagicsFormat.cc
+++ b/src/common/MagicsFormat.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "MagicsFormat.h"
#include <ios>
diff --git a/src/common/MagicsFormat.h b/src/common/MagicsFormat.h
index d447a34..332b823 100644
--- a/src/common/MagicsFormat.h
+++ b/src/common/MagicsFormat.h
@@ -1,22 +1,15 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-#ifndef MagicsFormat_H
-#define MagicsFormat_H
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
+#ifndef MagicsFormat_H
+#define MagicsFormat_H
#include "magics.h"
@@ -37,7 +30,7 @@ public:
{
return manip.format(out);
}
- string format_;
+ string format_;
double value_;
};
diff --git a/src/common/MagicsParameter.cc b/src/common/MagicsParameter.cc
index f7f7d41..0838779 100644
--- a/src/common/MagicsParameter.cc
+++ b/src/common/MagicsParameter.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File MagicsParameter.cc
// Magics Team - ECMWF 2004
diff --git a/src/common/MagicsParameter.h b/src/common/MagicsParameter.h
index e535a99..ad7b11d 100644
--- a/src/common/MagicsParameter.h
+++ b/src/common/MagicsParameter.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagicsParameter.h
\brief Definition of the MagicsParameter template class.
diff --git a/src/common/MagicsSingleton.h b/src/common/MagicsSingleton.h
index 99c7a9c..3f432a0 100644
--- a/src/common/MagicsSingleton.h
+++ b/src/common/MagicsSingleton.h
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagicsSingleton.h
diff --git a/src/common/MagicsThreads.cc b/src/common/MagicsThreads.cc
index 8ef722e..c12c8e8 100644
--- a/src/common/MagicsThreads.cc
+++ b/src/common/MagicsThreads.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagicsThreads.cc
\brief Implementation of the Template class MagicsThreads.
diff --git a/src/common/MagicsThreads.h b/src/common/MagicsThreads.h
index b1cee81..a1fc9c2 100644
--- a/src/common/MagicsThreads.h
+++ b/src/common/MagicsThreads.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagicsThreads.h
\brief Definition of the Template class MagicsThreads.
diff --git a/src/common/Matrix.cc b/src/common/Matrix.cc
index b3c7940..b13c8c9 100644
--- a/src/common/Matrix.cc
+++ b/src/common/Matrix.cc
@@ -1,22 +1,12 @@
-
-
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Matrix.h
\brief Implementation of the Template class Matrix.
diff --git a/src/common/Matrix.h b/src/common/Matrix.h
index e6b516e..6c4c7af 100644
--- a/src/common/Matrix.h
+++ b/src/common/Matrix.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Matrix.h
\brief Definition of the Template class Matrix.
diff --git a/src/common/MatrixHandler.h b/src/common/MatrixHandler.h
index 8454abe..4268b38 100644
--- a/src/common/MatrixHandler.h
+++ b/src/common/MatrixHandler.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MatrixHandler.h
\brief Definition of the Template class MatrixHandler.
diff --git a/src/common/MetaData.cc b/src/common/MetaData.cc
index 870a888..9744e7f 100644
--- a/src/common/MetaData.cc
+++ b/src/common/MetaData.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MetaData.h
\brief Implementation of the Template class MetaData.
diff --git a/src/common/MetaData.h b/src/common/MetaData.h
index 14e1784..9ff5230 100644
--- a/src/common/MetaData.h
+++ b/src/common/MetaData.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MetaData.h
\brief Definition of the Template class MetaData.
diff --git a/src/common/Mutex.cc b/src/common/Mutex.cc
index 5034c19..116fa72 100644
--- a/src/common/Mutex.cc
+++ b/src/common/Mutex.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef marsmachine_H
#include "marsmachine.h"
diff --git a/src/common/Mutex.h b/src/common/Mutex.h
index 9c7f41a..6bdcabb 100644
--- a/src/common/Mutex.h
+++ b/src/common/Mutex.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File Mutex.h
// Baudouin Raoult - ECMWF May 96
diff --git a/src/common/MutexCond.cc b/src/common/MutexCond.cc
index d126652..ed6dc43 100644
--- a/src/common/MutexCond.cc
+++ b/src/common/MutexCond.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include <time.h>
diff --git a/src/common/MutexCond.h b/src/common/MutexCond.h
index a3f8834..ec73141 100644
--- a/src/common/MutexCond.h
+++ b/src/common/MutexCond.h
@@ -1,36 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************//******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File MutexCond.h
// Baudouin Raoult - ECMWF Jun 96
diff --git a/src/common/Node.cc b/src/common/Node.cc
index 9e7402c..e153c33 100644
--- a/src/common/Node.cc
+++ b/src/common/Node.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Node.cc
\brief Implementation of the Template class Node.
diff --git a/src/common/Node.h b/src/common/Node.h
index 7ee99bb..4276099 100644
--- a/src/common/Node.h
+++ b/src/common/Node.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Node.h
\brief Definition of the Template class Node.
diff --git a/src/common/OutputFactory.cc b/src/common/OutputFactory.cc
index a52ea7b..163fafb 100644
--- a/src/common/OutputFactory.cc
+++ b/src/common/OutputFactory.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file OutputFactory.cc
\brief Implementation of the Template class OutputFactory.
diff --git a/src/common/OutputFactory.h b/src/common/OutputFactory.h
index 0656c27..bbdbfea 100644
--- a/src/common/OutputFactory.h
+++ b/src/common/OutputFactory.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file OutputFactory.h
\brief Definition of the Template class OutputFactory.
diff --git a/src/common/OutputHandler.cc b/src/common/OutputHandler.cc
index 94968a7..6b13f60 100644
--- a/src/common/OutputHandler.cc
+++ b/src/common/OutputHandler.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file OutputHandler.cc
\brief Implementation of the Template class OutputHandler.
diff --git a/src/common/OutputHandler.h b/src/common/OutputHandler.h
index 1cfec3b..6580efb 100644
--- a/src/common/OutputHandler.h
+++ b/src/common/OutputHandler.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file OutputHandler.h
\brief Definition of the Template class OutputHandler.
diff --git a/src/common/PageID.cc b/src/common/PageID.cc
index 8cd95a3..15a7564 100644
--- a/src/common/PageID.cc
+++ b/src/common/PageID.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PageID.h
\brief Implementation of the Template class PageID.
diff --git a/src/common/PageID.h b/src/common/PageID.h
index 7abaadc..63fc60a 100644
--- a/src/common/PageID.h
+++ b/src/common/PageID.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PageID.h
\brief Definition of the Template class PageID.
diff --git a/src/common/PageIDBase.h b/src/common/PageIDBase.h
index 5111c58..d14749b 100644
--- a/src/common/PageIDBase.h
+++ b/src/common/PageIDBase.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PageIDBase.h
\brief Definition of the Template class PageIDBase.
diff --git a/src/common/PaperDimension.h b/src/common/PaperDimension.h
index 972dd00..0c4f251 100644
--- a/src/common/PaperDimension.h
+++ b/src/common/PaperDimension.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PaperDimension.h
\brief Definition of the Template class PaperDimension.
diff --git a/src/common/PaperPoint.h b/src/common/PaperPoint.h
index 63ccc71..26342e2 100644
--- a/src/common/PaperPoint.h
+++ b/src/common/PaperPoint.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PaperPoint.h
\brief Definition of Point (x, y, z, v).
diff --git a/src/common/ParameterManager.cc b/src/common/ParameterManager.cc
index 2da6368..41ade70 100644
--- a/src/common/ParameterManager.cc
+++ b/src/common/ParameterManager.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ParameterManager.cc
Magics Team - ECMWF 2004
diff --git a/src/common/ParameterManager.h b/src/common/ParameterManager.h
index 537a97f..6132795 100644
--- a/src/common/ParameterManager.h
+++ b/src/common/ParameterManager.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ParameterManager.h
\brief Handles the Magics Parameters
diff --git a/src/common/Path.h b/src/common/Path.h
index 06e4b3a..1bdd6fb 100644
--- a/src/common/Path.h
+++ b/src/common/Path.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File Path
// Sylvie Lamy-Thepaut - ECMWF Mar 02
diff --git a/src/common/PlotManager.cc b/src/common/PlotManager.cc
index d29e53e..e64eacf 100644
--- a/src/common/PlotManager.cc
+++ b/src/common/PlotManager.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PlotManager.cc
\brief Implementation of the Template class PlotManager.
diff --git a/src/common/PlotManager.h b/src/common/PlotManager.h
index 456fbd1..7a477b2 100644
--- a/src/common/PlotManager.h
+++ b/src/common/PlotManager.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PlotManager.h
\brief Definition of the Template class PlotManager.
diff --git a/src/common/PointsHandler.cc b/src/common/PointsHandler.cc
index 4780096..db4b4f5 100644
--- a/src/common/PointsHandler.cc
+++ b/src/common/PointsHandler.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PointsHandler.h
\brief Definition of the Template class PointsHandler.
diff --git a/src/common/PointsHandler.h b/src/common/PointsHandler.h
index aca5ca0..ebb8019 100644
--- a/src/common/PointsHandler.h
+++ b/src/common/PointsHandler.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PointsHandler.h
\brief Definition of the Template class PointsHandler.
diff --git a/src/common/PolarStereographicProjection.cc b/src/common/PolarStereographicProjection.cc
index 991f8eb..27a761b 100644
--- a/src/common/PolarStereographicProjection.cc
+++ b/src/common/PolarStereographicProjection.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreedto in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PolarStereographicProjection.cc
\brief Implementation of PolarStereographicProjection.
@@ -868,7 +858,7 @@ void PolarStereographicProjection::coastSetting(map<string, string>& setting, do
setting["boundaries"] = resol + "/ne_" + resol + "_admin_0_boundary_lines_land";
//! \note Administraive borders hardcoded to 10m resolution (low res version do not contain all info)
- setting["administrative_boundaries"] = "10m/10m_admin_1_states_provinces";
+ setting["administrative_boundaries"] = "10m/ne_10m_admin_1_states_provinces";
MagLog::dev() << "GeoRectangularProjection::coastSetting[" << abswidth << ", " << absheight << "]->" << ratio << " resol: "<<resol<< endl;
}
diff --git a/src/common/PolarStereographicProjection.h b/src/common/PolarStereographicProjection.h
index 595bddf..b68ba81 100644
--- a/src/common/PolarStereographicProjection.h
+++ b/src/common/PolarStereographicProjection.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file PolarStereographicProjection.h
diff --git a/src/common/PolyCoast.h b/src/common/PolyCoast.h
index 4b58ccb..49d8960 100644
--- a/src/common/PolyCoast.h
+++ b/src/common/PolyCoast.h
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PolyCoast.h
\brief Definition of the Template class CoastPlotting.
diff --git a/src/common/Polyline.cc b/src/common/Polyline.cc
index da2ee6b..5e2f32e 100644
--- a/src/common/Polyline.cc
+++ b/src/common/Polyline.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Polyline.cc
\brief Implementation of polyline graphics class (template).
@@ -28,8 +20,6 @@
*/
#include "Polyline.h"
#include "Transformation.h"
-#include "TeCoord2D.h"
-#include "TeGeometryAlgorithms.h"
using namespace magics;
diff --git a/src/common/Polyline.h b/src/common/Polyline.h
index a0c4ffc..d529ad1 100644
--- a/src/common/Polyline.h
+++ b/src/common/Polyline.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Polyline.h
\brief Definition of polyline graphics class.
diff --git a/src/common/ProgressObject.cc b/src/common/ProgressObject.cc
index dd08613..a5170fb 100644
--- a/src/common/ProgressObject.cc
+++ b/src/common/ProgressObject.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File ProgressObject.cc
// Magics Team - ECMWF 2004
diff --git a/src/common/ProgressObject.h b/src/common/ProgressObject.h
index 8d47b08..bc04a03 100644
--- a/src/common/ProgressObject.h
+++ b/src/common/ProgressObject.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File ProgressObject.h
// Magics Team - ECMWF 2004
diff --git a/src/common/ProgressTask.cc b/src/common/ProgressTask.cc
index 74b4a5a..d259577 100644
--- a/src/common/ProgressTask.cc
+++ b/src/common/ProgressTask.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File ProgressTask.cc
// Magics Team - ECMWF 2004
diff --git a/src/common/ProgressTask.h b/src/common/ProgressTask.h
index 1ace422..23cb992 100644
--- a/src/common/ProgressTask.h
+++ b/src/common/ProgressTask.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File ProgressTask.h
// Magics Team - ECMWF 2004
diff --git a/src/common/Proj4Projection.cc b/src/common/Proj4Projection.cc
index 941fe64..d64ea51 100644
--- a/src/common/Proj4Projection.cc
+++ b/src/common/Proj4Projection.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Proj4Projection.cc
\brief Implementation of Proj4Projection.
diff --git a/src/common/Proj4Projection.h b/src/common/Proj4Projection.h
index b48c849..617acad 100644
--- a/src/common/Proj4Projection.h
+++ b/src/common/Proj4Projection.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file Proj4Projection.h
diff --git a/src/common/RasterData.cc b/src/common/RasterData.cc
index 952419d..9ecb04d 100644
--- a/src/common/RasterData.cc
+++ b/src/common/RasterData.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file RasterData.cc
\brief Implementation of the Template class RasterData.
diff --git a/src/common/RasterData.h b/src/common/RasterData.h
index 3cd1a11..b1fadde 100644
--- a/src/common/RasterData.h
+++ b/src/common/RasterData.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file RasterData.h
\brief Definition of the Template class RasterData.
diff --git a/src/common/SatelliteProjection.cc b/src/common/SatelliteProjection.cc
deleted file mode 100644
index d80f9b0..0000000
--- a/src/common/SatelliteProjection.cc
+++ /dev/null
@@ -1,366 +0,0 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
-/*! \file SatelliteProjection.cc
- \brief Implementation of the Template class SatelliteProjection.
-
- Magics Team - ECMWF 2006
-
- Started: Fri 21-Apr-2006
-
- Changes:
-
-*/
-
-
-
-#include "SatelliteProjection.h"
-#include "Polyline.h"
-#include "Text.h"
-#include "GridPlotting.h"
-
-using namespace magics;
-
-class OutMagException
-{
-public:
- OutMagException() {}
- ~OutMagException() {}
-};
-
-SatelliteProjection::SatelliteProjection() :
-// TeSatelliteProjection(TeDatum(), 1, 1, 0.00012565, 0.00012565, 1250, 1250, 0, 0, 42164988.876, 0, 0)
-// TeSatelliteProjection(TeDatum("Spherical",6.371000e+06,0.,0.,0.,0.), 1, 1, 0.00017285102306, 0.00017294945759, 919, 921, 0, 0, 42164988.876, 0, 0) //works for met8.grb
- TeSatelliteProjection(TeDatum("Spherical",6.371000e+06,0.,0.,0.,0.), 1, 1, 0.0174527890614, 0.0174527890636, 928, 926, 0, 0, 42164988.876, 0, 0) //works for met9.grb
-{
-
- minlon_ = -63;
- maxlon_ = 63;
- minlat_ = -80;
- maxlat_ = 80;
-}
-
-void SatelliteProjection::operator()(Layout& layout) const
-{
- TeCoord2D ll = TeCoord2D(minlon_*TeCDR, 0*TeCDR);
- TeCoord2D llxy = const_cast<SatelliteProjection*>(this)->LL2PC(ll);
- llx_ = llxy.x();
- ll = TeCoord2D(0*TeCDR, minlat_*TeCDR);
- llxy = const_cast<SatelliteProjection*>(this)->LL2PC(ll);
- lly_ = llxy.y();
- ll = TeCoord2D(maxlon_*TeCDR, 0*TeCDR);
- llxy = const_cast<SatelliteProjection*>(this)->LL2PC(ll);
- urx_ = llxy.x();
- ll = TeCoord2D(0*TeCDR, maxlat_*TeCDR);
- llxy = const_cast<SatelliteProjection*>(this)->LL2PC(ll);
- ury_ = llxy.y();
-
- ll = TeCoord2D(0*TeCDR, 0*TeCDR);
- llxy = TeCoord2D(0*TeCDR, maxlat_*TeCDR);
-
-//TEST
-#if 1
-TeCoord2D f11 = TeCoord2D(-80*TeCDR, 0*TeCDR);
-TeCoord2D f12 = const_cast<SatelliteProjection*>(this)->LL2PC(f11);
-TeCoord2D f13 = const_cast<SatelliteProjection*>(this)->PC2LL(f12);
-
-TeCoord2D f21 = TeCoord2D(80*TeCDR, 0*TeCDR);
-TeCoord2D f22 = const_cast<SatelliteProjection*>(this)->LL2PC(f21);
-TeCoord2D f23 = const_cast<SatelliteProjection*>(this)->PC2LL(f22);
-
-TeCoord2D f31 = TeCoord2D(0*TeCDR, -85*TeCDR);
-TeCoord2D f32 = const_cast<SatelliteProjection*>(this)->LL2PC(f31);
-TeCoord2D f33 = const_cast<SatelliteProjection*>(this)->PC2LL(f32);
-
-TeCoord2D f41 = TeCoord2D(0*TeCDR, 85*TeCDR);
-TeCoord2D f42 = const_cast<SatelliteProjection*>(this)->LL2PC(f41);
-TeCoord2D f43 = const_cast<SatelliteProjection*>(this)->PC2LL(f42);
-
-f11 = TeCoord2D(-90*TeCDR, 0*TeCDR);
-f12 = const_cast<SatelliteProjection*>(this)->LL2PC(f11);
-f13 = const_cast<SatelliteProjection*>(this)->PC2LL(f12);
-
-f21 = TeCoord2D(90*TeCDR, 0*TeCDR);
-f22 = const_cast<SatelliteProjection*>(this)->LL2PC(f21);
-f23 = const_cast<SatelliteProjection*>(this)->PC2LL(f22);
-
-f31 = TeCoord2D(0*TeCDR, -90*TeCDR);
-f32 = const_cast<SatelliteProjection*>(this)->LL2PC(f31);
-f33 = const_cast<SatelliteProjection*>(this)->PC2LL(f32);
-
-f41 = TeCoord2D(0*TeCDR, 90*TeCDR);
-f42 = const_cast<SatelliteProjection*>(this)->LL2PC(f41);
-f43 = const_cast<SatelliteProjection*>(this)->PC2LL(f42);
-#endif
-
- double width = abs(urx_ - llx_);
- double shiftx = width*0.05;
- double height = abs(ury_ - lly_);
- double shifty = height*0.05;
-
-
- width += 2*shiftx;
- height += 2*shifty;
- llx_ -= shiftx;
- urx_ += shiftx;
- lly_ -= shifty;
- ury_ += shifty;
-
-
-
- setAspectRatio(layout, width, height, llx_, urx_, lly_, ury_);
- // The left bozx and right are 4 % ..
- double boxWidth_ = width/100*4;
-
-
-
- if (layout["drawing_area"]) layout["drawing_area"]->setCoordinates(llx_, urx_, lly_, ury_);
- if (layout["top_comment_box"]) layout["top_comment_box"]->setCoordinates(llx_, urx_, ury_- 100, ury_ + 100);
- if (layout["bottom_comment_box"]) layout["bottom_comment_box"]->setCoordinates(llx_, urx_, lly_- 100, lly_ + 100);
- if (layout["left_comment_box"]) layout["left_comment_box"]->setCoordinates(llx_-boxWidth_, llx_+boxWidth_, lly_, ury_);
- if (layout["right_comment_box"]) layout["right_comment_box"]->setCoordinates(urx_-boxWidth_, urx_+boxWidth_, lly_, ury_);
-// if (layout["title"]) layout["title"]->setCoordinates(0, 100, 0, 100);
-// if (layout["legend"]) layout["legend"]->setCoordinates(0, 100, 0, 100);
-
-
-}
-
-SatelliteProjection::~SatelliteProjection()
-{
-}
-
-/*!
- Class information are given to the output-stream.
-*/
-void SatelliteProjection::print(ostream& out) const
-{
- out << "SatelliteProjection[";
- out << "]";
-}
-
-void SatelliteProjection::operator()(const Polyline& from, BaseGraphicsObject::Container& out) const
-{
- Polyline* to = new Polyline();
- to->copy(from);
-
- for (Polyline::const_iterator point = from.begin(); point != from.end(); ++point) {
- PaperPoint pp = (*this)(*point);
- if (pp.x() != TeMAXFLOAT && pp.y() != TeMAXFLOAT )
- to->push_back(pp);
- else {
- if ( !to->empty()) {
- out.push_back(to);
- to = new Polyline();
- to->copy(from);
- }
- }
-
- }
- if ( !to->empty())
- out.push_back(to);
-}
-
-void SatelliteProjection::operator()(const Text<UserPoint>& from, Text& to) const
-{
- for (Text<UserPoint>::const_iterator point = from.begin(); point != from.end(); ++point) {
- PaperPoint pp = (*this)(*point);
- if (pp.x() != TeMAXFLOAT && pp.y() != TeMAXFLOAT)
- to.push_back((*this)(pp));
- }
-}
-
-void SatelliteProjection::operator()(const vector<UserPoint>& from, vector<PaperPoint>& to) const
-{
- for (vector<UserPoint>::const_iterator point = from.begin(); point != from.end(); ++point) {
- PaperPoint pp = (*this)(*point);
- if (pp.x() != TeMAXFLOAT && pp.y() != TeMAXFLOAT)
- to.push_back((*this)(pp));
- }
-}
-
-void SatelliteProjection::operator()(const vector<PaperPoint>&, vector<PaperPoint>&) const
-{
-}
-
-
-
-Polyline* SatelliteProjection::reproject(const Polyline& from) const
-{
- Polyline* to = new Polyline();
-
- //(*this)(from, *to);
- return to;
-}
-
-bool SatelliteProjection::in(double lon, double lat) const
-{
- if ( lon < minlon_ ) return false;
- if ( lat < minlat_ ) return false;
- if ( lon > maxlon_ ) return true;
- if ( lat > maxlat_ ) return true;
- return true;
-}
-
-
-PaperPoint SatelliteProjection::operator()(const UserPoint& from) const
-{
- TeCoord2D geo = TeCoord2D(RAD(from.x_), RAD(from.y_));
- TeCoord2D xy = const_cast<SatelliteProjection*>(this)->LL2PC(geo);
- //MagLog::dev()<< "SatelliteProjection::operator() " << from.x_ << " " << from.y_ << " " << xy.x() << " " << xy.y() << endl;
- return PaperPoint(xy.x(), xy.y());
-}
-
-PaperPoint SatelliteProjection::operator()(const PaperPoint& point) const
-{
- return point;
-}
-
-UserPoint SatelliteProjection::revert(const PaperPoint& from) const
-{
- TeCoord2D xy = TeCoord2D(from.x(), from.y());
- TeCoord2D geo = const_cast<SatelliteProjection*>(this)->PC2LL(xy);
-
- return UserPoint(geo.x()*TeCRD, geo.y()*TeCRD);
-}
-
-
-void SatelliteProjection::gridLongitudes(const GridPlotting& grid, Task& task) const
-{
-#if 1
- const vector<double>& longitudes = grid.longitudes();
- for (vector<double>::const_iterator lon = longitudes.begin(); lon != longitudes.end(); ++lon) {
- Polyline* poly = new Polyline(grid.layer(), "drawing_area");
- grid.add(poly, task);
-
-
- for (double lat = -80; lat <= 80; lat += 1) {
- poly->push_back(UserPoint(*lon,lat));
- }
-
- }
-
-
- Polyline* poly = new Polyline(grid.layer(), "drawing_area");
- grid.add(poly, task);
- poly->setColour(Colour("green"));
-
- for (double lat = -80; lat <= 80; lat += 1) {
- poly->push_back(UserPoint(-73,lat));
- }
-
- poly = new Polyline(grid.layer(), "drawing_area");
- grid.add(poly, task);
- poly->setColour(Colour("green"));
-
- for (double lat = -80; lat <= 80; lat += 1) {
- poly->push_back(UserPoint(73,lat));
- }
-#endif
-#if 0
- poly = new Polyline(grid.layer(), "drawing_area");
- grid.add(poly, task);
- poly->setColour(Colour("green"));
-
- for (double lat = -80; lat <= 80; lat += 1) {
- poly->push_back(UserPoint(-50,lat));
- }
- poly = new Polyline(grid.layer(), "drawing_area");
- grid.add(poly, task);
- poly->setColour(Colour("green"));
-
- for (double lat = -80; lat <= 80; lat += 1) {
- poly->push_back(UserPoint(50,lat));
- }
-
- poly = new Polyline(grid.layer(), "drawing_area");
- grid.add(poly, task);
- poly->setColour(Colour("green"));
-
- for (double lat = -80; lat <= 80; lat += 1) {
- poly->push_back(UserPoint(-30,lat));
- }
- poly = new Polyline(grid.layer(), "drawing_area");
- grid.add(poly, task);
- poly->setColour(Colour("green"));
-
- for (double lat = -80; lat <= 80; lat += 1) {
- poly->push_back(UserPoint(30,lat));
- }
-
- poly = new Polyline(grid.layer(), "drawing_area");
- grid.add(poly, task);
- poly->setColour(Colour("green"));
-
- for (double lat = -80; lat <= 80; lat += 1) {
- poly->push_back(UserPoint(-10,lat));
- }
-
- poly = new Polyline(grid.layer(), "drawing_area");
- grid.add(poly, task);
- poly->setColour(Colour("green"));
-
- for (double lat = -80; lat <= 80; lat += 1) {
- poly->push_back(UserPoint(10,lat));
- }
-#endif
-}
-
-void SatelliteProjection::gridLatitudes(const GridPlotting& grid, Task& task) const
-{
-#if 1
- const vector<double>& latitudes = grid.latitudes();
-
-
- for (vector<double>::const_iterator lat = latitudes.begin(); lat != latitudes.end(); ++lat) {
-
- Polyline* poly = new Polyline(grid.layer(), "drawing_area");
- for (double lon = minlon_; lon <= maxlon_; lon += 1) {
- poly->push_back(UserPoint(lon,*lat));
- }
- grid.add(poly, task);
- }
-#endif
-
-#if 0
-//Test
-Polyline* poly = new Polyline(grid.layer(), "drawing_area");
- poly->setColour(Colour("yellow"));
-for (double lon = -40; lon <= 40; lon += 1) {
- poly->push_back(UserPoint(lon,0));
- }
-grid.add(poly, task);
-#endif
-}
-
-
-void SatelliteProjection::topLabels(const LabelPlotting&, Task&) const
-{
-}
-
-void SatelliteProjection::bottomLabels(const LabelPlotting&, Task&) const
-{
-}
-
-void SatelliteProjection::leftLabels(const LabelPlotting&, Task&) const
-{
-}
-
-void SatelliteProjection::rightLabels(const LabelPlotting&, Task&) const
-{
-}
-
diff --git a/src/common/SatelliteProjection.h b/src/common/SatelliteProjection.h
deleted file mode 100644
index b2d94de..0000000
--- a/src/common/SatelliteProjection.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
-/*! \file SatelliteProjection.h
- \brief Definition of the Template class SatelliteProjection.
-
- Magics Team - ECMWF 2006
-
- Started: Fri 21-Apr-2006
-
- Changes:
-
-*/
-
-#ifndef SatelliteProjection_H
-#define SatelliteProjection_H
-
-#include "magics.h"
-
-#include "Transformation.h"
-#include "SatelliteProjectionAttributes.h"
-#include "TeProjection.h"
-
-namespace magics {
-
-
-/*! \class SatelliteProjection
- \brief Implements a new projection for satellite data
- \ingroup projection
-
- This projection ...
-*/
-class SatelliteProjection: public Transformation,
- public TeSatelliteProjection,
- public SatelliteProjectionAttributes
-{
-
-public:
- SatelliteProjection();
- virtual ~SatelliteProjection();
-
- void set(const map<string, string>& map) {
- SatelliteProjectionAttributes::set(map);
- Transformation::set(map);
- }
-
- void set(const XmlNode& node) {
- SatelliteProjectionAttributes::set(node);
- }
-
- bool accept(const string& node) { return SatelliteProjectionAttributes::accept(node); }
-
- virtual Transformation* clone() const {
- SatelliteProjection* object = new SatelliteProjection();
- object->copy(*this);
- return object;
- }
-
-
- void operator()(const Polyline&, BasicGraphicsObject::Container&) const;
- void operator()(const Text<UserPoint>&, Text&) const;
- void operator()(const vector<UserPoint>&, vector<PaperPoint>&) const;
- void operator()(const vector<PaperPoint>&, vector<PaperPoint>&) const;
-
- virtual TeProjection& getProjection() { return *this; }
-
- virtual Polyline* reproject(const Polyline& from) const;
-
- virtual bool in(double x, double y) const;
-
-
- // implements the Transformation
- virtual void operator()(Layout&) const;
- virtual PaperPoint operator()(const UserPoint&) const;
- virtual PaperPoint operator()(const PaperPoint&) const;
- virtual UserPoint revert(const PaperPoint&) const;
-
- virtual void gridLongitudes(const GridPlotting&, Task&) const;
- virtual void gridLatitudes(const GridPlotting&, Task&) const;
-
- virtual void topLabels(const LabelPlotting&, Task&) const;
- virtual void bottomLabels(const LabelPlotting&, Task&) const;
- virtual void leftLabels(const LabelPlotting&, Task&) const;
- virtual void rightLabels(const LabelPlotting&, Task&) const;
-
- void horizontalLabels(const LabelPlotting&, Task&, const string& box, double x, double miny, double maxy) const;
- void verticalLabels(const LabelPlotting&, Task&, const string& box, double y, double minx, double maxy) const;
-
-
- virtual double getMinX() const { return minlon_; }
- virtual double getMaxX() const { return maxlon_; }
- virtual double getMinY() const { return minlat_; }
- virtual double getMaxY() const { return maxlat_; }
-
- virtual double getMinPCX() const { return llx_; }
- virtual double getMaxPCX() const { return urx_; }
- virtual double getMinPCY() const { return lly_; }
- virtual double getMaxPCY() const { return ury_; }
-
-protected:
- //! Method to print string about this class on to a stream of type ostream (virtual).
- virtual void print(ostream&) const;
-
- mutable double llx_;
- mutable double lly_;
- mutable double urx_;
- mutable double ury_;
-
- mutable double minlon_;
- mutable double maxlon_;
- mutable double minlat_;
- mutable double maxlat_;
-
-private:
- //! Copy constructor - No copy allowed
- SatelliteProjection(const SatelliteProjection&);
- //! Overloaded << operator to copy - No copy allowed
- SatelliteProjection& operator=(const SatelliteProjection&);
-
-// -- Friends
- //! Overloaded << operator to call print().
- friend ostream& operator<<(ostream& s,const SatelliteProjection& p)
- { p.print(s); return s; }
-};
-
-} // namespace magics
-#endif
diff --git a/src/common/SciMethods.cc b/src/common/SciMethods.cc
index b2fdd25..8196268 100644
--- a/src/common/SciMethods.cc
+++ b/src/common/SciMethods.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file SciMethods.cc
diff --git a/src/common/SciMethods.h b/src/common/SciMethods.h
index 3d21131..bb8c581 100644
--- a/src/common/SciMethods.h
+++ b/src/common/SciMethods.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file SciMethods.h
diff --git a/src/common/Seconds.cc b/src/common/Seconds.cc
index 8c884ef..c6d64cb 100644
--- a/src/common/Seconds.cc
+++ b/src/common/Seconds.cc
@@ -1,23 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
-
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "Seconds.h"
diff --git a/src/common/Seconds.h b/src/common/Seconds.h
index 3183601..17c2fd0 100644
--- a/src/common/Seconds.h
+++ b/src/common/Seconds.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File Seconds.h
// Baudouin Raoult - ECMWF Jul 96
diff --git a/src/common/Static.cc b/src/common/Static.cc
index 535d9d6..342a09c 100644
--- a/src/common/Static.cc
+++ b/src/common/Static.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "Static.h"
#include "MagException.h"
diff --git a/src/common/Static.h b/src/common/Static.h
index 41ada13..f8f5695 100644
--- a/src/common/Static.h
+++ b/src/common/Static.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef Static_H
#define Static_H
diff --git a/src/common/Symbol.cc b/src/common/Symbol.cc
index ffc4f3f..c9d7fac 100644
--- a/src/common/Symbol.cc
+++ b/src/common/Symbol.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Symbol.cc
\brief Implementation of Symbol graphics class (template).
diff --git a/src/common/Symbol.h b/src/common/Symbol.h
index e98d0cc..fa289c5 100644
--- a/src/common/Symbol.h
+++ b/src/common/Symbol.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Symbol.h
\brief Definition of Symbol graphics class.
diff --git a/src/common/SymbolItem.cc b/src/common/SymbolItem.cc
index 01cea66..6e20ec0 100644
--- a/src/common/SymbolItem.cc
+++ b/src/common/SymbolItem.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file GraphicItem.cc
\brief Implementation of the Template class GraphicItem.
diff --git a/src/common/SymbolItem.h b/src/common/SymbolItem.h
index 135f0ea..909fe03 100644
--- a/src/common/SymbolItem.h
+++ b/src/common/SymbolItem.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file SymbolItem.h
\brief Definition of the Template class SymbolItem.
@@ -104,6 +114,8 @@ public:
double length() const { return length_; }
void length(double length) { length_ = length; }
+ double thickness() const { return thickness_; }
+ void thickness(double thickness) { thickness_ = thickness; }
void speed(double speed) { speed_ = speed; }
double speed() const { return speed_; }
diff --git a/src/common/TableDefinition.h b/src/common/TableDefinition.h
index 03044ef..fb3c89d 100644
--- a/src/common/TableDefinition.h
+++ b/src/common/TableDefinition.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TableDefinition.h
\brief Definition of the Template class TableDefinition.
diff --git a/src/common/TableDefinitionCompute.cc b/src/common/TableDefinitionCompute.cc
index 5ca18e5..f355768 100644
--- a/src/common/TableDefinitionCompute.cc
+++ b/src/common/TableDefinitionCompute.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TableDefinitionCompute.cc
\brief Implementation of the Template class TableDefinitionCompute.
diff --git a/src/common/TableDefinitionCompute.h b/src/common/TableDefinitionCompute.h
index fbbf6a5..562f2e9 100644
--- a/src/common/TableDefinitionCompute.h
+++ b/src/common/TableDefinitionCompute.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TableDefinitionCompute.h
\brief Definition of the Template class TableDefinitionCompute.
diff --git a/src/common/TableDefinitionComputeInterface.h b/src/common/TableDefinitionComputeInterface.h
index a9967e0..b9cc6a9 100644
--- a/src/common/TableDefinitionComputeInterface.h
+++ b/src/common/TableDefinitionComputeInterface.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TableDefinitionComputeInterface.h
\brief Definition of the Template class TableDefinitionComputeInterface.
diff --git a/src/common/TableDefinitionList.cc b/src/common/TableDefinitionList.cc
index e30a5d4..021b645 100644
--- a/src/common/TableDefinitionList.cc
+++ b/src/common/TableDefinitionList.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TableDefinitionList.cc
\brief Implementation of the Template class TableDefinitionList.
diff --git a/src/common/TableDefinitionList.h b/src/common/TableDefinitionList.h
index 7df1896..5ed1e9e 100644
--- a/src/common/TableDefinitionList.h
+++ b/src/common/TableDefinitionList.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TableDefinitionList.h
\brief Definition of the Template class TableDefinitionList.
diff --git a/src/common/TableDefinitionListInterface.h b/src/common/TableDefinitionListInterface.h
index 25492c9..08be853 100644
--- a/src/common/TableDefinitionListInterface.h
+++ b/src/common/TableDefinitionListInterface.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TableDefinitionListInterface.h
\brief Definition of the Template class TableDefinitionListInterface.
diff --git a/src/common/Task.cc b/src/common/Task.cc
index d047dae..ddca87c 100644
--- a/src/common/Task.cc
+++ b/src/common/Task.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef Task_H
#include "Task.h"
diff --git a/src/common/Task.h b/src/common/Task.h
index aaa446f..fc465ef 100644
--- a/src/common/Task.h
+++ b/src/common/Task.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File Task.h
// Baudouin Raoult - ECMWF May 96
diff --git a/src/common/TaylorProjection.cc b/src/common/TaylorProjection.cc
index 1dbf4a9..ef69816 100644
--- a/src/common/TaylorProjection.cc
+++ b/src/common/TaylorProjection.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TaylorProjection.cc
\brief Implementation of TaylorProjection.
diff --git a/src/common/TaylorProjection.h b/src/common/TaylorProjection.h
index 37bc935..1b821d4 100644
--- a/src/common/TaylorProjection.h
+++ b/src/common/TaylorProjection.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file TaylorProjection.h
diff --git a/src/common/Tephigram.cc b/src/common/Tephigram.cc
index 8445d9e..91aa55d 100644
--- a/src/common/Tephigram.cc
+++ b/src/common/Tephigram.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Tephigram.cc
\brief Implementation of Tephigram.
diff --git a/src/common/Tephigram.h b/src/common/Tephigram.h
index 2a21524..c678766 100644
--- a/src/common/Tephigram.h
+++ b/src/common/Tephigram.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file Tephigram.h
diff --git a/src/common/Text.cc b/src/common/Text.cc
index 85da3da..56d8a11 100644
--- a/src/common/Text.cc
+++ b/src/common/Text.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Text.cc
\brief Implementation of Text graphics class (template).
diff --git a/src/common/Text.h b/src/common/Text.h
index 6ecb4e0..1a653eb 100644
--- a/src/common/Text.h
+++ b/src/common/Text.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Text.h
\brief Definition of Text graphics class.
diff --git a/src/common/Thread.cc b/src/common/Thread.cc
index 1e4eb6a..e9bd3a0 100644
--- a/src/common/Thread.cc
+++ b/src/common/Thread.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef marsmachine_H
#include "marsmachine.h"
diff --git a/src/common/Thread.h b/src/common/Thread.h
index 93749cd..169a2ae 100644
--- a/src/common/Thread.h
+++ b/src/common/Thread.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File Thread.h
// Baudouin Raoult - ECMWF Jun 96
diff --git a/src/common/ThreadControler.cc b/src/common/ThreadControler.cc
index 3f6fc31..3d6e8fc 100644
--- a/src/common/ThreadControler.cc
+++ b/src/common/ThreadControler.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef marsmachine_H
#include "marsmachine.h"
diff --git a/src/common/ThreadControler.h b/src/common/ThreadControler.h
index 61a6583..852c3eb 100644
--- a/src/common/ThreadControler.h
+++ b/src/common/ThreadControler.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File ThreadControler.h
// Baudouin Raoult - ECMWF May 96
diff --git a/src/common/ThreadSingleton.cc b/src/common/ThreadSingleton.cc
index 2eec3cf..bb0e470 100755
--- a/src/common/ThreadSingleton.cc
+++ b/src/common/ThreadSingleton.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef marsmachine_H
#include "marsmachine.h"
diff --git a/src/common/ThreadSingleton.h b/src/common/ThreadSingleton.h
index 58d0cae..ad54d54 100755
--- a/src/common/ThreadSingleton.h
+++ b/src/common/ThreadSingleton.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File ThreadSingleton.h
// Baudouin Raoult - ECMWF Jun 96
diff --git a/src/common/Timer.cc b/src/common/Timer.cc
index 102b934..891c353 100644
--- a/src/common/Timer.cc
+++ b/src/common/Timer.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef marsmachine_H
#include "magics.h"
diff --git a/src/common/Timer.h b/src/common/Timer.h
index 5dc8699..b4f66a9 100644
--- a/src/common/Timer.h
+++ b/src/common/Timer.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File Timer.h
// Baudouin Raoult - ECMWF May 96
diff --git a/src/common/Tokenizer.cc b/src/common/Tokenizer.cc
index 93a6327..42d8db0 100644
--- a/src/common/Tokenizer.cc
+++ b/src/common/Tokenizer.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef Tokenizer_H
#include "Tokenizer.h"
diff --git a/src/common/Tokenizer.h b/src/common/Tokenizer.h
index 7bd255b..90ea0d2 100644
--- a/src/common/Tokenizer.h
+++ b/src/common/Tokenizer.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File Tokenizer.h
// Manuel Fuentes - ECMWF Jan 97
diff --git a/src/common/Transformation.cc b/src/common/Transformation.cc
index bf5ac2c..7f30040 100644
--- a/src/common/Transformation.cc
+++ b/src/common/Transformation.cc
@@ -1,15 +1,12 @@
-
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// File Transformation.cc
// Magics Team - ECMWF 2004
diff --git a/src/common/Transformation.h b/src/common/Transformation.h
index a43b0f4..e7b33f7 100644
--- a/src/common/Transformation.h
+++ b/src/common/Transformation.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \defgroup projections Geographical projections
@@ -35,7 +27,7 @@ Currently Magics++ supports following projections:
- add this file in <i>src/xml/Makefile.am</i>
- add <i>NewProjection.cc/.h</i> in <i>src/drivers/common/</i>,
- inheriting from Transformation, NewProjectionParameters and a relevant Terralib class
+ inheriting from Transformation, NewProjectionParameters
- add the new files in <i>src/common/Makefile.am</i>
diff --git a/src/common/UserPoint.h b/src/common/UserPoint.h
index a49fc1b..e9d56cf 100644
--- a/src/common/UserPoint.h
+++ b/src/common/UserPoint.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file UserPoint.h
\brief Definition of Point (x, y, z, v).
diff --git a/src/common/Visualiser.h b/src/common/Visualiser.h
index f2f62ec..164bab9 100644
--- a/src/common/Visualiser.h
+++ b/src/common/Visualiser.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Visualiser.h
\brief Definition of the Template class Visualiser.
diff --git a/src/common/XCoordinate.h b/src/common/XCoordinate.h
index 5958ccf..dd45f78 100644
--- a/src/common/XCoordinate.h
+++ b/src/common/XCoordinate.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XCoordinate.h
\brief Definition of the Template class XCoordinate.
diff --git a/src/common/XmlNode.cc b/src/common/XmlNode.cc
index a69dea9..4115bb1 100644
--- a/src/common/XmlNode.cc
+++ b/src/common/XmlNode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XmlNode.cc
\brief Implementation of the Template class XmlNode.
diff --git a/src/common/XmlNode.h b/src/common/XmlNode.h
index e599d6e..63242ee 100644
--- a/src/common/XmlNode.h
+++ b/src/common/XmlNode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XmlNode.h
\brief Definition of the Template class XmlNode.
diff --git a/src/common/XmlReader.cc b/src/common/XmlReader.cc
index 8a87ab9..95c157a 100644
--- a/src/common/XmlReader.cc
+++ b/src/common/XmlReader.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XmlReader.cc
\brief Implementation of the Reader for Xml.
diff --git a/src/common/XmlReader.h b/src/common/XmlReader.h
index ae61151..06a7114 100644
--- a/src/common/XmlReader.h
+++ b/src/common/XmlReader.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XmlReader.h
\brief Definition of the Template class XmlReader.
diff --git a/src/common/XmlTree.cc b/src/common/XmlTree.cc
index 2ec6ed0..f588a86 100644
--- a/src/common/XmlTree.cc
+++ b/src/common/XmlTree.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XmlTree.h
\brief Implementation of the Template class XmlTree.
diff --git a/src/common/XmlTree.h b/src/common/XmlTree.h
index 06ba1e0..b796433 100644
--- a/src/common/XmlTree.h
+++ b/src/common/XmlTree.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XmlTree.h
\brief Definition of the Template class XmlTree.
diff --git a/src/common/YCoordinate.h b/src/common/YCoordinate.h
index 363ca83..3b5a8e4 100644
--- a/src/common/YCoordinate.h
+++ b/src/common/YCoordinate.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XCoordinate.h
\brief Definition of the Template class XCoordinate.
diff --git a/src/common/aix.h b/src/common/aix.h
index d15b3e8..42cead3 100644
--- a/src/common/aix.h
+++ b/src/common/aix.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef MagicsAIX_H
#define MagicsAIX_H
diff --git a/src/common/linux.h b/src/common/linux.h
index b0e75c2..cfbf46d 100644
--- a/src/common/linux.h
+++ b/src/common/linux.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include <stdio.h>
#include <pthread.h>
diff --git a/src/common/machine.h b/src/common/machine.h
deleted file mode 100644
index e69de29..0000000
diff --git a/src/common/magics_api.h b/src/common/magics_api.h
index 7cc59bb..17ba06f 100644
--- a/src/common/magics_api.h
+++ b/src/common/magics_api.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file magics_api.h
\brief Implementation of C interface
diff --git a/src/common/marsmachine.h b/src/common/marsmachine.h
index 03a1628..1c6da51 100644
--- a/src/common/marsmachine.h
+++ b/src/common/marsmachine.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef marsmachine_H
#define marsmachine_H
diff --git a/src/decoders/BinningObject.cc b/src/decoders/BinningObject.cc
index 418f239..389c639 100644
--- a/src/decoders/BinningObject.cc
+++ b/src/decoders/BinningObject.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file BinningObject.cc
\brief Implementation of the Template class BinningObject.
diff --git a/src/decoders/BinningObject.h b/src/decoders/BinningObject.h
index eca8618..7f1cebe 100644
--- a/src/decoders/BinningObject.h
+++ b/src/decoders/BinningObject.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file BinningObject.h
\brief Definition of the Template class BinningObject.
diff --git a/src/decoders/BoxPlotDecoder.cc b/src/decoders/BoxPlotDecoder.cc
index bccb7f1..71ec955 100644
--- a/src/decoders/BoxPlotDecoder.cc
+++ b/src/decoders/BoxPlotDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BoxPlotDecoder.h
\brief Implementation of the Template class BoxPlotDecoder.
diff --git a/src/decoders/BoxPlotDecoder.h b/src/decoders/BoxPlotDecoder.h
index ac9063a..e52b36f 100644
--- a/src/decoders/BoxPlotDecoder.h
+++ b/src/decoders/BoxPlotDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BoxPlotDecoder.h
\brief Definition of the Template class BoxPlotDecoder.
diff --git a/src/decoders/ClassicMtgDecoder.cc b/src/decoders/ClassicMtgDecoder.cc
index 3154c0f..d67f24c 100644
--- a/src/decoders/ClassicMtgDecoder.cc
+++ b/src/decoders/ClassicMtgDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ClassicMtgDecoder.cc
\brief Implementation of the Template class ClassicMtgDecoder.
@@ -336,7 +328,7 @@ void MetgramParameter::interpretResult(spot_query_result* result, vector<Customi
values[info->second] = 0;
rain = true;
}
- if ( !isnan(values[info->second]) && values[info->second] < missing ) {
+ if ( !std::isnan(values[info->second]) && values[info->second] < missing ) {
(*point)[key] = (*this)(values[info->second]);
ypos.push_back( (*this)(values[info->second]));
if (rain) (*point)["as_rain"] = 1;
@@ -347,12 +339,9 @@ void MetgramParameter::interpretResult(spot_query_result* result, vector<Customi
MagLog::warning() << " SPOTBASE returns nan for " << info->first << " : data ignored for step " << (*point)["shift"]<< endl;
ok = false;
}
-
-
}
nb=1024;
-
}
@@ -650,8 +639,6 @@ void ClassicMtgDecoder::moreTitle(TextVisitor& title)
lines.push_back(landsea + " (" + resolution_ + ")" );
-
-
lines.push_back("");
for ( vector<string>::const_iterator line = lines.begin(); line != lines.end(); ++line)
@@ -663,8 +650,6 @@ void ClassicMtgDecoder::visit(Transformation& transformation)
decode();
ASSERT(parameter_);
- parameter_->setTransformation(transformation);
-
-
+ parameter_->setTransformation(transformation);
}
diff --git a/src/decoders/ClassicMtgDecoder.h b/src/decoders/ClassicMtgDecoder.h
index 94dfe0f..ba7e4cf 100644
--- a/src/decoders/ClassicMtgDecoder.h
+++ b/src/decoders/ClassicMtgDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ClassicMtgDecoder.h
\brief Definition of the Template class ClassicMtgDecoder.
diff --git a/src/decoders/Date.cc b/src/decoders/Date.cc
index 7ef4440..143c5a6 100644
--- a/src/decoders/Date.cc
+++ b/src/decoders/Date.cc
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "MagException.h"
#include "DateTime.h"
diff --git a/src/decoders/DateTime.cc b/src/decoders/DateTime.cc
index 15e7e8c..8bc6b97 100644
--- a/src/decoders/DateTime.cc
+++ b/src/decoders/DateTime.cc
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "DateTime.h"
diff --git a/src/decoders/DateTime.h b/src/decoders/DateTime.h
index bc09075..43d782a 100644
--- a/src/decoders/DateTime.h
+++ b/src/decoders/DateTime.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
// Baudouin Raoult - ECMWF Sep 96
diff --git a/src/decoders/EfiLegendEntry.h b/src/decoders/EfiLegendEntry.h
index db43bc1..861ce65 100644
--- a/src/decoders/EfiLegendEntry.h
+++ b/src/decoders/EfiLegendEntry.h
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SpotDecoder.h
\brief Implementation of the Template class SpotDecoder.
diff --git a/src/decoders/EpsBufr.cc b/src/decoders/EpsBufr.cc
index be86995..c047da3 100644
--- a/src/decoders/EpsBufr.cc
+++ b/src/decoders/EpsBufr.cc
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SpotDecoder.h
\brief Implementation of the Template class SpotDecoder.
diff --git a/src/decoders/EpsBufr.h b/src/decoders/EpsBufr.h
index fc9e70a..8517093 100644
--- a/src/decoders/EpsBufr.h
+++ b/src/decoders/EpsBufr.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file EpsgramDecoder.h
\brief Definition of the Template class EpsgramDecoder.
diff --git a/src/decoders/EpsXmlInput.cc b/src/decoders/EpsXmlInput.cc
index 25d4a7c..861a71e 100644
--- a/src/decoders/EpsXmlInput.cc
+++ b/src/decoders/EpsXmlInput.cc
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SpotDecoder.h
\brief Implementation of the Template class SpotDecoder.
diff --git a/src/decoders/EpsXmlInput.h b/src/decoders/EpsXmlInput.h
index 0bfb1fc..5349e1b 100644
--- a/src/decoders/EpsXmlInput.h
+++ b/src/decoders/EpsXmlInput.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file EpsgramDecoder.h
\brief Definition of the Template class EpsgramDecoder.
diff --git a/src/decoders/EpsgramDecoder.cc b/src/decoders/EpsgramDecoder.cc
index be3c652..d13af5f 100644
--- a/src/decoders/EpsgramDecoder.cc
+++ b/src/decoders/EpsgramDecoder.cc
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SpotDecoder.h
\brief Implementation of the Template class SpotDecoder.
@@ -1107,7 +1098,7 @@ void EpsParameter::interpretResult(spot_query_result* result, vector<CustomisedP
if ( type_ == "eps15" )
specific15(*point);
- if ( !isnan(values[info->second]) ) {
+ if ( !std::isnan(values[info->second]) ) {
(*point)[x(prefix_, info->first)] = (*this)(values[info->second], info->first);
//MagLog::debug() << x(info->first) << "----->" << (*this)(values[info->second], info->first) << endl;
diff --git a/src/decoders/EpsgramDecoder.h b/src/decoders/EpsgramDecoder.h
index 733802d..6736596 100644
--- a/src/decoders/EpsgramDecoder.h
+++ b/src/decoders/EpsgramDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file EpsgramDecoder.h
\brief Definition of the Template class EpsgramDecoder.
diff --git a/src/decoders/GeoPointsDecoder.cc b/src/decoders/GeoPointsDecoder.cc
index 485cfaf..2491efd 100644
--- a/src/decoders/GeoPointsDecoder.cc
+++ b/src/decoders/GeoPointsDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GeoPointsDecoder.cc
\brief Implementation of the Template class GeoPointsDecoder.
diff --git a/src/decoders/GeoPointsDecoder.h b/src/decoders/GeoPointsDecoder.h
index 2dcd8d1..c1710da 100644
--- a/src/decoders/GeoPointsDecoder.h
+++ b/src/decoders/GeoPointsDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GeoPointsDecoder.h
\brief Definition of the Template class GeoPointsDecoder.
diff --git a/src/decoders/Grib b/src/decoders/Grib
deleted file mode 100644
index e69de29..0000000
diff --git a/src/decoders/GribAddressMode.h b/src/decoders/GribAddressMode.h
index 309ad90..37670ab 100644
--- a/src/decoders/GribAddressMode.h
+++ b/src/decoders/GribAddressMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GribAddressMode.h
\brief Definition of the Template class GribAddressMode.
diff --git a/src/decoders/GribDecoder.cc b/src/decoders/GribDecoder.cc
index b59cca2..a5c7f83 100644
--- a/src/decoders/GribDecoder.cc
+++ b/src/decoders/GribDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GribDecoder.cc
\brief Implementation of the class GribDecoder.
diff --git a/src/decoders/GribDecoder.h b/src/decoders/GribDecoder.h
index f995d04..3fff343 100644
--- a/src/decoders/GribDecoder.h
+++ b/src/decoders/GribDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GribDecoder.h
\brief Definition of the Template class GribDecoder.
diff --git a/src/decoders/GribInterpretor.h b/src/decoders/GribInterpretor.h
index 4f1d630..20da974 100644
--- a/src/decoders/GribInterpretor.h
+++ b/src/decoders/GribInterpretor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GribInterpretor.h
\brief Definition of the Template class GribInterpretor.
diff --git a/src/decoders/GribLoopStep.cc b/src/decoders/GribLoopStep.cc
index 46c033f..5ce9dc8 100644
--- a/src/decoders/GribLoopStep.cc
+++ b/src/decoders/GribLoopStep.cc
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "GribLoopStep.h"
#include "GribDecoder.h"
diff --git a/src/decoders/GribLoopStep.h b/src/decoders/GribLoopStep.h
index 2df2d23..6095a3a 100644
--- a/src/decoders/GribLoopStep.h
+++ b/src/decoders/GribLoopStep.h
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GribLoopStep.h
\brief Definition of the Template class GribLoopStep
diff --git a/src/decoders/GribRegularInterpretor.cc b/src/decoders/GribRegularInterpretor.cc
index d1df300..40096f4 100644
--- a/src/decoders/GribRegularInterpretor.cc
+++ b/src/decoders/GribRegularInterpretor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GribRegularInterpretor.cc
\brief Implementation of the Template class GribRegularInterpretor.
@@ -28,7 +20,6 @@
#include <limits>
#include "CustomisedPoint.h"
-#include "TeProjection.h"
#include "GribRegularInterpretor.h"
#include "GribDecoder.h"
#include "Matrix.h"
@@ -1856,7 +1847,6 @@ void GribRotatedInterpretor::interpret2D(double& lat, double& lon, double& uc,
// we the angle and the spped we compute u/v...
uc = speed * cos(rangle);
vc = speed * sin(rangle);
-
}
void GribRotatedInterpretor::raw(const GribDecoder& grib,
@@ -1886,14 +1876,10 @@ void GribRotatedInterpretor::raw(const GribDecoder& grib,
value = (value*factor)+offset;
transformation.populate(lon, lat, value, points);
*/
-
}
-
}
-
/* At the end the iterator is deleted to free memory. */
grib_iterator_delete(iter);
-
}
void GribLambertInterpretor::interpretAsMatrix(const GribDecoder& grib,
@@ -2005,8 +1991,6 @@ void GribLambertInterpretor::interpretAsMatrix(const GribDecoder& grib,
row++;
}
-
-
double lat11, lat12, lat21, lat22;
double lon11, lon12, lon21, lon22;
double val11, val12, val21, val22;
@@ -2080,14 +2064,14 @@ void GribLambertInterpretor::interpretAsMatrix(const GribDecoder& grib,
double val2 = ((lon22 - lon) / (lon22 - lon21))
* val21
+ ((lon - lon21) / (lon22 - lon21)) * val22;
- if (isnan(val1)) {
- if (isnan(val2)) {
+ if (std::isnan(val1)) {
+ if (std::isnan(val2)) {
val = missing;
} else
val = ((lat - lat11) / (lat22 - lat11))
* val2;
} else {
- if (isnan(val2)) {
+ if (std::isnan(val2)) {
val = ((lat22 - lat) / (lat22 - lat11))
* val1;
} else {
@@ -2098,37 +2082,31 @@ void GribLambertInterpretor::interpretAsMatrix(const GribDecoder& grib,
}
}
- if (isnan(val) || isinf(val) || isinf(-val)) {
+ if (std::isnan(val) || std::isinf(val) || std::isinf(-val)) {
val = missing;
}
}
- if (isnan(val))
+ if (std::isnan(val))
val = missing;
if ((**matrix)[index.second + (index.first * im)]
== missing) {
(**matrix)[index.second + (index.first * im)] = val;
-
}
-
}
-
}
-
}
-
(*matrix)->setMapsAxis();
(*matrix)->missing(missing);
}
MagLog::dev() << **matrix << "\n";
-
}
catch (MagicsException& e) {
MagLog::error() << e << "\n";
}
-
}
+
void GribLambertInterpretor::print(ostream& out) const {
out << "GribLambertInterpretor[";
out << "]";
@@ -2145,6 +2123,7 @@ void GribPolarStereoInterpretor::print(ostream& out) const {
out << "GribLambertInterpretor[";
out << "]";
}
+
void GribPolarStereoInterpretor::interpretAsMatrix(const GribDecoder& grib,
Matrix** matrix, Matrix** matrix2) const {
long im = 3600;
@@ -2152,26 +2131,20 @@ void GribPolarStereoInterpretor::interpretAsMatrix(const GribDecoder& grib,
*matrix = new Matrix(im, jm);
double steplon= 0.1;
-
double steplat= 0.1;
-
double missing = grib.getDouble("missingValue");
for (int i = 0; i < im; i++) {
double x = 0 + (i*steplon);
(*matrix)->columnsAxis().push_back(x);
-
}
for (int i = 0; i < jm; i++) {
double y = -90 + (i*steplat);
(*matrix)->rowsAxis().push_back(y);
-
-
}
vector<double> distance(im*jm, 999999);
-
for (int i = 0; i < im; i++) {
for (int j = 0; j < jm; j++)
(**matrix)[i + (j * im)] = missing;
@@ -2181,12 +2154,7 @@ void GribPolarStereoInterpretor::interpretAsMatrix(const GribDecoder& grib,
interpolate(grib, **matrix);
-
MagLog::dev() << **matrix << "\n";
-
-
-
-
}
void GribInterpretor::interpolate(const GribDecoder& grib, Matrix& matrix) const
@@ -2223,12 +2191,4 @@ void GribInterpretor::interpolate(const GribDecoder& grib, Matrix& matrix) const
}
/* At the end the iterator is deleted to free memory. */
grib_iterator_delete(iter);
-
-
-
-
-
-
-
}
-
diff --git a/src/decoders/GribRegularInterpretor.h b/src/decoders/GribRegularInterpretor.h
index 4d9457d..a0e4a47 100644
--- a/src/decoders/GribRegularInterpretor.h
+++ b/src/decoders/GribRegularInterpretor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GribRegularInterpretor.h
\brief Definition of the Template class GribRegularInterpretor.
diff --git a/src/decoders/GribSatelliteInterpretor.cc b/src/decoders/GribSatelliteInterpretor.cc
index 6557835..8c1564b 100644
--- a/src/decoders/GribSatelliteInterpretor.cc
+++ b/src/decoders/GribSatelliteInterpretor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GribSatelliteInterpretor.cc
\brief Implementation of the Template class GribSatelliteInterpretor.
@@ -30,11 +22,6 @@
#include "GribSatelliteInterpretor.h"
#include "GribDecoder.h"
#include "RasterData.h"
-#include "TeProjection.h"
-#include "TeDataTypes.h"
-#include "TeRasterParams.h"
-#include "TeDecoderMemory.h"
-#include "TeRasterRemap.h"
#include "GeoRectangularProjection.h"
using namespace magics;
@@ -61,7 +48,7 @@ const long LOFF_NONHRV = 1856; /* scaling coefficients (see note
const long COFF_HRV = 5566; /* scaling coefficients (see note above) */
const long LOFF_HRV = 5566; /* scaling coefficients (see note above) */
-
+
//////////////////////////////////////////////////////////////////////////
@@ -79,10 +66,10 @@ int nint(double val){
double b=0.0; /* frational part of val */
b = modf(val,&a);
-
+
if ( b > 0.5 ){
val = ceil(val);
- }
+ }
else{
val = floor(val);
}
@@ -101,11 +88,11 @@ int nint(double val){
* *
* *
* DEPENDENCIES: *
- * none *
+ * none *
* *
* *
* REFERENCE: *
- * [1] LRIT/HRIT Global Specification *
+ * [1] LRIT/HRIT Global Specification *
* (CGMS 03, Issue 2.6, 12.08.1999) *
* for the parameters used in the program *
* [2] MSG Ground Segment LRIT/HRIT Mission Specific *
@@ -144,8 +131,8 @@ int nint(double val){
*************************************************************/
int geocoord2pixcoord(double latitude, double longitude, int coff, int loff,
- double cfac, double lfac, double sublon,
- int *column, int *row){
+ double cfac, double lfac, double sublon,
+ int *column, int *row){
int ccc=0, lll=0;
@@ -155,14 +142,14 @@ int geocoord2pixcoord(double latitude, double longitude, int coff, int loff,
double lon=0.0;
double r1=0.0, r2=0.0, r3=0.0, rn=0.0, re=0.0, rl=0.0;
double xx=0.0, yy=0.0;
- double cc=0.0, ll=0.0;
+ double cc=0.0, ll=0.0;
double dotprod=0.0;
lati= latitude;
longi= longitude;
/* check if the values are sane, otherwise return error values */
- if (lati < -90.0 || lati > 90.0 || longi < -180.0 || longi > 180.0 ){
+ if (lati < -90.0 || lati > 90.0 || longi < -180.0 || longi > 180.0 ){
*row = -999;
*column = -999;
return (-1);
@@ -172,46 +159,46 @@ int geocoord2pixcoord(double latitude, double longitude, int coff, int loff,
/* convert them to radiants */
lat = lati*PI / (double)180.;
lon = longi *PI / (double)180.;
-
+
/* calculate the geocentric latitude from the */
/* geograhpic one using equations on page 24, Ref. [1] */
c_lat = atan ( ((double)0.993243*(sin(lat)/cos(lat)) ));
-
+
/* using c_lat calculate the length form the Earth */
/* centre to the surface of the Earth ellipsoid */
/* equations on page 23, Ref. [1] */
-
+
re = R_POL / sqrt( ((double)1.0 - (double)0.00675701 * cos(c_lat) * cos(c_lat) ) );
/* calculate the forward projection using equations on */
/* page 24, Ref. [1] */
- rl = re;
+ rl = re;
r1 = SAT_HEIGHT - rl * cos(c_lat) * cos(lon - sublon);
r2 = - rl * cos(c_lat) * sin(lon - sublon);
r3 = rl * sin(c_lat);
rn = sqrt( r1*r1 + r2*r2 +r3*r3 );
-
-
+
+
/* check for visibility, whether the point on the Earth given by the */
- /* latitude/longitude pair is visible from the satellte or not. This */
+ /* latitude/longitude pair is visible from the satellte or not. This */
/* is given by the dot product between the vectors of: */
- /* 1) the point to the spacecraft, */
- /* 2) the point to the centre of the Earth. */
+ /* 1) the point to the spacecraft, */
+ /* 2) the point to the centre of the Earth. */
/* If the dot product is positive the point is visible otherwise it */
- /* is invisible. */
-
+ /* is invisible. */
+
dotprod = r1*(rl * cos(c_lat) * cos(lon - sublon)) - r2*r2 - r3*r3*(pow((R_EQ/R_POL),2));
-
+
if (dotprod <= 0 ){
*column = -999;
*row = -999;
return (-1);
}
-
+
/* the forward projection is x and y */
xx = atan( (-r2/r1) );
yy = asin( (-r3/rn) );
@@ -223,7 +210,7 @@ int geocoord2pixcoord(double latitude, double longitude, int coff, int loff,
ll = loff + yy * pow(2.,-16) * lfac ;
ccc=nint(cc);
- lll=nint(ll);
+ lll=nint(ll);
*column = ccc;
*row = lll;
@@ -233,217 +220,217 @@ int geocoord2pixcoord(double latitude, double longitude, int coff, int loff,
-GribSatelliteInterpretor::GribSatelliteInterpretor()
+GribSatelliteInterpretor::GribSatelliteInterpretor()
{
}
-GribSatelliteInterpretor::~GribSatelliteInterpretor()
+GribSatelliteInterpretor::~GribSatelliteInterpretor()
{
}
/*
- GribSatelliteInterpretor::AdjustBadlyEncodedGribs
- Correct the information provided in the headers of certain satellite imagery that
- we have available. This is a very specific function.
+ GribSatelliteInterpretor::AdjustBadlyEncodedGribs
+ Correct the information provided in the headers of certain satellite imagery that
+ we have available. This is a very specific function.
*/
void GribSatelliteInterpretor::AdjustBadlyEncodedGribs(int satId, int chanId, long &nx, long &ny, long &dx, long &dy, double &xp, double &yp, double &slon, long &functionCode) const
{
- if (satId == 172 && slon == 140.0) // MTSAT-2, pre-2015 data
- {
- dx = dy = 888;
- xp = yp = nx/2;
- slon = 145.0;
- }
- else if (satId == 54 && chanId == 2 && dx == 1179) // Meteosat 7, channel 2
- {
- nx = ny = 900;
- dx = dy = 853; // obtained through trial-and-error to get the best match with the coastlines
- xp = yp = 450;
- functionCode = 1; // wrongly encoded as 0
- }
- else if (satId == 54 && chanId == 3 && dx == 1179) // Meteosat 7, channel 3
- {
- dx = dy = 1184; // obtained through trial-and-error to get the best match with the coastlines
- xp = yp = 635;
- }
- else if (satId == 259 && chanId == 4 && dx == 1185) // GOES-15 (West) channel 4
- {
- dx = dy = 880; // obtained through trial-and-error to get the best match with the coastlines
- xp = yp = 450;
- }
- else if (satId == 57 && dx == 1732) // MSG (Meteosat second generation), non-HRV channels
- {
- dx = dy = 1811; // obtained through trial-and-error to get the best match with the coastlines
- xp = yp = 928;
- }
+ if (satId == 172 && slon == 140.0) // MTSAT-2, pre-2015 data
+ {
+ dx = dy = 888;
+ xp = yp = nx/2;
+ slon = 145.0;
+ }
+ else if (satId == 54 && chanId == 2 && dx == 1179) // Meteosat 7, channel 2
+ {
+ nx = ny = 900;
+ dx = dy = 853; // obtained through trial-and-error to get the best match with the coastlines
+ xp = yp = 450;
+ functionCode = 1; // wrongly encoded as 0
+ }
+ else if (satId == 54 && chanId == 3 && dx == 1179) // Meteosat 7, channel 3
+ {
+ dx = dy = 1184; // obtained through trial-and-error to get the best match with the coastlines
+ xp = yp = 635;
+ }
+ else if (satId == 259 && chanId == 4 && dx == 1185) // GOES-15 (West) channel 4
+ {
+ dx = dy = 880; // obtained through trial-and-error to get the best match with the coastlines
+ xp = yp = 450;
+ }
+ else if (satId == 57 && dx == 1732) // MSG (Meteosat second generation), non-HRV channels
+ {
+ dx = dy = 1811; // obtained through trial-and-error to get the best match with the coastlines
+ xp = yp = 928;
+ }
}
/*!
Class information are given to the output-stream.
-*/
+*/
void GribSatelliteInterpretor::print(ostream& out) const
{
out << "GribSatelliteInterpretor[";
out << "]";
}
-void GribSatelliteInterpretor::interpretAsMatrix(const GribDecoder& grib, Matrix** matrix) const
+void GribSatelliteInterpretor::interpretAsMatrix(const GribDecoder& grib, Matrix** matrix, Matrix**) const
{
- Timer timer("gribapi", " reproject satellite");
- MagLog::dev() << "GribRegularInterpretor::interpretAsMatrix" << "\n";
+ Timer timer("gribapi", " reproject satellite");
+ MagLog::dev() << "GribRegularInterpretor::interpretAsMatrix" << "\n";
- double altitude = grib.getDouble("NrInRadiusOfEarth");
- if ( !altitude ) altitude = 6610839.;
- altitude *= 0.000001;
- long nx = grib.getLong("numberOfPointsAlongXAxis");
- long ny = grib.getLong("numberOfPointsAlongYAxis");
- long dx = grib.getLong("dx");
- long dy = grib.getLong("dy");
- double offx = grib.getDouble("xCoordinateOfOriginOfSectorImage");
- double offy = grib.getDouble("yCoordinateOfOriginOfSectorImage");
- double prj = 2*asin(1/altitude)/dx;
- double pri = 2*asin(1/altitude)/dy;
- double pjs = grib.getDouble("XpInGridLengths");
- double pis = grib.getDouble("YpInGridLengths");
+ double altitude = grib.getDouble("NrInRadiusOfEarth");
+ if ( !altitude ) altitude = 6610839.;
+ altitude *= 0.000001;
+ long nx = grib.getLong("numberOfPointsAlongXAxis");
+ long ny = grib.getLong("numberOfPointsAlongYAxis");
+ long dx = grib.getLong("dx");
+ long dy = grib.getLong("dy");
+ double offx = grib.getDouble("xCoordinateOfOriginOfSectorImage");
+ double offy = grib.getDouble("yCoordinateOfOriginOfSectorImage");
+ double prj = 2*asin(1/altitude)/dx;
+ double pri = 2*asin(1/altitude)/dy;
+ double pjs = grib.getDouble("XpInGridLengths");
+ double pis = grib.getDouble("YpInGridLengths");
- double lao = grib.getDouble("latitudeOfSubSatellitePointInDegrees") *TeCDR;
- double slon = grib.getDouble("longitudeOfSubSatellitePointInDegrees");
- long sat = grib.getLong("satelliteIdentifier");
- long chan = grib.getLong("channelNumber");
- long functionCode = grib.getLong("functionCode");
+ double lao = grib.getDouble("latitudeOfSubSatellitePointInDegrees") *TeCDR;
+ double slon = grib.getDouble("longitudeOfSubSatellitePointInDegrees");
+ long sat = grib.getLong("satelliteIdentifier");
+ long chan = grib.getLong("channelNumber");
+ long functionCode = grib.getLong("functionCode");
- // correct bad GRIB headers that we know exist
- AdjustBadlyEncodedGribs(sat, chan, nx, ny, dx, dy, pjs, pis, slon, functionCode);
+ // correct bad GRIB headers that we know exist
+ AdjustBadlyEncodedGribs(sat, chan, nx, ny, dx, dy, pjs, pis, slon, functionCode);
- double lono = slon*TeCDR;
- double prs = altitude * TeEARTHRADIUS;
- double scn = 0;
- double yaw = grib.getDouble("orientationOfTheGrid");
- double target_dx = 0.1; // resolution, in degrees of output lat/lon matrix
- double target_dy = 0.1; // resolution, in degrees of output lat/lon matrix
+ double lono = slon*TeCDR;
+ double prs = altitude * TeEARTHRADIUS;
+ double scn = 0;
+ double yaw = grib.getDouble("orientationOfTheGrid");
+ double target_dx = 0.1; // resolution, in degrees of output lat/lon matrix
+ double target_dy = 0.1; // resolution, in degrees of output lat/lon matrix
- yaw = RAD(yaw/1000);
- if (yaw < 0.) yaw += PI;
- else yaw -= PI;
+ yaw = RAD(yaw/1000);
+ if (yaw < 0.) yaw += PI;
+ else yaw -= PI;
-// double resx = (double)(abs(( atan( tan(pri) * (altitude-1.) ) * TeEARTHRADIUS )));
-// double resy = (double)(abs(( atan( tan(prj) * (altitude-1.) ) * TeEARTHRADIUS )));
- double resx = (double)(abs(( atan( tan(pri) * (altitude-1.) ))));
- double resy = (double)(abs(( atan( tan(prj) * (altitude-1.) ))));
+// double resx = (double)(abs(( atan( tan(pri) * (altitude-1.) ) * TeEARTHRADIUS )));
+// double resy = (double)(abs(( atan( tan(prj) * (altitude-1.) ) * TeEARTHRADIUS )));
+ double resx = (double)(abs(( atan( tan(pri) * (altitude-1.) ))));
+ double resy = (double)(abs(( atan( tan(prj) * (altitude-1.) ))));
-// double west = slon - 90 + (offx * resx);
-// double east = slon + 90 + ((offx + nx - 1) * resx);
-// double north = -(offy * resy);
-// double south = -(offy + ny - 1) * resy;
+// double west = slon - 90 + (offx * resx);
+// double east = slon + 90 + ((offx + nx - 1) * resx);
+// double north = -(offy * resy);
+// double south = -(offy + ny - 1) * resy;
- double west = -180;
- double east = 180;
- double north = 90;
- double south = -90;
+ double west = -180;
+ double east = 180;
+ double north = 90;
+ double south = -90;
- long hasBitmap = grib.getLong("bitmapPresent");
- double missingValue = 65535;
- if (hasBitmap)
- grib_set_double(grib.id(),"missingValue", missingValue);
+ long hasBitmap = grib.getLong("bitmapPresent");
+ double missingValue = 65535;
+ if (hasBitmap)
+ grib_set_double(grib.id(),"missingValue", missingValue);
- // get the array of values
- size_t nb=0;
- grib_get_size(grib.id(), "values", &nb);
- vector<double> raster(nb);
- grib_get_double_array(grib.id(),"values",&raster.front(),&nb);
+ // get the array of values
+ size_t nb=0;
+ grib_get_size(grib.id(), "values", &nb);
+ vector<double> raster(nb);
+ grib_get_double_array(grib.id(),"values",&raster.front(),&nb);
- // If value is temperature in degrees K then add 145 to pixel value
- double offset = (functionCode == 1) ? 145. : 0.;
+ // If value is temperature in degrees K then add 145 to pixel value
+ double offset = (functionCode == 1) ? 145. : 0.;
- if (offset) {
- for (unsigned int i = 0; i < nb; i++) {
- if (!hasBitmap || raster[i]!=missingValue) // if not missing value
- raster[i] +=offset;
- }
- }
+ if (offset) {
+ for (unsigned int i = 0; i < nb; i++) {
+ if (!hasBitmap || raster[i]!=missingValue) // if not missing value
+ raster[i] +=offset;
+ }
+ }
- long nblon = ((east - west) / target_dx);// + 1;
- long nblat = ((north - south) / target_dy);// + 1;
+ long nblon = ((east - west) / target_dx);// + 1;
+ long nblat = ((north - south) / target_dy);// + 1;
- if ( *matrix == 0 ) *matrix = new Matrix(nblat, nblon);
+ if ( *matrix == 0 ) *matrix = new Matrix(nblat, nblon);
- double missing = INT_MAX;
- grib.setDouble("missingValue", missing);
- (*matrix)->missing(missing);
+ double missing = INT_MAX;
+ grib.setDouble("missingValue", missing);
+ (*matrix)->missing(missing);
- MagLog::dev() << "NewAPI---> area[" << west << ", " << north << ", " << east << ", " << south << "]" << "\n";
+ MagLog::dev() << "NewAPI---> area[" << west << ", " << north << ", " << east << ", " << south << "]" << "\n";
- double dlon = (east-west)/(nblon-1);
- double dlat = (south-north)/(nblat-1);
+ double dlon = (east-west)/(nblon-1);
+ double dlat = (south-north)/(nblat-1);
- MagLog::dev() << "calcul -->" << dlon << " (from->" << west << " to-->" << west + (nblon-1) *dlon << ")" << endl;
+ MagLog::dev() << "calcul -->" << dlon << " (from->" << west << " to-->" << west + (nblon-1) *dlon << ")" << endl;
- double x = west;
- for (int i = 1; i <= nblon; i++)
- {
+ double x = west;
+ for (int i = 1; i <= nblon; i++)
+ {
- (*matrix)->columnsAxis().push_back(x);
- x = west + (i*dlon);
- }
+ (*matrix)->columnsAxis().push_back(x);
+ x = west + (i*dlon);
+ }
- double y = north;
- for (int i = 1; i <= nblat; i++)
- {
+ double y = north;
+ for (int i = 1; i <= nblat; i++)
+ {
- (*matrix)->rowsAxis().push_back(y);
- y = north + (i*dlat);
- }
- (*matrix)->setMapsAxis();
+ (*matrix)->rowsAxis().push_back(y);
+ y = north + (i*dlat);
+ }
+ (*matrix)->setMapsAxis();
- // coff, loff, cfac and lfac are 'normalised' on the NONHRV resolution of MSG images
- double coff, loff, cfac, lfac;
- double scale = (double)ny / (double)3711;
+ // coff, loff, cfac and lfac are 'normalised' on the NONHRV resolution of MSG images
+ double coff, loff, cfac, lfac;
+ double scale = (double)ny / (double)3711;
- coff = COFF_NONHRV * scale;
- loff = LOFF_NONHRV * scale;
+ coff = COFF_NONHRV * scale;
+ loff = LOFF_NONHRV * scale;
- double rx = 2 * asin(1.0/altitude) / dx;
- cfac = (-65536.0 / (rx));
- lfac = cfac;
+ double rx = 2 * asin(1.0/altitude) / dx;
+ cfac = (-65536.0 / (rx));
+ lfac = cfac;
- int k = 0;
+ int k = 0;
- for (int j=0;j < nblat;j++) {
- for (int i=0;i < nblon;i++) {
- double val;
- int srcCol, srcRow;
- double lat = south - j*dlat;
- double lon = east - i*dlon;
+ for (int j=0;j < nblat;j++) {
+ for (int i=0;i < nblon;i++) {
+ double val;
+ int srcCol, srcRow;
+ double lat = south - j*dlat;
+ double lon = east - i*dlon;
- geocoord2pixcoord(lat,
- lon,
- coff, loff,
- cfac, lfac,
- -lono, // sub-satellite longitude in radians; unclear why we have to negate it
- &srcCol, &srcRow);
+ geocoord2pixcoord(lat,
+ lon,
+ coff, loff,
+ cfac, lfac,
+ -lono, // sub-satellite longitude in radians; unclear why we have to negate it
+ &srcCol, &srcRow);
- if (srcCol == -999 || srcRow == -999)
- val = 65535;
- else
- val = raster[srcRow*nx + srcCol];
+ if (srcCol == -999 || srcRow == -999)
+ val = 65535;
+ else
+ val = raster[srcRow*nx + srcCol];
- (**matrix)[k++] = val;
- }
- }
+ (**matrix)[k++] = val;
+ }
+ }
- (*matrix)->missing(missingValue);
+ (*matrix)->missing(missingValue);
}
diff --git a/src/decoders/GribSatelliteInterpretor.h b/src/decoders/GribSatelliteInterpretor.h
index efac8c0..c288f65 100644
--- a/src/decoders/GribSatelliteInterpretor.h
+++ b/src/decoders/GribSatelliteInterpretor.h
@@ -1,30 +1,22 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GribSatelliteInterpretor.h
\brief Definition of the Template class GribSatelliteInterpretor.
-
+
Magics Team - ECMWF 2005
-
+
Started: Mon 18-Apr-2005
-
+
Changes:
-
+
*/
#ifndef GribSatelliteInterpretor_H
@@ -39,31 +31,31 @@ namespace magics {
class GribSatelliteInterpretor: public GribInterpretor {
public:
- GribSatelliteInterpretor();
- virtual ~GribSatelliteInterpretor();
-
-// virtual void interpretAsRaster(const GribDecoder&, RasterData&, const Transformation&) const;
- virtual void interpretAsVectors(const GribDecoder&, Matrix&, Matrix&) const
- { throw NotYetImplemented("Satellite representation", " Vectors"); }
- virtual void interpretAsMatrix(const GribDecoder&, Matrix**) const;
+ GribSatelliteInterpretor();
+ virtual ~GribSatelliteInterpretor();
+
+// virtual void interpretAsRaster(const GribDecoder&, RasterData&, const Transformation&) const;
+ virtual void interpretAsVectors(const GribDecoder&, Matrix&, Matrix&) const
+ { throw NotYetImplemented("Satellite representation", " Vectors"); }
+ virtual void interpretAsMatrix(const GribDecoder&, Matrix**, Matrix** matrix2= NULL) const;
+
-
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
- virtual void print(ostream&) const;
+ virtual void print(ostream&) const;
private:
//! Copy constructor - No copy allowed
- GribSatelliteInterpretor(const GribSatelliteInterpretor&);
+ GribSatelliteInterpretor(const GribSatelliteInterpretor&);
//! Overloaded << operator to copy - No copy allowed
void AdjustBadlyEncodedGribs(int satId, int chanId, long &nx, long &ny, long &dx, long &dy, double &xp, double &yp, double &slon, long &functionCode) const;
// -- Friends
//! Overloaded << operator to call print().
- friend ostream& operator<<(ostream& s,const GribSatelliteInterpretor& p)
- { p.print(s); return s; }
+ friend ostream& operator<<(ostream& s,const GribSatelliteInterpretor& p)
+ { p.print(s); return s; }
};
diff --git a/src/decoders/ImportAction.h b/src/decoders/ImportAction.h
index ec05567..1db40e8 100644
--- a/src/decoders/ImportAction.h
+++ b/src/decoders/ImportAction.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ImportAction.h
\brief Definition of the Template class ImportAction.
diff --git a/src/decoders/InputData.cc b/src/decoders/InputData.cc
index 0614f8e..ea8ab1a 100644
--- a/src/decoders/InputData.cc
+++ b/src/decoders/InputData.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file InputData.cc
\brief Implementation of the Template class InputData.
diff --git a/src/decoders/InputData.h b/src/decoders/InputData.h
index 58137d9..eeb63a4 100644
--- a/src/decoders/InputData.h
+++ b/src/decoders/InputData.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file InputData.h
\brief Definition of the Template class InputData.
diff --git a/src/decoders/InputMatrix.cc b/src/decoders/InputMatrix.cc
index 2cfbfd0..36bd1af 100644
--- a/src/decoders/InputMatrix.cc
+++ b/src/decoders/InputMatrix.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file InputMatrix.h
\brief Implementation of the Template class InputMatrix.
diff --git a/src/decoders/InputMatrix.h b/src/decoders/InputMatrix.h
index 41512dc..cbef1c9 100644
--- a/src/decoders/InputMatrix.h
+++ b/src/decoders/InputMatrix.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file InputMatrix.h
\brief Definition of the Template class InputMatrix.
diff --git a/src/decoders/InputMatrixInterpretor.cc b/src/decoders/InputMatrixInterpretor.cc
index b885e24..d12b9b8 100644
--- a/src/decoders/InputMatrixInterpretor.cc
+++ b/src/decoders/InputMatrixInterpretor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file InputMatrixInterpretor.h
\brief Implementation of the Template class InputMatrixInterpretor.
@@ -105,8 +97,9 @@ Matrix* InputMatrixRegularInterpretor::geoInterpret(Matrix* in, const InputMatri
double lon = longitude_;
for (int i = 0; i < nblon; i++) {
- in->columnsAxis().push_back(lon);
lon = longitude_ +( i * longitude_step_);
+ in->columnsAxis().push_back(lon);
+
}
int nblat = in->rows();
diff --git a/src/decoders/InputMatrixInterpretor.h b/src/decoders/InputMatrixInterpretor.h
index 738fc5e..f137513 100644
--- a/src/decoders/InputMatrixInterpretor.h
+++ b/src/decoders/InputMatrixInterpretor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file InputMatrixInterpretor.h
\brief Definition of the Template class InputMatrixInterpretor.
diff --git a/src/decoders/LandgramDecoder.cc b/src/decoders/LandgramDecoder.cc
index 1648f48..eac9447 100644
--- a/src/decoders/LandgramDecoder.cc
+++ b/src/decoders/LandgramDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LandgramDecoder.h
\brief Implementation of the Template class LandgramDecoder.
diff --git a/src/decoders/LandgramDecoder.h b/src/decoders/LandgramDecoder.h
index 6b9d60d..45fecd9 100644
--- a/src/decoders/LandgramDecoder.h
+++ b/src/decoders/LandgramDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LandgramDecoder.h
\brief Definition of the Template class LandgramDecoder.
diff --git a/src/decoders/LocalTable.cc b/src/decoders/LocalTable.cc
index 6558de7..4552cd5 100644
--- a/src/decoders/LocalTable.cc
+++ b/src/decoders/LocalTable.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LocalTable.h
\brief Implementation of the Template class LocalTable.
diff --git a/src/decoders/LocalTable.h b/src/decoders/LocalTable.h
index 2d8abb7..230133a 100644
--- a/src/decoders/LocalTable.h
+++ b/src/decoders/LocalTable.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LocalTable.h
\brief Definition of the Template class LocalTable.
diff --git a/src/decoders/MapGenDecoder.cc b/src/decoders/MapGenDecoder.cc
index 4a98e7f..12d7d78 100644
--- a/src/decoders/MapGenDecoder.cc
+++ b/src/decoders/MapGenDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MapGenDecoder.cc
\brief Implementation of the Template class MapGenDecoder.
diff --git a/src/decoders/MapGenDecoder.h b/src/decoders/MapGenDecoder.h
index 9ee5154..0aebe7e 100644
--- a/src/decoders/MapGenDecoder.h
+++ b/src/decoders/MapGenDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MapGenDecoder.h
\brief Definition of the Template class MapGenDecoder.
diff --git a/src/decoders/MatrixTestDecoder.cc b/src/decoders/MatrixTestDecoder.cc
index e6ff00b..20c609c 100644
--- a/src/decoders/MatrixTestDecoder.cc
+++ b/src/decoders/MatrixTestDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MatrixTestDecoder.h
\brief Implementation of the Template class MatrixTestDecoder.
diff --git a/src/decoders/MatrixTestDecoder.h b/src/decoders/MatrixTestDecoder.h
index 1737989..c292683 100644
--- a/src/decoders/MatrixTestDecoder.h
+++ b/src/decoders/MatrixTestDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MatrixTestDecoder.h
\brief Definition of the Template class MatrixTestDecoder.
diff --git a/src/decoders/Netcdf.cc b/src/decoders/Netcdf.cc
index 0dff5a0..a230f4d 100644
--- a/src/decoders/Netcdf.cc
+++ b/src/decoders/Netcdf.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
//! \file Netcdf.cc
/*!
diff --git a/src/decoders/Netcdf.h b/src/decoders/Netcdf.h
index 6ca9c05..606a5ef 100644
--- a/src/decoders/Netcdf.h
+++ b/src/decoders/Netcdf.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Netcdf.h
\brief Definition of the Netcdf access tools.
diff --git a/src/decoders/NetcdfConvention.cc b/src/decoders/NetcdfConvention.cc
index a213713..727c654 100644
--- a/src/decoders/NetcdfConvention.cc
+++ b/src/decoders/NetcdfConvention.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfConvention.cc
\brief Implementation of the Template class NetcdfConvention.
diff --git a/src/decoders/NetcdfConvention.h b/src/decoders/NetcdfConvention.h
index 48d9637..427d3a1 100644
--- a/src/decoders/NetcdfConvention.h
+++ b/src/decoders/NetcdfConvention.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfConvention.h
\brief Definition of the Template class NetcdfConvention.
diff --git a/src/decoders/NetcdfDecoder.cc b/src/decoders/NetcdfDecoder.cc
index 69f67a6..a23160e 100644
--- a/src/decoders/NetcdfDecoder.cc
+++ b/src/decoders/NetcdfDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfDecoder.h
\brief Implementation of the Template class NetcdfDecoder.
diff --git a/src/decoders/NetcdfDecoder.h b/src/decoders/NetcdfDecoder.h
index d6efffd..1af9662 100644
--- a/src/decoders/NetcdfDecoder.h
+++ b/src/decoders/NetcdfDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfDecoder.h
\brief Definition of the Template class NetcdfDecoder.
diff --git a/src/decoders/NetcdfGeoMatrixInterpretor.cc b/src/decoders/NetcdfGeoMatrixInterpretor.cc
index b48f70d..851d2ae 100644
--- a/src/decoders/NetcdfGeoMatrixInterpretor.cc
+++ b/src/decoders/NetcdfGeoMatrixInterpretor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfGeoMatrixInterpretor.cc
\brief Implementation of the Template class NetcdfGeoMatrixInterpretor.
@@ -90,9 +82,8 @@ bool NetcdfGeoMatrixInterpretor::interpretAsMatrix(Matrix** data)
netcdf.get(field_, data, first, last);
int i = 0;
for (vector<double>::iterator d = data.begin(); d != data.end(); ++d ) {
- if ( !isnan(*d) ) {
+ if ( !std::isnan(*d) ) {
matrix_->push_back(*d);
-
}
else
matrix_->push_back(missing_value);
@@ -100,15 +91,10 @@ bool NetcdfGeoMatrixInterpretor::interpretAsMatrix(Matrix** data)
}
}
-
matrix_->multiply(scaling_);
matrix_->plus(offset_);
-
-
-
- matrix_->setMapsAxis();
-
+ matrix_->setMapsAxis();
}
catch (MagicsException& e)
{
@@ -268,8 +254,5 @@ void NetcdfGeoMatrixInterpretor::customisedPoints(const Transformation& transfor
catch (MagicsException& e)
{
MagLog::error() << e << "\n";
-
}
-
-
}
diff --git a/src/decoders/NetcdfGeoMatrixInterpretor.h b/src/decoders/NetcdfGeoMatrixInterpretor.h
index 88769f5..0939e44 100644
--- a/src/decoders/NetcdfGeoMatrixInterpretor.h
+++ b/src/decoders/NetcdfGeoMatrixInterpretor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfGeoMatrixInterpretor.h
\brief Definition of the Template class NetcdfGeoMatrixInterpretor.
diff --git a/src/decoders/NetcdfGeopointsInterpretor.cc b/src/decoders/NetcdfGeopointsInterpretor.cc
index 24cea24..77a802b 100644
--- a/src/decoders/NetcdfGeopointsInterpretor.cc
+++ b/src/decoders/NetcdfGeopointsInterpretor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfGeopointsInterpretor.cc
\brief Implementation of the Template class NetcdfGeopointsInterpretor.
diff --git a/src/decoders/NetcdfGeopointsInterpretor.h b/src/decoders/NetcdfGeopointsInterpretor.h
index 0e3cd42..b169e7e 100644
--- a/src/decoders/NetcdfGeopointsInterpretor.h
+++ b/src/decoders/NetcdfGeopointsInterpretor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfGeopointsInterpretor.h
\brief Definition of the Template class NetcdfGeopointsInterpretor.
diff --git a/src/decoders/NetcdfInterpretor.cc b/src/decoders/NetcdfInterpretor.cc
index 307c7d0..b6f0555 100644
--- a/src/decoders/NetcdfInterpretor.cc
+++ b/src/decoders/NetcdfInterpretor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfInterpretor.cc
\brief Implementation of the Template class NetcdfInterpretor.
diff --git a/src/decoders/NetcdfInterpretor.h b/src/decoders/NetcdfInterpretor.h
index d9665c7..b448e5d 100644
--- a/src/decoders/NetcdfInterpretor.h
+++ b/src/decoders/NetcdfInterpretor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfInterpretor.h
\brief Definition of the Template class NetcdfInterpretor.
diff --git a/src/decoders/NetcdfMarsConvention.cc b/src/decoders/NetcdfMarsConvention.cc
index fac8a74..78a95e8 100644
--- a/src/decoders/NetcdfMarsConvention.cc
+++ b/src/decoders/NetcdfMarsConvention.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfMarsConvention.cc
\brief Implementation of the Template class NetcdfMarsConvention.
diff --git a/src/decoders/NetcdfMarsConvention.h b/src/decoders/NetcdfMarsConvention.h
index 4ef87c2..e73f86f 100644
--- a/src/decoders/NetcdfMarsConvention.h
+++ b/src/decoders/NetcdfMarsConvention.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfMarsConvention.h
\brief Definition of the Template class NetcdfMarsConvention.
diff --git a/src/decoders/NetcdfMatrixInterpretor.cc b/src/decoders/NetcdfMatrixInterpretor.cc
index 2b76b1f..2f32969 100644
--- a/src/decoders/NetcdfMatrixInterpretor.cc
+++ b/src/decoders/NetcdfMatrixInterpretor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfMatrixInterpretor.h
\brief Implementation of the Template class NetcdfMatrixInterpretor.
diff --git a/src/decoders/NetcdfMatrixInterpretor.h b/src/decoders/NetcdfMatrixInterpretor.h
index b0f3097..dae7d5e 100644
--- a/src/decoders/NetcdfMatrixInterpretor.h
+++ b/src/decoders/NetcdfMatrixInterpretor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfMatrixInterpretor.h
\brief Definition of the Template class NetcdfMatrixInterpretor.
diff --git a/src/decoders/NetcdfOrcaInterpretor.cc b/src/decoders/NetcdfOrcaInterpretor.cc
index f9cf689..38a4f18 100644
--- a/src/decoders/NetcdfOrcaInterpretor.cc
+++ b/src/decoders/NetcdfOrcaInterpretor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfOrcaInterpretor.h
\brief Implementation of the Template class NetcdfOrcaInterpretor.
@@ -40,20 +32,15 @@ NetcdfOrcaInterpretor::NetcdfOrcaInterpretor()
NetcdfOrcaInterpretor::~NetcdfOrcaInterpretor()
{}
+
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
bool NetcdfOrcaInterpretor::interpretAsMatrix(Matrix** data)
{
-
if ( *data ) return false;
-
-
-
-
-
Netcdf netcdf(path_, dimension_method_);
NetVariable var = netcdf.getVariable(longitude_);
vector<long> dims;
@@ -207,15 +194,15 @@ bool NetcdfOrcaInterpretor::interpretAsMatrix(Matrix** data)
double val1 = ((lon12 - lon )/(lon12-lon11))*val11 + ((lon - lon11)/(lon12-lon11))*val12;
double val2 = ((lon22 - lon )/(lon22-lon21))*val21 + ((lon - lon21)/(lon22-lon21))*val22;
- if ( isnan(val1) ) {
- if ( isnan(val2) ) {
+ if ( std::isnan(val1) ) {
+ if ( std::isnan(val2) ) {
val = missing;
}
else
val = ((lat - lat11)/(lat22-lat11))*val2;
}
else {
- if ( isnan(val2) ) {
+ if ( std::isnan(val2) ) {
val = ((lat22 - lat )/(lat22-lat11))*val1;
}
else {
@@ -223,33 +210,26 @@ bool NetcdfOrcaInterpretor::interpretAsMatrix(Matrix** data)
}
}
- if (isnan(val) || isinf(val) || isinf(-val) ) {
+ if (std::isnan(val) || std::isinf(val) || std::isinf(-val) ) {
val = missing;
}
}
- if (isnan(val) ) val = missing;
+ if (std::isnan(val) ) val = missing;
if ( (*matrix)[index.second +( index.first*im)] == missing )
(*matrix)[index.second +( index.first*im)] = val;
}
matrix->multiply(scaling_);
matrix->plus(offset_);
-
}
-
-
}
-
}
-
-
matrix->multiply(scaling_);
matrix->plus(offset_);
matrix->setMapsAxis();
MagLog::dev() << *matrix << "\n";
-
}
catch (MagicsException& e)
@@ -282,18 +262,13 @@ bool NetcdfOrcaInterpretor::interpretAsPoints(PointsList& points)
netcdf.get(latitude_, latm, first, last);
netcdf.get(field_, data, first, last);
-
-
-
-
-
vector<double>::iterator lat = latm.begin();
vector<double>::iterator lon = lonm.begin();
vector<double>::iterator val = data.begin();
while (lat != latm.end() ) {
double value = *val;
- if (isnan(value) )
+ if (std::isnan(value) )
value = missing;
if ( value != missing) {
@@ -311,12 +286,10 @@ bool NetcdfOrcaInterpretor::interpretAsPoints(PointsList& points)
{
MagLog::error() << e << "\n";
}
-
}
void NetcdfOrcaInterpretor::customisedPoints(const Transformation& transformation, const std::set<string>&, CustomisedPointsList& out, int thinning)
{
-
try
{
MagLog::dev() << " Netcdf File Path --->" << path_ << "\n";
diff --git a/src/decoders/NetcdfOrcaInterpretor.h b/src/decoders/NetcdfOrcaInterpretor.h
index a23333a..6c9e74b 100644
--- a/src/decoders/NetcdfOrcaInterpretor.h
+++ b/src/decoders/NetcdfOrcaInterpretor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfOrcaInterpretor.h
\brief Definition of the Template class NetcdfOrcaInterpretor.
diff --git a/src/decoders/NetcdfVectorInterpretor.cc b/src/decoders/NetcdfVectorInterpretor.cc
index 0c2c102..bfa8735 100644
--- a/src/decoders/NetcdfVectorInterpretor.cc
+++ b/src/decoders/NetcdfVectorInterpretor.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfVectorInterpretor.h
\brief Implementation of the Template class NetcdfVectorInterpretor.
diff --git a/src/decoders/NetcdfVectorInterpretor.h b/src/decoders/NetcdfVectorInterpretor.h
index 52632e0..dfce0b3 100644
--- a/src/decoders/NetcdfVectorInterpretor.h
+++ b/src/decoders/NetcdfVectorInterpretor.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NetcdfVectorInterpretor.h
\brief Definition of the Template class NetcdfVectorInterpretor.
diff --git a/src/decoders/ObsDecoder.cc b/src/decoders/ObsDecoder.cc
index 7cf9c00..9a08c9e 100644
--- a/src/decoders/ObsDecoder.cc
+++ b/src/decoders/ObsDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ObsDecoder.cc
\brief Implementation of the Template class ObsDecoder.
diff --git a/src/decoders/ObsDecoder.h b/src/decoders/ObsDecoder.h
index 9466190..da6cbdf 100644
--- a/src/decoders/ObsDecoder.h
+++ b/src/decoders/ObsDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ObsDecoder.h
\brief Definition of the Template class ObsDecoder.
diff --git a/src/decoders/ObsStatDecoder.cc b/src/decoders/ObsStatDecoder.cc
index 116f41e..9216117 100644
--- a/src/decoders/ObsStatDecoder.cc
+++ b/src/decoders/ObsStatDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ObsStatDecoder.cc
\brief Implementation of the Template class ObsStatDecoder.
diff --git a/src/decoders/ObsStatDecoder.h b/src/decoders/ObsStatDecoder.h
index 9e5af91..c0440ce 100644
--- a/src/decoders/ObsStatDecoder.h
+++ b/src/decoders/ObsStatDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ObsStatDecoder.h
\brief Definition of the Template class ObsStatDecoder.
diff --git a/src/decoders/ShapeDecoder.cc b/src/decoders/ShapeDecoder.cc
index 7ea7c18..57a6bcb 100644
--- a/src/decoders/ShapeDecoder.cc
+++ b/src/decoders/ShapeDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ShapeDecoder.cc
\brief Implementation of the Template class ShapeDecoder.
diff --git a/src/decoders/ShapeDecoder.h b/src/decoders/ShapeDecoder.h
index a23db8b..2f68df5 100644
--- a/src/decoders/ShapeDecoder.h
+++ b/src/decoders/ShapeDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ShapeDecoder.h
\brief Definition of the Template class ShapeDecoder.
diff --git a/src/decoders/SimplePolylineInput.cc b/src/decoders/SimplePolylineInput.cc
index debf738..7aa1519 100644
--- a/src/decoders/SimplePolylineInput.cc
+++ b/src/decoders/SimplePolylineInput.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SimplePolylineInput.cc
\brief Implementation of the Template class SimplePolylineInput.
diff --git a/src/decoders/SimplePolylineInput.h b/src/decoders/SimplePolylineInput.h
index e1f51d2..a7d10de 100644
--- a/src/decoders/SimplePolylineInput.h
+++ b/src/decoders/SimplePolylineInput.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SimplePolylineInput.h
\brief Definition of the Template class SimplePolylineInput.
diff --git a/src/decoders/SymbolInput.h b/src/decoders/SymbolInput.h
index 0d9dbc3..0be258c 100644
--- a/src/decoders/SymbolInput.h
+++ b/src/decoders/SymbolInput.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SymbolInput.h
\brief Definition of the Template class SymbolInput.
diff --git a/src/decoders/TableDecoder.cc b/src/decoders/TableDecoder.cc
index 4d05414..b970253 100644
--- a/src/decoders/TableDecoder.cc
+++ b/src/decoders/TableDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TableDecoder.cc
\brief Implementation of the Template class TableDecoder.
diff --git a/src/decoders/TableDecoder.h b/src/decoders/TableDecoder.h
index d940acf..e61ff01 100644
--- a/src/decoders/TableDecoder.h
+++ b/src/decoders/TableDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TableDecoder.h
\brief Definition of the Template class TableDecoder.
diff --git a/src/decoders/ThinningMethod.cc b/src/decoders/ThinningMethod.cc
index bf7b5f2..99ead0b 100644
--- a/src/decoders/ThinningMethod.cc
+++ b/src/decoders/ThinningMethod.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file ThinningMethod.h
\brief Implementation of the Template class ThinningMethod.
diff --git a/src/decoders/ThinningMethod.h b/src/decoders/ThinningMethod.h
index 729f585..e4e24ea 100644
--- a/src/decoders/ThinningMethod.h
+++ b/src/decoders/ThinningMethod.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file ThinningMethod.h
\brief Definition of the Template class ThinningMethod.
diff --git a/src/decoders/Time.cc b/src/decoders/Time.cc
index 5216de9..804c485 100644
--- a/src/decoders/Time.cc
+++ b/src/decoders/Time.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "DateTime.h"
#include "MagException.h"
diff --git a/src/decoders/TitleField.cc b/src/decoders/TitleField.cc
index 0ddd8bc..b27e3f2 100644
--- a/src/decoders/TitleField.cc
+++ b/src/decoders/TitleField.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TitleField.cc
\brief Implementation of the Template class TitleField.
diff --git a/src/decoders/TitleField.h b/src/decoders/TitleField.h
index d0308d6..23ab85d 100644
--- a/src/decoders/TitleField.h
+++ b/src/decoders/TitleField.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TitleField.h
\brief Definition of the Template class TitleField.
diff --git a/src/decoders/TitleMetaField.cc b/src/decoders/TitleMetaField.cc
index ac647ed..4c2c4ad 100644
--- a/src/decoders/TitleMetaField.cc
+++ b/src/decoders/TitleMetaField.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TitleMetaField.cc
\brief Implementation of the Template class TitleMetaField.
diff --git a/src/decoders/TitleMetaField.h b/src/decoders/TitleMetaField.h
index 478ee35..79912a3 100644
--- a/src/decoders/TitleMetaField.h
+++ b/src/decoders/TitleMetaField.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TitleMetaField.h
\brief Definition of the Template class TitleMetaField.
diff --git a/src/decoders/TitleStringField.cc b/src/decoders/TitleStringField.cc
index 38d2f42..a28542b 100644
--- a/src/decoders/TitleStringField.cc
+++ b/src/decoders/TitleStringField.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TitleStringField.cc
\brief Implementation of the Template class TitleStringField.
diff --git a/src/decoders/TitleStringField.h b/src/decoders/TitleStringField.h
index e4584d3..56648bd 100644
--- a/src/decoders/TitleStringField.h
+++ b/src/decoders/TitleStringField.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TitleStringField.h
\brief Definition of the Template class TitleStringField.
diff --git a/src/decoders/TitleTemplate.cc b/src/decoders/TitleTemplate.cc
index 105c835..57a990b 100644
--- a/src/decoders/TitleTemplate.cc
+++ b/src/decoders/TitleTemplate.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TitleTemplate.cc
\brief Implementation of the Template class TitleTemplate.
diff --git a/src/decoders/TitleTemplate.h b/src/decoders/TitleTemplate.h
index 3cf7435..b7ccd2e 100644
--- a/src/decoders/TitleTemplate.h
+++ b/src/decoders/TitleTemplate.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TitleTemplate.h
\brief Definition of the Template class TitleTemplate.
diff --git a/src/decoders/WindMode.cc b/src/decoders/WindMode.cc
index 6461c70..ed20c23 100644
--- a/src/decoders/WindMode.cc
+++ b/src/decoders/WindMode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file WindMode.cc
\brief Implementation of the Template class WindMode.
diff --git a/src/decoders/WindMode.h b/src/decoders/WindMode.h
index dc49fde..12f89a2 100644
--- a/src/decoders/WindMode.h
+++ b/src/decoders/WindMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file WindMode.h
\brief Definition of the Template class WindMode.
diff --git a/src/decoders/XYList.cc b/src/decoders/XYList.cc
index 1cc7b25..c8f389d 100644
--- a/src/decoders/XYList.cc
+++ b/src/decoders/XYList.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XYList.cc
\brief Implementation of the Template class XYList.
diff --git a/src/decoders/XYList.h b/src/decoders/XYList.h
index 733048a..049671d 100644
--- a/src/decoders/XYList.h
+++ b/src/decoders/XYList.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file XYList.h
\brief Definition of the Template class XYList.
diff --git a/src/drivers/BaseDriver.cc b/src/drivers/BaseDriver.cc
index ff14b6c..7b06fc7 100644
--- a/src/drivers/BaseDriver.cc
+++ b/src/drivers/BaseDriver.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BaseDriver.cc
\brief Implementation of driver base class.
@@ -266,13 +258,12 @@ string BaseDriver::getFileName(const string &extension, const unsigned int no) c
if( (no2 > 1) || firstnumber_ || legacy )
{
- char *ostr;
- if(numberWidth==4) {ostr=new char[5]; sprintf(ostr,"%04u",no2);}
- else if(numberWidth==3) {ostr=new char[4]; sprintf(ostr,"%03u",no2);}
- else if(numberWidth==2) {ostr=new char[3]; sprintf(ostr,"%02u",no2);}
- else {ostr=new char[2]; sprintf(ostr,"%u",no2);}
+ char ostr[8];
+ if(numberWidth==4) {sprintf(ostr,"%04u",no2);}
+ else if(numberWidth==3) {sprintf(ostr,"%03u",no2);}
+ else if(numberWidth==2) {sprintf(ostr,"%02u",no2);}
+ else {sprintf(ostr,"%u",no2);}
filename += separator_+ostr+ext;
- delete [] ostr;
}
else // if first page no number
{
diff --git a/src/drivers/BaseDriver.h b/src/drivers/BaseDriver.h
index 9b9bc56..0e8ba01 100644
--- a/src/drivers/BaseDriver.h
+++ b/src/drivers/BaseDriver.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \defgroup drivers Output drivers
@@ -453,8 +445,6 @@ protected:
mutable std::map<string, magFont, RuntimeStringCompare> FontMap_;
typedef std::map<string, magFont, RuntimeStringCompare>::const_iterator fontMapIter;
- void terminate() const {exit(1);}
-
void readFonts() const;
void relieveFonts() const {FontMap_.clear();}
diff --git a/src/drivers/BaseDriverImages.h b/src/drivers/BaseDriverImages.h
index 8746e7e..367d052 100644
--- a/src/drivers/BaseDriverImages.h
+++ b/src/drivers/BaseDriverImages.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2009 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BaseDriverImages.h
\brief Implementation of methods to display images of driver base class.
diff --git a/src/drivers/BaseDriverSymbols.h b/src/drivers/BaseDriverSymbols.h
index 0b68bc9..7a5493d 100644
--- a/src/drivers/BaseDriverSymbols.h
+++ b/src/drivers/BaseDriverSymbols.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BaseDriverSymbols.h
\brief Implementation of Symbol methods of driver base class.
@@ -210,6 +200,7 @@ MAGICS_NO_EXPORT void BaseDriver::renderTextItem(const TextItem& textItem, const
MAGICS_NO_EXPORT void BaseDriver::renderFlagItem(const FlagItem& flagItem, const ComplexSymbol& owner) const
{
Flag flag;
+ flag.setThickness(flagItem.thickness());
flag.setLength(flagItem.length());
flag.setOriginMarker(flagItem.getOriginMarker());
flag.setOriginHeight(flagItem.getOriginHeight()); // NOT flagItem.getOriginHeight() !!!
diff --git a/src/drivers/BaseDriverWind.h b/src/drivers/BaseDriverWind.h
index dbedb79..fa43aa3 100644
--- a/src/drivers/BaseDriverWind.h
+++ b/src/drivers/BaseDriverWind.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2009 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BaseDriverWind.h
\brief Implementation of wind field methods of driver base class.
diff --git a/src/drivers/BinaryDriver.cc b/src/drivers/BinaryDriver.cc
index 8096429..1a15c4f 100644
--- a/src/drivers/BinaryDriver.cc
+++ b/src/drivers/BinaryDriver.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BinaryDriver.cc
\brief Implementation of BinaryDriver.
diff --git a/src/drivers/BinaryDriver.h b/src/drivers/BinaryDriver.h
index 841271a..516c7f8 100644
--- a/src/drivers/BinaryDriver.h
+++ b/src/drivers/BinaryDriver.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file BinaryDriver.h
diff --git a/src/drivers/CairoDriver.cc b/src/drivers/CairoDriver.cc
index 21657b6..6644b4d 100644
--- a/src/drivers/CairoDriver.cc
+++ b/src/drivers/CairoDriver.cc
@@ -1,23 +1,13 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-European Centre for Medium-Range Weather Forecasts
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
- ******************************** LICENSE ********************************/
/*
I currently have a function that accepts a cairo context (with a path already set)
diff --git a/src/drivers/CairoDriver.h b/src/drivers/CairoDriver.h
index db11c9d..67ea6ff 100644
--- a/src/drivers/CairoDriver.h
+++ b/src/drivers/CairoDriver.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file CairoDriver.h
diff --git a/src/drivers/DriverManager.cc b/src/drivers/DriverManager.cc
index 8b4093e..588f8e8 100644
--- a/src/drivers/DriverManager.cc
+++ b/src/drivers/DriverManager.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/* \file DriverManager.cc
\brief Implementation of Drivermanager class.
diff --git a/src/drivers/DriverManager.h b/src/drivers/DriverManager.h
index ab38243..ba10f6a 100644
--- a/src/drivers/DriverManager.h
+++ b/src/drivers/DriverManager.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/* \file DriverManager.h
\brief Definition of driver manager class.
diff --git a/src/drivers/GDDriver.cc b/src/drivers/GDDriver.cc
index 298d942..727af93 100644
--- a/src/drivers/GDDriver.cc
+++ b/src/drivers/GDDriver.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GDDriver.cc
\brief Implementation of GDDriver.
diff --git a/src/drivers/GDDriver.h b/src/drivers/GDDriver.h
index d393ba7..7bd5541 100644
--- a/src/drivers/GDDriver.h
+++ b/src/drivers/GDDriver.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file GDDriver.h
diff --git a/src/drivers/GeoJsonDriver.cc b/src/drivers/GeoJsonDriver.cc
old mode 100755
new mode 100644
index f22bf59..2550d65
--- a/src/drivers/GeoJsonDriver.cc
+++ b/src/drivers/GeoJsonDriver.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GeoJsonDriver.cc
\brief Implementation of GeoJsonDriver.
@@ -80,9 +70,9 @@ void GeoJsonDriver::open()
pFile_.open(fileName_.c_str());
if(!pFile_)
{
- MagLog::error() << "GeoJsonDriver::open() --> Cannot open GeoJson output file: " << fileName_ << "!\n";
- MagLog::error() << ""; // to ensure that the error message is broadcast
- terminate();
+ MagLog::error() << " GeoJsonDriver --> Cannot write output file to what was specified: "<<fileName_<< endl;
+ MagLog::error() << "";
+ throw NoSuchFileException("Error opening GeoJson output file!");
}
/* pFile_ << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
<< "<GeoJson xmlns=\"http://www.opengis.net/GeoJson/2.2\" \n"
diff --git a/src/drivers/GeoJsonDriver.h b/src/drivers/GeoJsonDriver.h
old mode 100755
new mode 100644
index 80051b6..b7c5b96
--- a/src/drivers/GeoJsonDriver.h
+++ b/src/drivers/GeoJsonDriver.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file GeoJsonDriver.h
diff --git a/src/drivers/KMLDriver.cc b/src/drivers/KMLDriver.cc
old mode 100755
new mode 100644
index 5f2b6d7..0a58cad
--- a/src/drivers/KMLDriver.cc
+++ b/src/drivers/KMLDriver.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file KMLDriver.cc
\brief Implementation of KMLDriver.
@@ -115,9 +105,9 @@ void KMLDriver::open()
pFile_.open(fileName_.c_str());
if(!pFile_)
{
- MagLog::error() << "KMLDriver::open() --> Cannot open KML output file: " << fileName_ << "!\n";
- MagLog::error() << ""; // to ensure that the error message is broadcast
- terminate();
+ MagLog::error() << " KMLScriptDriver --> Cannot write output file to what was specified: "<<fileName_<< endl;
+ MagLog::error() << "";
+ throw NoSuchFileException("Error opening KML output file!");
}
pFile_ << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
<< "<kml xmlns=\"http://www.opengis.net/kml/2.2\" \n"
diff --git a/src/drivers/KMLDriver.h b/src/drivers/KMLDriver.h
old mode 100755
new mode 100644
index c46d68d..709cb1a
--- a/src/drivers/KMLDriver.h
+++ b/src/drivers/KMLDriver.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file KMLDriver.h
diff --git a/src/drivers/MgQ/MgQ.h b/src/drivers/MgQ/MgQ.h
index 6aea7b7..bfc867e 100644
--- a/src/drivers/MgQ/MgQ.h
+++ b/src/drivers/MgQ/MgQ.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQ.h
diff --git a/src/drivers/MgQ/MgQDriverObject.h b/src/drivers/MgQ/MgQDriverObject.h
index e8eaad0..873947a 100644
--- a/src/drivers/MgQ/MgQDriverObject.h
+++ b/src/drivers/MgQ/MgQDriverObject.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQDriverObject.h
diff --git a/src/drivers/MgQ/MgQHistoItem.cc b/src/drivers/MgQ/MgQHistoItem.cc
index 30452f9..c9fa512 100644
--- a/src/drivers/MgQ/MgQHistoItem.cc
+++ b/src/drivers/MgQ/MgQHistoItem.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQHistoItem.cc
diff --git a/src/drivers/MgQ/MgQHistoItem.h b/src/drivers/MgQ/MgQHistoItem.h
index 1cdbc3c..ec51733 100644
--- a/src/drivers/MgQ/MgQHistoItem.h
+++ b/src/drivers/MgQ/MgQHistoItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQHistoItem.h
diff --git a/src/drivers/MgQ/MgQLayerItem.cc b/src/drivers/MgQ/MgQLayerItem.cc
index 87ca6f5..7b9d8f8 100644
--- a/src/drivers/MgQ/MgQLayerItem.cc
+++ b/src/drivers/MgQ/MgQLayerItem.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQLayerItem.cc
diff --git a/src/drivers/MgQ/MgQLayerItem.h b/src/drivers/MgQ/MgQLayerItem.h
index aa76b32..996105c 100644
--- a/src/drivers/MgQ/MgQLayerItem.h
+++ b/src/drivers/MgQ/MgQLayerItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQLayerItem.h
diff --git a/src/drivers/MgQ/MgQLayoutItem.cc b/src/drivers/MgQ/MgQLayoutItem.cc
index 27145db..9195542 100644
--- a/src/drivers/MgQ/MgQLayoutItem.cc
+++ b/src/drivers/MgQ/MgQLayoutItem.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQLayoutItem.cc
diff --git a/src/drivers/MgQ/MgQLayoutItem.h b/src/drivers/MgQ/MgQLayoutItem.h
index aff461c..6c0d18a 100644
--- a/src/drivers/MgQ/MgQLayoutItem.h
+++ b/src/drivers/MgQ/MgQLayoutItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQLayoutItem.h
diff --git a/src/drivers/MgQ/MgQPathItem.cc b/src/drivers/MgQ/MgQPathItem.cc
index 26d8e2d..cd24b08 100644
--- a/src/drivers/MgQ/MgQPathItem.cc
+++ b/src/drivers/MgQ/MgQPathItem.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQPathItem.cc
diff --git a/src/drivers/MgQ/MgQPathItem.h b/src/drivers/MgQ/MgQPathItem.h
index 999d811..644917e 100644
--- a/src/drivers/MgQ/MgQPathItem.h
+++ b/src/drivers/MgQ/MgQPathItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQPathItem.h
diff --git a/src/drivers/MgQ/MgQPattern.cc b/src/drivers/MgQ/MgQPattern.cc
index 0f3c593..84c6d79 100644
--- a/src/drivers/MgQ/MgQPattern.cc
+++ b/src/drivers/MgQ/MgQPattern.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQPattern.h
diff --git a/src/drivers/MgQ/MgQPattern.h b/src/drivers/MgQ/MgQPattern.h
index 7fdc28a..5f7b8e3 100644
--- a/src/drivers/MgQ/MgQPattern.h
+++ b/src/drivers/MgQ/MgQPattern.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQPattern.h
diff --git a/src/drivers/MgQ/MgQPixmapItem.cc b/src/drivers/MgQ/MgQPixmapItem.cc
index e3149f7..5d3a1f8 100644
--- a/src/drivers/MgQ/MgQPixmapItem.cc
+++ b/src/drivers/MgQ/MgQPixmapItem.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQPixmapItem.cc
diff --git a/src/drivers/MgQ/MgQPixmapItem.h b/src/drivers/MgQ/MgQPixmapItem.h
index 14d62f9..a596241 100644
--- a/src/drivers/MgQ/MgQPixmapItem.h
+++ b/src/drivers/MgQ/MgQPixmapItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQPixmapItem.h
diff --git a/src/drivers/MgQ/MgQPlotScene.cc b/src/drivers/MgQ/MgQPlotScene.cc
index 303e112..26cb1f2 100644
--- a/src/drivers/MgQ/MgQPlotScene.cc
+++ b/src/drivers/MgQ/MgQPlotScene.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQPlotScene.cc
diff --git a/src/drivers/MgQ/MgQPlotScene.h b/src/drivers/MgQ/MgQPlotScene.h
index 56f5eb1..3164fb1 100644
--- a/src/drivers/MgQ/MgQPlotScene.h
+++ b/src/drivers/MgQ/MgQPlotScene.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQPlotScene.h
diff --git a/src/drivers/MgQ/MgQPolylineSetItem.cc b/src/drivers/MgQ/MgQPolylineSetItem.cc
index 5682a28..92873bd 100644
--- a/src/drivers/MgQ/MgQPolylineSetItem.cc
+++ b/src/drivers/MgQ/MgQPolylineSetItem.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQPolylineSetItem.cc
diff --git a/src/drivers/MgQ/MgQPolylineSetItem.h b/src/drivers/MgQ/MgQPolylineSetItem.h
index 68518c3..992831f 100644
--- a/src/drivers/MgQ/MgQPolylineSetItem.h
+++ b/src/drivers/MgQ/MgQPolylineSetItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQPolylineSetItem.h
diff --git a/src/drivers/MgQ/MgQRootItem.h b/src/drivers/MgQ/MgQRootItem.h
index 51b15b7..bd0e7a3 100644
--- a/src/drivers/MgQ/MgQRootItem.h
+++ b/src/drivers/MgQ/MgQRootItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQRootItem.h
diff --git a/src/drivers/MgQ/MgQScene.cc b/src/drivers/MgQ/MgQScene.cc
index 5d741f4..6434656 100644
--- a/src/drivers/MgQ/MgQScene.cc
+++ b/src/drivers/MgQ/MgQScene.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQScene.cc
diff --git a/src/drivers/MgQ/MgQScene.h b/src/drivers/MgQ/MgQScene.h
index 23782fa..f7d9eb7 100644
--- a/src/drivers/MgQ/MgQScene.h
+++ b/src/drivers/MgQ/MgQScene.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQScene.h
diff --git a/src/drivers/MgQ/MgQSceneCacheItem.cc b/src/drivers/MgQ/MgQSceneCacheItem.cc
index 8b184b8..2c2e694 100644
--- a/src/drivers/MgQ/MgQSceneCacheItem.cc
+++ b/src/drivers/MgQ/MgQSceneCacheItem.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQSceneCacheItem.cc
diff --git a/src/drivers/MgQ/MgQSceneCacheItem.h b/src/drivers/MgQ/MgQSceneCacheItem.h
index 75dcdae..1f940f5 100644
--- a/src/drivers/MgQ/MgQSceneCacheItem.h
+++ b/src/drivers/MgQ/MgQSceneCacheItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQSceneCacheItem.h
diff --git a/src/drivers/MgQ/MgQSceneItem.cc b/src/drivers/MgQ/MgQSceneItem.cc
index 3fb4fb3..e80f388 100644
--- a/src/drivers/MgQ/MgQSceneItem.cc
+++ b/src/drivers/MgQ/MgQSceneItem.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQSceneItem.cc
diff --git a/src/drivers/MgQ/MgQSceneItem.h b/src/drivers/MgQ/MgQSceneItem.h
index 5b88c20..b94148e 100644
--- a/src/drivers/MgQ/MgQSceneItem.h
+++ b/src/drivers/MgQ/MgQSceneItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQSceneLayout.h
diff --git a/src/drivers/MgQ/MgQStepItem.cc b/src/drivers/MgQ/MgQStepItem.cc
index a339fbe..b240fed 100644
--- a/src/drivers/MgQ/MgQStepItem.cc
+++ b/src/drivers/MgQ/MgQStepItem.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQStepItem.cc
diff --git a/src/drivers/MgQ/MgQStepItem.h b/src/drivers/MgQ/MgQStepItem.h
index d19a4f5..8033532 100644
--- a/src/drivers/MgQ/MgQStepItem.h
+++ b/src/drivers/MgQ/MgQStepItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQStepItem.h
diff --git a/src/drivers/MgQ/MgQStepMetaData.cc b/src/drivers/MgQ/MgQStepMetaData.cc
index 7c6ef3e..dd1e7c6 100644
--- a/src/drivers/MgQ/MgQStepMetaData.cc
+++ b/src/drivers/MgQ/MgQStepMetaData.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQStepMetaData.cc
diff --git a/src/drivers/MgQ/MgQStepMetaData.h b/src/drivers/MgQ/MgQStepMetaData.h
index dd1cd48..bc9ba51 100644
--- a/src/drivers/MgQ/MgQStepMetaData.h
+++ b/src/drivers/MgQ/MgQStepMetaData.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQStepMetaData.h
diff --git a/src/drivers/MgQ/MgQSymbol.cc b/src/drivers/MgQ/MgQSymbol.cc
index 28abcb5..ec3799e 100644
--- a/src/drivers/MgQ/MgQSymbol.cc
+++ b/src/drivers/MgQ/MgQSymbol.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQSymbol.h
diff --git a/src/drivers/MgQ/MgQSymbol.h b/src/drivers/MgQ/MgQSymbol.h
index 50218a8..cccdcc4 100644
--- a/src/drivers/MgQ/MgQSymbol.h
+++ b/src/drivers/MgQ/MgQSymbol.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQSymbol.h
diff --git a/src/drivers/MgQ/MgQTextItem.cc b/src/drivers/MgQ/MgQTextItem.cc
index b748570..c81f1c6 100644
--- a/src/drivers/MgQ/MgQTextItem.cc
+++ b/src/drivers/MgQ/MgQTextItem.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQTextItem.cc
diff --git a/src/drivers/MgQ/MgQTextItem.h b/src/drivers/MgQ/MgQTextItem.h
index 50effc4..396e4d6 100644
--- a/src/drivers/MgQ/MgQTextItem.h
+++ b/src/drivers/MgQ/MgQTextItem.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file MgQTextItem.h
diff --git a/src/drivers/MingDriver.cc b/src/drivers/MingDriver.cc
deleted file mode 100644
index 9a29635..0000000
--- a/src/drivers/MingDriver.cc
+++ /dev/null
@@ -1,568 +0,0 @@
-
-
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
-
-/*! \file MingDriver.cc
- \brief Implementation of MingDriver.
- \author Meteorological Visualisation Section, ECMWF
-
- Started: Tue Nov 20 12:26:52 2007
-
-*/
-
-#include <MingDriver.h>
-#include <Polyline.h>
-#include <Text.h>
-#include <Image.h>
-
-#define SCALE 35
-
-using namespace magics;
-
-/*!
- \brief Constructor
-*/
-MingDriver::MingDriver()
-{
- setNewColour(Colour("black"));
-}
-
-/*!
- \brief Destructor
-*/
-MingDriver::~MingDriver()
-{
-}
-
-/*!
- \brief Opening the driver
-*/
-void MingDriver::open()
-{
-MagLog::warning() << " MingDriver is still EXPERIMENTAL !!!"<< endl;
- dimensionX_ = SCALE * getXDeviceLength();
- dimensionY_ = SCALE * getYDeviceLength();
- movie_ = new SWFMovie(9); // version 9
- movie_->setRate(0.5);
- movie_->setDimension(dimensionX_,dimensionY_);
- offsetY_ = dimensionY_;
- coordRatioY_ = -1;
-}
-
-/*!
- \brief Closing the driver
-*/
-void MingDriver::close()
-{
- endPage();
- currentPage_ = 0;
-
- string fileName = getFileName("swf",0);
- movie_->save(fileName.c_str());
-}
-
-/*!
- \brief starting a new page
-
- This method has to take care that previous pages are closed and that
- for formats with multiple output files a new file is set up.
-*/
-MAGICS_NO_EXPORT void MingDriver::startPage() const
-{
- if(currentPage_ > 0) endPage();
-
- movie_->nextFrame();
-
- currentPage_++;
- newPage_ = true;
-}
-
-/*!
- \brief ending a page
-
- This method has to take care that for formats with multiple output
- files are closed.
-*/
-MAGICS_NO_EXPORT void MingDriver::endPage() const
-{
-}
-
-/*!
- \brief project to a new Layout
-
- This method will update the offset and scale according to the new Layout given.
-
- \sa Layout
-*/
-MAGICS_NO_EXPORT void MingDriver::project(const magics::Layout& layout) const
-{
- if( (!magCompare(currentBox_,"non")) ) unprojectBox();
-
- newLayout_ = true;
- if(newPage_) newPage_=false;
-
- dimensionStack_.push(dimensionX_);
- dimensionStack_.push(dimensionY_);
-
- lastAreaHeightPercentage_ = layout.getAreaHeightPercentage() * 0.01;
- lastAreaWidthPercentage_ = layout.getAreaWidthPercentage() * 0.01;
-
- const float Xoff = layout.getXOffsetPercentage() * 0.01 * dimensionX_;
- const float Yoff = layout.getYOffsetPercentage() * 0.01 * dimensionY_;
-
- offsetsX_.push(offsetX_);
- offsetsY_.push(offsetY_);
- offsetX_ = projectX(Xoff);
- offsetY_ = projectY(Yoff);
- dimensionX_= lastAreaWidthPercentage_ * dimensionX_;
- dimensionY_= lastAreaHeightPercentage_ * dimensionY_;
-}
-
-/*!
- \brief reproject out of the last Layout
-
- This method will update the offset and scale to the state they were before the
- last Layout was received.
-
- \sa UnLayout
-*/
-MAGICS_NO_EXPORT void MingDriver::unproject(const magics::UnLayout& unlayout) const
-{
- if( (newPage_==false) && (!magCompare(currentBox_,"non")) ) {unprojectBox();}
- if(dimensionStack_.size()>1)
- {
- dimensionY_ = dimensionStack_.top();dimensionStack_.pop();
- dimensionX_ = dimensionStack_.top();dimensionStack_.pop();
-
- offsetX_ = offsetsX_.top();offsetsX_.pop();
- offsetY_ = offsetsY_.top();offsetsY_.pop();
- }
- currentBox_ = "non";
-}
-
-/*!
- \brief project into a box
-
- This method will update the offset and scale to position for new box.
- The properties of boxes are stored in the current Layout.
-
- \sa Layout
-*/
-MAGICS_NO_EXPORT void MingDriver::projectBox(const string& area) const
-{
- if(magCompare(currentBox_,area)) return;
- if(newLayout_) newLayout_=false;
- else { unprojectBox();}
-
- currentBox_ = area;
- setNewColour(Colour(0.,0.,0.)); // to set colours right!
-
- Box *box = getBox(area);
-
- const float Xoff = dimensionX_ * box->getX() * 0.01;
- const float Yoff = dimensionY_ * box->getY() * 0.01;
- const float Xlength = dimensionX_ * box->getWidth() * 0.01;
- const float Ylength = dimensionY_ * box->getHeight() * 0.01;
- const float Xmin = box->getXmin();
- const float Xmax = box->getXmax();
- const float Ymin = box->getYmin();
- const float Ymax = box->getYmax();
- const float sumX = Xmax - Xmin;
- const float sumY = Ymax - Ymin;
-
- boxoffsetsX_.push(offsetX_);
- boxoffsetsY_.push(offsetY_);
- offsetX_ += Xoff;
- offsetY_ -= Yoff;
- scalesX_.push(coordRatioX_);
- scalesY_.push(coordRatioY_);
- coordRatioX_ *= Xlength/sumX;
- coordRatioY_ *= Ylength/sumY;
- offsetX_ = projectX(-Xmin);
- offsetY_ = projectY(-Ymin);
-}
-
-/*!
- \brief unproject into a box
-
- This method will update the offset and scale to rest from the current box.
- The properties of boxes are stored in the current Layout.
-
- \sa Layout
-*/
-MAGICS_NO_EXPORT void MingDriver::unprojectBox() const
-{
- if((!magCompare(currentBox_,"non")) && ( !offsetsX_.empty() && !scalesX_.empty() ) )
- {
- offsetX_ = boxoffsetsX_.top();
- boxoffsetsX_.pop();
- offsetY_ = boxoffsetsY_.top();
- boxoffsetsY_.pop();
-
- coordRatioX_ = scalesX_.top();
- scalesX_.pop();
- coordRatioY_ = scalesY_.top();
- scalesY_.pop();
- }
- currentBox_ = "non";
-}
-
-/*!
- \brief setup a new layer
-
- This method will setup a new layer. Layers enable overlays of entities
- of information.
-
- \sa PhysicalLayer
-*/
-MAGICS_NO_EXPORT void MingDriver::newLayer(const PhysicalLayer& layer) const
-{
- movie_->nextFrame();
-}
-
-/*!
- \brief close the current layer
-
- This method will close an existing layer. This includes resets of existing boxes.
-
- \sa UnPhysicalLayer PhysicalLayer
-*/
-MAGICS_NO_EXPORT void MingDriver::closeLayer(const UnPhysicalLayer& layer) const
-{
-}
-
-
-/*!
- \brief sets a new colour
-
- This colour stays the default drawing colour until the painting in the
- current box is finished.
-
- \sa Colour
-*/
-MAGICS_NO_EXPORT void MingDriver::setNewColour(const Colour &colour) const
-{
- if(currentColour_ == colour) return;
- currentColour_ = colour;
-}
-
-/*!
- \brief sets a new line width
-
- This line width stays the default width until the painting in the
- current box is finished.
-
- \sa setLineParameters()
-*/
-MAGICS_NO_EXPORT void MingDriver::setNewLineWidth(const float width) const
-{
- currentLineWidth_ = width;
-}
-
-/*!
- \brief sets new properties of how lines are drawn
-
- These properties stay the default until the painting in the
- current box is finished.
-
- \sa LineStyle
-
- \param linestyle Object describing the line style
- \param w width of the line
-
-*/
-MAGICS_NO_EXPORT int MingDriver::setLineParameters(const LineStyle linestyle, const float w) const
-{
- setNewLineWidth(w);
-
- MagLog::debug() << "MingDriver::setLineParameters needs implementing." <<endl;
- return 0;
-}
-
-/*!
- \brief renders polylines
-
- This method renders a polyline given as two float arrays. The two
- arrays given as X and Y values have to be at least the length of
- <i>n</i>. All values beyond <i>n</i> will be ignored. The style is
- determined by what is described in the current LineStyle.
-
- \sa setLineParameters()
- \param n number of points
- \param x array of x values
- \param y array of y values
-*/
-MAGICS_NO_EXPORT void MingDriver::renderPolyline(const int n, float *x, float *y) const
-{
- if(n<2) return;
-
- SWFShape *shape = new SWFShape();
-
- shape->setLine2(currentLineWidth_, (byte)currentColour_.red()*128,(byte)currentColour_.green()*128,(byte)currentColour_.blue()*128, (byte)128,
- SWF_LINESTYLE_FLAG_HINTING | SWF_LINESTYLE_JOIN_BEVEL | SWF_LINESTYLE_FLAG_ENDCAP_SQUARE, 0);
-
- float old_x = projectX(x[0]);
- float old_y = projectY(y[0]);
- shape->movePenTo(old_x, old_y);
-
- for(int l = 1; l<n; l++)
- {
- const float xx = projectX(x[l]);
- const float yy = projectY(y[l]);
- shape->drawLineTo(xx, yy);
-
- old_x = xx;
- old_y = yy;
- }
-
- movie_->add(shape);
-}
-
-/*!
- \brief renders horizontal polylines
-
- This method renders a horizontal polyline given as two float arrays.
- This method is mainly thought for the scanline algorithm used by some
- output drivers to shade areas. <i>n</i> has to be a multiple of 2!
-
- \sa setLineParameters()
- \param n number of points
- \param x array of x values
- \param y y value
-*/
-MAGICS_NO_EXPORT void MingDriver::renderPolyline2x(const int n, int* x, const int y) const
-{
- MagLog::debug() << "MingDriver::renderPolyline2x needs implementing." <<endl;
-}
-
-/*!
- \brief renders a single line
-
- This method renders a polyline with two points.The style is
- determined by what is described in the current LineStyle.
-
- \sa setLineParameters()
- \param n number of points
- \param x array of x values
- \param y array of y values
-*/
-MAGICS_NO_EXPORT void MingDriver::renderPolyline2(const int n, float* x, float* y) const
-{
- MagLog::debug() << "MingDriver::renderPolyline2 needs implementing." <<endl;
-}
-
-/*!
- \brief renders a filled polygon
-
- This method renders a filled polygon. The style is
- determined by what is described in the current LineStyle.
-
- \sa setLineParameters()
- \param n number of points
- \param x array of x values
- \param y array of y values
-*/
-MAGICS_NO_EXPORT void MingDriver::renderSimplePolygon(const int n, float* x, float* y) const
-{
- MagLog::debug() << "MingDriver::renderSimplePolygon needs implementing." <<endl;
-}
-
-/*!
- \brief renders text strings
-
- This method renders given text strings.
-
- \note As of version 2.0 there are two forms of describing text in Text.
-
- \sa Text
- \param text object containing the strings and their description
-*/
-MAGICS_NO_EXPORT void MingDriver::renderText(const Text& text) const
-{
- if(text.empty()) return;
- const vector<NiceText>& niceT = text.getNiceText();
- if(niceT.empty() && (text.getText().length()==0 || text.empty()) ) return;
-
- if(niceT.empty())
- {
- }
- /**************************************************************************
- ***
- *** N I C E T E X T
- ***
- **************************************************************************/
- else
- {
- vector<NiceText>::const_iterator niceText = text.textBegin();
- vector<NiceText>::const_iterator niceTextEnd = text.textEnd();
-
- int text_length = 0;
- for(;niceText<niceTextEnd;niceText++)
- {
- const MagFont magfont = (*niceText).font();
- const string style = (magfont.style()=="") ? "normal": magfont.style();
-// const bool underlined = (magfont.style()=="underline") ? true : false;
- const string font = magfont.name()+"_"+style;
- const string lowFont = lowerCase(font);
- fontMapIter iter = FontMap_.find(lowFont);
-
- string ttf = getEnvVariable("MAGPLUS_HOME") + "/" + MAGICS_TTF_PATH;
- if(iter!=FontMap_.end())
- ttf += iter->second.ttf_filename;
- else
- {
- ttf += FontMap_["sansserif_normal"].ttf_filename; // if not found get default
- MagLog::warning() << "MingDriver: Font "<< font << " is not registered! Default font is used."<< endl;
- }
-
- SWFText *stext = new SWFText();
- SWFFont *sfont = new SWFFont((char*)ttf.c_str());
- if(sfont==NULL)
- {
- MagLog::error() << "MingDriver -> Could not open TTF file "<<ttf<<" !"<< endl;
- }
- stext->moveTo( projectX(text[0].x()), projectY(text[0].y()));
- stext->setFont(sfont);
-// stext->setColor(0xff, 0, 0, 0xff);
- stext->setColor(currentColour_.red(),currentColour_.green(),currentColour_.blue(),0xff);
- stext->setHeight(text.getFontSize()*SCALE);
- stext->addString((*niceText).text().c_str(), NULL);//text.getText());
- movie_->add(stext);
- }
- } // end NICE text
-/*
- $i->moveTo(160-$t->getWidth("fnar! fnar!")/2, 120+$t->getAscent()/2);
-
- SWFTextField *text = new SWFTextField();
-
- text->setFlags(SWFTEXTFIELD_NOEDIT);
- text->addString("The quick brown fox jumps over the lazy dog. 1234567890");
- m->add(text);*/
-}
-
-/*!
- \brief drawing a circle
-
- This method renders given text strings.
-
- The meaning of the last parameter <i>s</i> is as follows:
- - 0-8 determines how many quarters of the circle are filled. Starting from the top clock-wise.
- - 9 fills the whole circle but leaves a vertical bar empty in the middle of the circle.
-
- \param x X Position
- \param y Y Position
- \param r Radius of circle
- \param s Style which determines how the circle is shaded
-*/
-MAGICS_NO_EXPORT void MingDriver::circle(const float x, const float y, const float r, const int s) const
-{
- MagLog::debug() << "MingDriver::circle needs implementing." <<endl;
-}
-
-/*!
- \brief render pixmaps
-
- This method renders pixmaps. These are used for cell shading and raster input (GIFs and PNGs).
-
- \sa renderCellArray()
-
- \param x0 x of lower corner
- \param y0 y of lower corner
- \param x1 x of higher corner
- \param y1 y of higher corner
- \param w width of pixmap
- \param h height of pixmap
- \param pixmap contents
- \param landscape says if contents is landscape
-
-*/
-MAGICS_NO_EXPORT bool MingDriver::renderPixmap(float x0,float y0,float x1,float y1,
- int w,int h,unsigned char* pixmap,int landscape, bool) const
-{
- MagLog::debug() << "MingDriver::renderPixmap needs implementing." <<endl;
- return true;
-}
-
-/*!
- \brief render cell arrays
-
- This method renders cell arrays, also called images in Magics language. These are
- mainly used for satellite data.
-
- \sa renderPixmap()
-
- \param image Object containing an image
-*/
-MAGICS_NO_EXPORT bool MingDriver::renderCellArray(const Image& image) const
-{
- MagLog::debug() << "MingDriver::renderCellArray needs implementing." <<endl;
- return true;
-}
-
-/*!
- \brief render filled polygons
-
- This method renders filled polygons which were priviously defined in the BaseDriver.
-
- \sa BaseDriver::renderPolylineSets()
-*/
-MAGICS_NO_EXPORT void MingDriver::endPolygon() const
-{
-/*
- SWFFillStyle *fill = SWFFillStyle::SolidFillStyle(255, 128, 0, 255);
- SWFShape *shape = new SWFShape();
- shape->setRightFillStyle(fill);
-
- shape->setLine(1, 0,0,0,255);
- shape->drawLine(100, 0);
- shape->drawLine(0, 100);
- shape->drawLine(-100, 0);
- shape->drawLine(0, -100);
-
- movie_->add(shape);
-*/
-}
-
-/*!
- \brief prints debug output
-
- When Magics++ is compiled in debug mode these extra strings are printed.
-
- \note This can increase file and log file sizes if you run Magics++ in debug mode!
-
- \param s string to be printed
-*/
-MAGICS_NO_EXPORT void MingDriver::debugOutput(const string &s) const
-{
- MagLog::debug() << s << endl;
-}
-
-/*!
- \brief class information are given to the output-stream
-*/
-void MingDriver::print(ostream& out) const
-{
- out << "MingDriver[";
- out << "]";
-}
-
-static SimpleObjectMaker<MingDriver, BaseDriver> Ming_driver("Ming");
-
diff --git a/src/drivers/MingDriver.h b/src/drivers/MingDriver.h
deleted file mode 100644
index 52ff7aa..0000000
--- a/src/drivers/MingDriver.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
-
-/*!
- \file MingDriver.h
- \brief Definition of MingDriver.
- \author Meteorological Visualisation Section, ECMWF
-
- Started: Tue Nov 20 12:26:52 2007
-*/
-
-#ifndef _MingDriver_H
-#define _MingDriver_H
-
-#include <BaseDriver.h>
-#include <MingDriverAttributes.h>
-#include <XmlNode.h>
-
-#include <mingpp.h>
-
-namespace magics
-{
-
-/*! \class MingDriver
- \brief This driver produces output for Ming
- \ingroup drivers
-
- This driver ...
-*/
-class MingDriver: public BaseDriver, public MingDriverAttributes
-{
-
-public:
- MingDriver();
- ~MingDriver();
- void open();
- void close();
-
- /*!
- \brief sets a new XML node
- */
- void set(const XmlNode& node)
- {
- if ( magCompare(node.name(), "swf") )
- {
- XmlNode basic = node;
- basic.name("driver");
- BaseDriver::set(basic);
- basic.name("swf");
- MingDriverAttributes::set(basic);
- }
- }
-
- /*!
- \brief sets a new map
- */
- void set(const map<string, string>& map)
- {
- BaseDriver::set(map);
- MingDriverAttributes::set(map);
- }
-
-private:
- MAGICS_NO_EXPORT void startPage() const;
- MAGICS_NO_EXPORT void endPage() const;
- MAGICS_NO_EXPORT void project(const Layout& lay) const;
- MAGICS_NO_EXPORT void unproject(const magics::UnLayout&) const;
- MAGICS_NO_EXPORT void projectBox(const string &) const;
- MAGICS_NO_EXPORT void unprojectBox() const;
- MAGICS_NO_EXPORT void newLayer(const PhysicalLayer& ) const;
- MAGICS_NO_EXPORT void setNewLineWidth(const float) const;
- MAGICS_NO_EXPORT void closeLayer(const UnPhysicalLayer& ) const;
-
- MAGICS_NO_EXPORT void setNewColour(const Colour &col) const;
- MAGICS_NO_EXPORT int setLineParameters(const LineStyle style, const float w) const;
-
- MAGICS_NO_EXPORT void renderPolyline(const int, float *, float *) const;
- MAGICS_NO_EXPORT void renderPolyline2x(const int, int*, const int) const;
- MAGICS_NO_EXPORT void renderPolyline2(const int n, float *x, float *y) const;
- MAGICS_NO_EXPORT void renderSimplePolygon(const int, float *, float *) const;
- MAGICS_NO_EXPORT void renderText(const Text& text) const;
- MAGICS_NO_EXPORT void circle(const float x, const float y, const float r, const int) const;
- MAGICS_NO_EXPORT bool renderPixmap(float,float,float,float,int,int,unsigned char*,int, bool) const;
- MAGICS_NO_EXPORT bool renderCellArray(const Image& obj) const;
- MAGICS_NO_EXPORT void endPolygon() const;
-
- MAGICS_NO_EXPORT float setY(const float y) const {return -y;}
- MAGICS_NO_EXPORT float projectX(const float x) const {return offsetX_+(x*coordRatioX_);}
- MAGICS_NO_EXPORT float projectY(const float y) const {return offsetY_+(y*coordRatioY_);}
- mutable SWFMovie* movie_;
- mutable SWFFillStyle* currentStyle_;
- mutable float offsetX_;
- mutable float offsetY_;
- mutable stack<float> offsetsX_;
- mutable stack<float> offsetsY_;
- mutable stack<float> boxoffsetsX_;
- mutable stack<float> boxoffsetsY_;
-
- //! Method to print string about this class on to a stream of type ostream (virtual).
- void print(ostream&) const;
- MAGICS_NO_EXPORT void debugOutput(const string &s) const;
-
- //! Copy constructor - No copy allowed
- MingDriver(const MingDriver&);
- //! Overloaded << operator to copy - No copy allowed
- MingDriver& operator=(const MingDriver&);
-
- // -- Friends
- //! Overloaded << operator to call print().
- friend ostream& operator<<(ostream& s,const MingDriver& p)
- { p.print(s); return s; }
-};
-
-} // namespace magics
-#endif
diff --git a/src/drivers/PostScriptDriver.cc b/src/drivers/PostScriptDriver.cc
index 242f86d..d381d8b 100644
--- a/src/drivers/PostScriptDriver.cc
+++ b/src/drivers/PostScriptDriver.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PostScriptDriver.cc
\brief Implementation of PostScriptDriver.
@@ -1384,7 +1374,7 @@ MAGICS_NO_EXPORT bool PostScriptDriver::renderCellArray(const Image& image) cons
*/
MAGICS_NO_EXPORT void PostScriptDriver::debugOutput(const string &s) const
{
- if(debug_) PSOut_ << "%% "<<s<<"\n";
+ if(debug_) pFile_ << "%% "<<s<<"\n";
}
/*!
@@ -1444,19 +1434,19 @@ MAGICS_NO_EXPORT void PostScriptDriver::openFile() const
if(pos != string::npos) fileName_.replace(pos,4,".ps");
}
- if(PSOut_.is_open()) PSOut_.close();
- PSOut_.clear();
- PSOut_.open(fileName_.c_str(),std::ios::out);
- if(!PSOut_){
- MagLog::error() << "PostScriptDriver::close() --> Cannot write PostScript file! " << fileName_ << "\n";
- MagLog::error() << ""; // to ensure that the error message is broadcast
- terminate();
+ if(pFile_.is_open()) pFile_.close();
+ pFile_.clear();
+ pFile_.open(fileName_.c_str(),std::ios::out);
+ if(!pFile_){
+ MagLog::error() << " PostScriptDriver --> Cannot write output file to what was specified: "<<fileName_<< endl;
+ MagLog::error() << "";
+ throw NoSuchFileException("Error opening PS output file!");
}
- PSOut_.setf(ios_base::fixed);
- PSOut_.unsetf(ios::showpoint);
- PSOut_.precision(2);
-// PSOut_<< setprecision(2);
+ pFile_.setf(ios_base::fixed);
+ pFile_.unsetf(ios::showpoint);
+ pFile_.precision(2);
+// pFile_<< setprecision(2);
writePSFileHeader();
}
@@ -1471,7 +1461,7 @@ MAGICS_NO_EXPORT void PostScriptDriver::closeFile() const
writePSFileEnd();
// close + remove files
- PSOut_.close();
+ pFile_.close();
const string fps = fileName_;
diff --git a/src/drivers/PostScriptDriver.h b/src/drivers/PostScriptDriver.h
index 38af777..c904dda 100644
--- a/src/drivers/PostScriptDriver.h
+++ b/src/drivers/PostScriptDriver.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file PostScriptDriver.h
@@ -115,7 +105,7 @@ private:
MAGICS_NO_EXPORT void writePSFileEnd() const;
//MAGICS_NO_EXPORT void copyMacro(fstream *m, const string &file) const;
MAGICS_NO_EXPORT void setDeviceColourModel(const string &m) const;
- MAGICS_NO_EXPORT fstream* getStream() const {return &PSOut_;}
+ MAGICS_NO_EXPORT fstream* getStream() const {return &pFile_;}
MAGICS_NO_EXPORT int getDeviceColourModel() const {return deviceColourModel_;}
//! Should the output be splited?
@@ -123,7 +113,7 @@ private:
MAGICS_NO_EXPORT void openFile() const;
MAGICS_NO_EXPORT void closeFile() const;
- mutable fstream PSOut_;
+ mutable fstream pFile_;
mutable bool ps_;
mutable bool pdf_;
mutable bool eps_;
diff --git a/src/drivers/QtDriver.cc b/src/drivers/QtDriver.cc
index a332c02..659878c 100644
--- a/src/drivers/QtDriver.cc
+++ b/src/drivers/QtDriver.cc
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file QtDriver.cc
\brief Implementation of QtDriver.
diff --git a/src/drivers/QtDriver.h b/src/drivers/QtDriver.h
index 80f5868..91e00cb 100644
--- a/src/drivers/QtDriver.h
+++ b/src/drivers/QtDriver.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file QtDriver.h
diff --git a/src/drivers/SVGDriver.cc b/src/drivers/SVGDriver.cc
index f29faaa..1a2bc4d 100644
--- a/src/drivers/SVGDriver.cc
+++ b/src/drivers/SVGDriver.cc
@@ -1,29 +1,18 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SVGDriver.cc
\brief Implementation of SVGDriver.
\author Meteorological Visualisation Section, ECMWF
Started: Fri Oct 26 20:58:21 2007
-
*/
#include <SVGDriver.h>
@@ -126,9 +115,9 @@ MAGICS_NO_EXPORT void SVGDriver::startPage() const
if(!pFile_)
{
- MagLog::error() << "SVGDriver::startPage() --> Cannot open SVG output file: " << filename << "\n";
- MagLog::error() << ""; // to ensure that the error message is broadcast
- terminate();
+ MagLog::error() << " SVGDriver --> Cannot write output file to what was specified: "<<fileName_<< endl;
+ MagLog::error() << "";
+ throw NoSuchFileException("Error opening SVG output file!");
}
svg_output_resource_list_.push_back(filename);
diff --git a/src/drivers/SVGDriver.h b/src/drivers/SVGDriver.h
index ddd61a1..b761eea 100644
--- a/src/drivers/SVGDriver.h
+++ b/src/drivers/SVGDriver.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*!
\file SVGDriver.h
diff --git a/src/drivers/SelectionMode.cc b/src/drivers/SelectionMode.cc
index 9f7fa17..b8ed6eb 100644
--- a/src/drivers/SelectionMode.cc
+++ b/src/drivers/SelectionMode.cc
@@ -1,32 +1,17 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
-/******************************* LICENSE *******************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************* LICENSE *******************************/
/*! \file SelectionMode.cc
\brief Implementation of the Template class SelectionMode.
- Magics Team - ECMWF 2007
-
- Started: Tue 20-Nov-2007
-
- Changes:
-
+ Started: Tue 20-Nov-2007
*/
diff --git a/src/drivers/SelectionMode.h b/src/drivers/SelectionMode.h
index bd863fc..237df98 100644
--- a/src/drivers/SelectionMode.h
+++ b/src/drivers/SelectionMode.h
@@ -1,23 +1,12 @@
-
-/******************************* LICENSE *******************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************* LICENSE *******************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SelectionMode.h
\brief Definition of the Template class SelectionMode.
diff --git a/src/drivers/System.h b/src/drivers/System.h
index 5ce0543..d44990c 100644
--- a/src/drivers/System.h
+++ b/src/drivers/System.h
@@ -1,22 +1,12 @@
-/******************************** LICENSE ********************************
-
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file System.h
\brief In this file wrappers are defined for system calls
diff --git a/src/eckit_readers/TableReader.cc b/src/eckit_readers/TableReader.cc
index c590876..36a0ee7 100644
--- a/src/eckit_readers/TableReader.cc
+++ b/src/eckit_readers/TableReader.cc
@@ -1,33 +1,12 @@
/***************************** LICENSE START ***********************************
- Copyright 2012 ECMWF and INPE. This software is distributed under the terms
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
of the Apache License version 2.0. In applying this license, ECMWF does not
waive the privileges and immunities granted to it by virtue of its status as
an Intergovernmental Organization or submit itself to any jurisdiction.
***************************** LICENSE END *************************************/
-/******************************* LICENSE *******************************
-
-
- Copyright 2011 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************* LICENSE *******************************/
-
-
#include "TableReader.h"
diff --git a/src/eckit_readers/TableReader.h b/src/eckit_readers/TableReader.h
index 3717f21..6c023e8 100644
--- a/src/eckit_readers/TableReader.h
+++ b/src/eckit_readers/TableReader.h
@@ -1,32 +1,12 @@
/***************************** LICENSE START ***********************************
- Copyright 2012 ECMWF and INPE. This software is distributed under the terms
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
of the Apache License version 2.0. In applying this license, ECMWF does not
waive the privileges and immunities granted to it by virtue of its status as
an Intergovernmental Organization or submit itself to any jurisdiction.
***************************** LICENSE END *************************************/
-/******************************* LICENSE *******************************
-
-
- Copyright 2011 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- ******************************* LICENSE *******************************/
-
#ifndef TableReader_H
#define TableReader_H
diff --git a/src/libMagWrapper/MagPlus.cc b/src/libMagWrapper/MagPlus.cc
index 14d7e7d..e1b9869 100644
--- a/src/libMagWrapper/MagPlus.cc
+++ b/src/libMagWrapper/MagPlus.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#include "MagPlus.h"
#include <iostream>
diff --git a/src/libMagWrapper/MagPlus.h b/src/libMagWrapper/MagPlus.h
index fd89184..cfeae9b 100644
--- a/src/libMagWrapper/MagPlus.h
+++ b/src/libMagWrapper/MagPlus.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#ifndef MagPlus_H
#define MagPlus_H
diff --git a/src/libMagWrapper/MagRequest.h b/src/libMagWrapper/MagRequest.h
index eb97cb0..a45af4b 100644
--- a/src/libMagWrapper/MagRequest.h
+++ b/src/libMagWrapper/MagRequest.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file MagRequest.h
\brief Definition of the Template class MagRequest.
diff --git a/src/magics.h b/src/magics.h
index fa81581..c9da609 100644
--- a/src/magics.h
+++ b/src/magics.h
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file magics.h
@@ -263,6 +254,13 @@ inline MAGICS_NO_EXPORT bool magCompare(const string &s1, const string &s2)
#endif
}
+inline MAGICS_NO_EXPORT std::string replacePathWithHome(const string & path)
+{
+ const std::string home_path = getEnvVariable("HOME");
+ std::string filename = path.substr(path.find_last_of("/\\"));
+ return home_path + filename;
+}
+
/*!
\brief returns the biggest integer inside a double
*/
diff --git a/src/magics_ecmwf_log.h b/src/magics_ecmwf_log.h
index bf3769e..48ca66e 100644
--- a/src/magics_ecmwf_log.h
+++ b/src/magics_ecmwf_log.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef magicsplusplus_ecmwf_H
#define magicsplusplus_ecmwf_H
diff --git a/src/oda/ODACalls.cc b/src/oda/ODACalls.cc
index d702b2f..d45191a 100644
--- a/src/oda/ODACalls.cc
+++ b/src/oda/ODACalls.cc
@@ -1,21 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "MagLog.h"
#include "FortranMagics.h"
diff --git a/src/oda/OdaDecoder.cc b/src/oda/OdaDecoder.cc
index 0b21785..107b21c 100644
--- a/src/oda/OdaDecoder.cc
+++ b/src/oda/OdaDecoder.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file OdaDecoder.cc
\brief Implementation of the Template class OdaDecoder.
diff --git a/src/oda/OdaDecoder.h b/src/oda/OdaDecoder.h
index 322a847..591ac3a 100644
--- a/src/oda/OdaDecoder.h
+++ b/src/oda/OdaDecoder.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file OdaDecoder.h
\brief Definition of the Template class OdaDecoder.
diff --git a/src/params/Akima474Method.xml b/src/params/Akima474Method.xml
index e6d1e7e..91a2bec 100644
--- a/src/params/Akima474Method.xml
+++ b/src/params/Akima474Method.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="ContourMethod" xmltag="akima474" name="Akima474Method" used_by="ContourTechnique" directory="visualisers" prefix="akima" action="pcont" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Generates contour lines from a regular/irregular grid of data points.
First a denser regular grid is created based on the original grid and then
diff --git a/src/params/Akima760Method.xml b/src/params/Akima760Method.xml
index d2bc814..b61653e 100644
--- a/src/params/Akima760Method.xml
+++ b/src/params/Akima760Method.xml
@@ -9,6 +9,16 @@
grid, which then determines the smoothness of the isolines.
</documentation>
<parameter xml="x_resolution" from="float" name="contour_akima_x_resolution" default="1.5" member="resolutionX" to="float">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>X resolution of Akima interpolation </documentation>
<migration> New Magics: Parameter resolutionX sent to new Magics[AKIMA760]. </migration>
<release>Magics++0.1 </release>
diff --git a/src/params/Akima761Method.xml b/src/params/Akima761Method.xml
index 569751b..39fa5d4 100644
--- a/src/params/Akima761Method.xml
+++ b/src/params/Akima761Method.xml
@@ -5,6 +5,16 @@
</documentation>
<parameter xml="x_resolution" from="float" name="contour_akima_x_resolution" default="1.5" member="resolutionX" to="float">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> X Resolution of the Akima output matrix </documentation>
<migration> New Magics: Parameter resolutionX sent to new Magics[AKIMA760]. </migration>
<release>Magics++0.1 </release>
diff --git a/src/params/ArrowPlotting.xml b/src/params/ArrowPlotting.xml
index fdbd5c9..b6a22de 100644
--- a/src/params/ArrowPlotting.xml
+++ b/src/params/ArrowPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="WindPlotting" xmltag="arrow" name="ArrowPlotting" directory="visualisers" prefix="wind/wind_arrow" action="pwind" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> </documentation>
<parameter from="string" name="wind_arrow_calm_indicator" default="off" member="calm" to="CalmIndicator" values="on/off">
diff --git a/src/params/AutomaticContourMethod.xml b/src/params/AutomaticContourMethod.xml
index 379a24a..e93924a 100644
--- a/src/params/AutomaticContourMethod.xml
+++ b/src/params/AutomaticContourMethod.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="ContourMethod" directory="visualisers" include="AutomaticContourMethod.h" name="AutomaticContourMethod"/></magics>
diff --git a/src/params/AutomaticPlotManager.xml b/src/params/AutomaticPlotManager.xml
index 4b41a45..ab79237 100644
--- a/src/params/AutomaticPlotManager.xml
+++ b/src/params/AutomaticPlotManager.xml
@@ -2,6 +2,16 @@
<class action="popen/pnew" directory="common" name="AutomaticPlotManager">
<documentation> Object used to handle the call to the Pseudo action routine PNEW </documentation>
<parameter xml="plot_start" from="string" name="plot_start" default="bottom" member="plot_start" to="string">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Position of first page plotted (BOTTOM/TOP) </documentation>
<migration> New Magics: Parameter plot_start sent to new Magics[Page]. </migration>
<release>Magics++0.2 </release>
diff --git a/src/params/Axis.xml b/src/params/Axis.xml
index c6f279f..9936c41 100644
--- a/src/params/Axis.xml
+++ b/src/params/Axis.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" metview="maxis" xmltag="axis" name="Axis">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> This object creates an axis for non-geographical plots. </documentation>
<parameter from="string" name="axis_orientation" default="horizontal" member="orientation" to="string" values="horizontal/vertical">
<documentation> Orientation of axis </documentation>
diff --git a/src/params/AxisMethod.xml b/src/params/AxisMethod.xml
index 7e3a835..5d2695e 100644
--- a/src/params/AxisMethod.xml
+++ b/src/params/AxisMethod.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" include="AxisMethod.h" name="AxisMethod"/></magics>
diff --git a/src/params/Bar.xml b/src/params/Bar.xml
index 28186f7..b707e1c 100644
--- a/src/params/Bar.xml
+++ b/src/params/Bar.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" inherits="Graph" xmltag="bar" name="Bar">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter xml="width" from="float" name="graph_bar_width" default="INT_MAX" member="width" to="float">
<documentation> The width of a bar in a bar chart </documentation>
</parameter>
diff --git a/src/params/BaseDriver.xml b/src/params/BaseDriver.xml
index 7d4ebc2..eefc54f 100644
--- a/src/params/BaseDriver.xml
+++ b/src/params/BaseDriver.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="drivers" prefix="output" xmltag="driver" name="BaseDriver" abstract="yes">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation for_docs="no">
These parameters are common to all the output drivers and can be used whichever output format is selected.
</documentation>
diff --git a/src/params/BinaryDriver.xml b/src/params/BinaryDriver.xml
index e6c1bae..f2fbcd0 100644
--- a/src/params/BinaryDriver.xml
+++ b/src/params/BinaryDriver.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="Binary" directory="drivers" inherits="BaseDriver" name="BinaryDriver">
<documentation>
diff --git a/src/params/BinaryObject.xml b/src/params/BinaryObject.xml
index 64a7ca2..0116d34 100644
--- a/src/params/BinaryObject.xml
+++ b/src/params/BinaryObject.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="common" prefix="mgb" xmltag="mgb" name="BinaryObject">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="mgb_filename">
<release>Magics++2.9 </release>
diff --git a/src/params/BinningObject.xml b/src/params/BinningObject.xml
index c86eee1..8b73fcc 100644
--- a/src/params/BinningObject.xml
+++ b/src/params/BinningObject.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pbinning" directory="decoders" prefix="binning" xmltag="binning" name="BinningObject">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This is responsible for accessing biining data .. scattered data can displayed as matrix!
</documentation>
diff --git a/src/params/BothValuePlotMethod.xml b/src/params/BothValuePlotMethod.xml
index 95beef7..d9c58bb 100644
--- a/src/params/BothValuePlotMethod.xml
+++ b/src/params/BothValuePlotMethod.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="ValuePlotMethod" xmltag="both" name="BothValuePlotMethod" directory="visualisers" prefix="contour/contour_grid_value/contour_grid_value" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>This object is reponsible for plotting both values and markers on grid points. </documentation>
<parameter member="markerHeight" to="float" default="0.25" from="float" name="contour_grid_value_marker_height">
diff --git a/src/params/Boundaries.xml b/src/params/Boundaries.xml
index 45e19a1..21e5f79 100644
--- a/src/params/Boundaries.xml
+++ b/src/params/Boundaries.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NoBoundaries" xmltag="boundaries" name="Boundaries" directory="visualisers" prefix="map/map_boundaries/map_boundaries" action="pcoast" include="Boundaries.h" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>This object sets the properties of the political boundaries. </documentation>
diff --git a/src/params/BoxPlotBox.xml b/src/params/BoxPlotBox.xml
index 6f96f6e..29c319b 100644
--- a/src/params/BoxPlotBox.xml
+++ b/src/params/BoxPlotBox.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" prefix="boxplot/boxplot_box" xmltag="box" name="BoxPlotBox" include='BoxPlotItem.h'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="colour" to="Colour" default="sky" from="string" name="boxplot_box_colour">
<documentation>Colour of the box </documentation>
</parameter>
diff --git a/src/params/BoxPlotBoxBorder.xml b/src/params/BoxPlotBoxBorder.xml
index b60c38a..5cdb52b 100644
--- a/src/params/BoxPlotBoxBorder.xml
+++ b/src/params/BoxPlotBoxBorder.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" prefix="boxplot/boxplot_box_border" xmltag="box_border" name="BoxPlotBoxBorder" include='BoxPlotItem.h' inherits='NoBoxPlotBoxBorder'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="colour" to="Colour" default="navy" from="string" name="boxplot_box_border_colour">
<documentation>Colour of the box border </documentation>
</parameter>
diff --git a/src/params/BoxPlotDecoder.xml b/src/params/BoxPlotDecoder.xml
index 6cbd081..6d20491 100644
--- a/src/params/BoxPlotDecoder.xml
+++ b/src/params/BoxPlotDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="decoders" prefix="boxplot" xmltag="boxplot_input" name="BoxPlotDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>The following parameters allow the user to define both the data
and the plotting attributes of boxplots. </documentation>
diff --git a/src/params/BoxPlotMedian.xml b/src/params/BoxPlotMedian.xml
index 1999a6a..ca11ef7 100644
--- a/src/params/BoxPlotMedian.xml
+++ b/src/params/BoxPlotMedian.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" prefix="boxplot/boxplot_median" xmltag="median" name="BoxPlotMedian" include='BoxPlotItem.h' inherits='NoBoxPlotMedian'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="colour" to="Colour" default="navy" from="string" name="boxplot_median_colour">
<documentation>Colour of the median line </documentation>
</parameter>
diff --git a/src/params/BoxPlotVisualiser.xml b/src/params/BoxPlotVisualiser.xml
index f9fad7c..9ebdea9 100644
--- a/src/params/BoxPlotVisualiser.xml
+++ b/src/params/BoxPlotVisualiser.xml
@@ -1,5 +1,15 @@
<magics>
<class perfix="boxplot" directory="visualisers" inherits="BoxPlotDecoder" xmltag="boxplot" name="BoxPlotVisualiser">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>The following parameters allow the user to define both the data
and the plotting attributes of boxplots. </documentation>
diff --git a/src/params/BoxPlotWhiskerBorder.xml b/src/params/BoxPlotWhiskerBorder.xml
index ab5fec8..838a735 100644
--- a/src/params/BoxPlotWhiskerBorder.xml
+++ b/src/params/BoxPlotWhiskerBorder.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" prefix="boxplot/boxplot_whisker/boxplot_whisker_box/boxplot_whisker_box_border" xmltag="whisker_border" name="BoxPlotWhiskerBorder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="colour" to="Colour" default="navy" from="string" name="boxplot_whisker_box_border_colour">
<documentation>Colour of the whisker box border </documentation>
</parameter>
diff --git a/src/params/BoxPlotWhiskerBox.xml b/src/params/BoxPlotWhiskerBox.xml
index bc83a04..620fe5b 100644
--- a/src/params/BoxPlotWhiskerBox.xml
+++ b/src/params/BoxPlotWhiskerBox.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" prefix="boxplot/boxplot_whisker/boxplot_whisker_box" xmltag="whisker_box" name="BoxPlotWhiskerBox">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="colour" to="Colour" default="sky" from="string" name="boxplot_whisker_box_colour">
<documentation>Colour of the whisker box </documentation>
</parameter>
diff --git a/src/params/BoxPlotWhiskerLine.xml b/src/params/BoxPlotWhiskerLine.xml
index c0f9dda..d2d1386 100644
--- a/src/params/BoxPlotWhiskerLine.xml
+++ b/src/params/BoxPlotWhiskerLine.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" prefix="boxplot/boxplot_whisker/boxplot_whisker_line" xmltag="whisker_line" name="BoxPlotWhiskerLine">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="colour" to="Colour" default="navy" from="string" name="boxplot_whisker_line_colour">
<documentation>Colour of the whisker line </documentation>
</parameter>
diff --git a/src/params/CairoDriver.xml b/src/params/CairoDriver.xml
index 39ef8c6..d1933af 100644
--- a/src/params/CairoDriver.xml
+++ b/src/params/CairoDriver.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="BaseDriver" xmltag="cairo" name="CairoDriver" directory="drivers" prefix="output/output_cairo" action="Cairo" include="CairoDriver.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation for_docs="no">
Output driver using the Cairo graphics library.
</documentation>
diff --git a/src/params/CalculateColourTechnique.xml b/src/params/CalculateColourTechnique.xml
index 6b46ab7..6d2633f 100644
--- a/src/params/CalculateColourTechnique.xml
+++ b/src/params/CalculateColourTechnique.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="ColourTechnique" implements="ColourTableDefinitionComputeInterface" xmltag="calculate" name="CalculateColourTechnique" directory="visualisers" prefix="contour/contour/contour_shade/contour_shade/contour_shade" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="max" to="Colour" default="blue" from="string" name="contour_shade_max_level_colour">
<documentation> Highest shading band colour </documentation>
diff --git a/src/params/CalculateHeightTechnique.xml b/src/params/CalculateHeightTechnique.xml
index ae7b47a..3e5c02c 100644
--- a/src/params/CalculateHeightTechnique.xml
+++ b/src/params/CalculateHeightTechnique.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" inherits="HeightTechnique" include="HeightTechnique.h" name="CalculateHeightTechnique"/></magics>
diff --git a/src/params/CalmIndicator.xml b/src/params/CalmIndicator.xml
index 2521273..ba53d4f 100644
--- a/src/params/CalmIndicator.xml
+++ b/src/params/CalmIndicator.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" name="CalmIndicator"/></magics>
diff --git a/src/params/CartesianTransformation.xml b/src/params/CartesianTransformation.xml
index 6342020..e1f387c 100644
--- a/src/params/CartesianTransformation.xml
+++ b/src/params/CartesianTransformation.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="Transformation" metview_prefix="subpage_" xmltag="cartesian" name="CartesianTransformation" directory="common" prefix="subpage" action="pnew">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
This object contains the attributes to the cartesian Projection
<parameter member="x" to="XCoordinate" default="regular" from="string" name="subpage_x_axis_type">
diff --git a/src/params/CdfGraph.xml b/src/params/CdfGraph.xml
index c6c2cd3..a8c7dc1 100644
--- a/src/params/CdfGraph.xml
+++ b/src/params/CdfGraph.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pcdfgram" directory="visualisers" prefix="cdf" xmltag="cdfgraph" name="CdfGraph">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The Epsgram is responsible for accessing the espgram database its data to MAGICS.
</documentation>
diff --git a/src/params/CellShading.xml b/src/params/CellShading.xml
index 93cbd00..1b6a77a 100644
--- a/src/params/CellShading.xml
+++ b/src/params/CellShading.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="ShadingTechnique" xmltag="cell_shading" name="CellShading" directory="visualisers" prefix="contour/contour/contour_shade/contour_shade_cell" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="resolution" to="float" default="10" from="float" name="contour_shade_cell_resolution">
<documentation> Number of cells per cm for CELL shading </documentation>
diff --git a/src/params/CircleOriginMarker.xml b/src/params/CircleOriginMarker.xml
index 8b3c50a..b6d790e 100644
--- a/src/params/CircleOriginMarker.xml
+++ b/src/params/CircleOriginMarker.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="OriginMarker" directory="visualisers" include="OriginMarker.h" name="CircleOriginMarker"/></magics>
diff --git a/src/params/Cities.xml b/src/params/Cities.xml
index 7b22a2c..1044000 100644
--- a/src/params/Cities.xml
+++ b/src/params/Cities.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="NoCities" name="Cities" directory="visualisers" action="pcoast" include="Cities.h" doc_inherits="no">
diff --git a/src/params/ClassicMtgDecoder.xml b/src/params/ClassicMtgDecoder.xml
index 5aad02d..a46b58c 100644
--- a/src/params/ClassicMtgDecoder.xml
+++ b/src/params/ClassicMtgDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="decoders" prefix="metgram" xmltag="metgram" name="ClassicMtgDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The Classic Metgram is responsible for accessing the classic metgram database and prepare the data to plotting.
</documentation>
diff --git a/src/params/CoastPlotting.xml b/src/params/CoastPlotting.xml
index 145f48a..39a736f 100644
--- a/src/params/CoastPlotting.xml
+++ b/src/params/CoastPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NoCoastPlotting" xmltag="coast" name="CoastPlotting" used_by="Coastlines" directory="visualisers" prefix="map/map_coastline" action="pcoast" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="colour" to="Colour" default="black" from="string" name="map_coastline_colour">
<documentation>Colour of coastlines </documentation>
diff --git a/src/params/Coastlines.xml b/src/params/Coastlines.xml
index 7734b05..b749233 100644
--- a/src/params/Coastlines.xml
+++ b/src/params/Coastlines.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="coastlines" name="Coastlines" metview="MCOAST" directory="visualisers" prefix="map" action="pcoast">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The parameters relating to action routine PCOAST (C++ class Coastlines) enable
users to control the plotting of coastlines and grid lines.
diff --git a/src/params/ColourTechnique.xml b/src/params/ColourTechnique.xml
index a366076..1617061 100644
--- a/src/params/ColourTechnique.xml
+++ b/src/params/ColourTechnique.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" name="ColourTechnique"/></magics>
diff --git a/src/params/ContinuousLegendMethod.xml b/src/params/ContinuousLegendMethod.xml
index f7e9599..f0d6e18 100644
--- a/src/params/ContinuousLegendMethod.xml
+++ b/src/params/ContinuousLegendMethod.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="LegendMethod" name="ContinuousLegendMethod" used_by="Legend" directory="visualisers" action="legend" include="LegendMethod.h" doc_inherits="no">
diff --git a/src/params/Contour.xml b/src/params/Contour.xml
index 19fae70..3a01614 100644
--- a/src/params/Contour.xml
+++ b/src/params/Contour.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="contour" name="Contour" metview="MCONT" action="pcont" prefix="contour" directory="visualisers" fortan="pcont" root="contour">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This controls the plotting of isolines, contour bands and grid points.
</documentation>
diff --git a/src/params/ContourMethod.xml b/src/params/ContourMethod.xml
index 6242320..96ff166 100644
--- a/src/params/ContourMethod.xml
+++ b/src/params/ContourMethod.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" include="ContourMethod.h" name="ContourMethod"/></magics>
diff --git a/src/params/CountSelectionType.xml b/src/params/CountSelectionType.xml
index a607296..ef1eccc 100644
--- a/src/params/CountSelectionType.xml
+++ b/src/params/CountSelectionType.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="LevelSelection" xmltag="count" name="CountSelectionType" directory="visualisers" prefix="contour/contour/contour_level" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The number of contour levels may be set by the user by setting
the parameter CONTOUR_LEVEL_SELECTION_TYPE to 'COUNT' (default)
diff --git a/src/params/Curve.xml b/src/params/Curve.xml
index 5baf1d2..e5272e0 100644
--- a/src/params/Curve.xml
+++ b/src/params/Curve.xml
@@ -3,6 +3,16 @@
<documentation> Here comes the documentation of the Curve object </documentation>
<parameter xml="line" from="string" name="graph_line" default="on" member="line" to="bool">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Plot the curve line </documentation>
<set name="graph_line_style" value="on"> </set>
<set name="graph_line_colour" value="on"> </set>
diff --git a/src/params/CurveArea.xml b/src/params/CurveArea.xml
index 33c32fd..f299b18 100644
--- a/src/params/CurveArea.xml
+++ b/src/params/CurveArea.xml
@@ -2,6 +2,16 @@
<class directory="visualisers" inherits="Curve" include="Curve.h" name="CurveArea">
<parameter member="shade" to="GraphShade" default="on" from="string" name="graph_shade">
<option xml="shading" fortran="on" include="GraphShade.h" name="GraphShade"> </option>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<option xml="noshading" fortran="off" include="GraphShade.h" name="NoGraphShade"> </option>
<documentation>Turn the shading on </documentation>
</parameter>
diff --git a/src/params/DateAxisMethod.xml b/src/params/DateAxisMethod.xml
index 7ac76f3..438c1c2 100644
--- a/src/params/DateAxisMethod.xml
+++ b/src/params/DateAxisMethod.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="AxisMethod" xmltag="date" name="DateAxisMethod" prefix="axis/axis_date" directory="visualisers" include="DateAxis.h" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter from="string" name="axis_date_type" default="days" member="method" to="string" values="automatic/years/months/days/hours">
<documentation> Select the type of date axis. </documentation>
diff --git a/src/params/DateGribLoopStep.xml b/src/params/DateGribLoopStep.xml
index cec5565..c0388d4 100644
--- a/src/params/DateGribLoopStep.xml
+++ b/src/params/DateGribLoopStep.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="GribLoopStep" xmltag="loopondate" name="DateGribLoopStep" directory="decoders" prefix="grib/grib_loop_step" action="pgrib" include="GribLoopStep.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Sets the parameters related to looping on dates in a GRIB loop.
</documentation>
diff --git a/src/params/DotGraphShadeStyle.xml b/src/params/DotGraphShadeStyle.xml
index b0c7298..4ac9d80 100644
--- a/src/params/DotGraphShadeStyle.xml
+++ b/src/params/DotGraphShadeStyle.xml
@@ -1,6 +1,16 @@
<magics>
<class directory="visualisers" inherits="GraphShadeStyle" include="GraphShadeStyle.h" name="DotGraphShadeStyle">
<parameter xml="dot_density" from="int" name="graph_shade_dot_density" default="20" member="density" to="int">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Density per square cm. of shading dots </documentation>
</parameter>
diff --git a/src/params/DotOriginMarker.xml b/src/params/DotOriginMarker.xml
index 2baf31b..6caea02 100644
--- a/src/params/DotOriginMarker.xml
+++ b/src/params/DotOriginMarker.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="OriginMarker" directory="visualisers" include="OriginMarker.h" name="DotOriginMarker"/></magics>
diff --git a/src/params/DotPolyShadingMethod.xml b/src/params/DotPolyShadingMethod.xml
index a4c80f7..0963ea3 100644
--- a/src/params/DotPolyShadingMethod.xml
+++ b/src/params/DotPolyShadingMethod.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="PolyShadingMethod" xmltag="dot" name="DotPolyShadingMethod" directory="visualisers" prefix="contour/contour/contour_shade/contour_shade/contour_shade" action="pcont" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="size" to="float" default="0.02" from="float" name="contour_shade_dot_size">
<documentation> Size of dot in shading pattern </documentation>
diff --git a/src/params/DumpShading.xml b/src/params/DumpShading.xml
index da2cc1e..fef9307 100644
--- a/src/params/DumpShading.xml
+++ b/src/params/DumpShading.xml
@@ -1,4 +1,14 @@
<magics>
<class inherits="ShadingTechnique" xmltag="dump_shading" name="DumpShading" directory="visualisers" prefix="contour" action="pcont" include='CellShading.h'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
</class></magics>
diff --git a/src/params/DumpShadingWrapper.xml b/src/params/DumpShadingWrapper.xml
index 26ab63a..e17f9d4 100644
--- a/src/params/DumpShadingWrapper.xml
+++ b/src/params/DumpShadingWrapper.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="ShadingTechnique" xmltag="cell_shading" name="CellShading" directory="visualisers" prefix="contour/contour/contour_shade/contour_shade_cell" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="resolution" to="float" default="10" from="float" name="contour_shade_cell_resolution">
<documentation> Number of cells per cm for CELL shading </documentation>
diff --git a/src/params/EfiDataDecoder.xml b/src/params/EfiDataDecoder.xml
index 1a59290..91fc5af 100644
--- a/src/params/EfiDataDecoder.xml
+++ b/src/params/EfiDataDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class action="xml" directory="decoders" name="EfiDataDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The Efi decoder is responsible for decoding EFi Ascii file.(Metops)
</documentation>
diff --git a/src/params/EfiGraph.xml b/src/params/EfiGraph.xml
index 27d4dda..ff9dfe9 100644
--- a/src/params/EfiGraph.xml
+++ b/src/params/EfiGraph.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pcdfgram" directory="visualisers" prefix="efi" xmltag="efigraph" name="EfiGraph">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The Epsgram is responsible for accessing the espgram database its data to MAGICS.
</documentation>
diff --git a/src/params/EfiJSon.xml b/src/params/EfiJSon.xml
index b0387c8..6864a95 100644
--- a/src/params/EfiJSon.xml
+++ b/src/params/EfiJSon.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="web" prefix="efijson" xmltag="efijson" name="EfiJSon">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="efijson_input_filename">
<documentation> Path to the file containing the Efi data (JSon format) </documentation>
</parameter>
diff --git a/src/params/EfigramDecoder.xml b/src/params/EfigramDecoder.xml
index 6867448..7167b3c 100644
--- a/src/params/EfigramDecoder.xml
+++ b/src/params/EfigramDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pefigram" directory="decoders" prefix="efi" xmltag="efigram" name="EfigramDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The Epsgram is responsible for accessing the espgram database its data to MAGICS.
</documentation>
diff --git a/src/params/EpsBufr.xml b/src/params/EpsBufr.xml
index ace094b..bd1cbbe 100644
--- a/src/params/EpsBufr.xml
+++ b/src/params/EpsBufr.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="decoders" prefix="epsbufr" xmltag="epsbufr" name="EpsBufr">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="epsbufr_input_filename">
<documentation> Path to the file containing the Bufr data </documentation>
</parameter>
diff --git a/src/params/EpsCloud.xml b/src/params/EpsCloud.xml
index 01c974f..fa7a4ac 100644
--- a/src/params/EpsCloud.xml
+++ b/src/params/EpsCloud.xml
@@ -1,5 +1,15 @@
<magics>
<class action="peps" directory="visualisers" prefix="eps/eps_rose_cloud" xmltag="epscloud" name="EpsCloud">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The EpsCloud is repsonsible for plotting the espgram using Cloud rose visualisation
</documentation>
diff --git a/src/params/EpsDirection.xml b/src/params/EpsDirection.xml
index b5a1bca..0af7cb3 100644
--- a/src/params/EpsDirection.xml
+++ b/src/params/EpsDirection.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="visualisers" prefix="eps/eps_direction" xmltag="epsdirection" name="EpsDirection">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The EpsPlumeis responsible for plotting epsplume graph
</documentation>
diff --git a/src/params/EpsGraph.xml b/src/params/EpsGraph.xml
index 264be0a..7125ea0 100644
--- a/src/params/EpsGraph.xml
+++ b/src/params/EpsGraph.xml
@@ -1,5 +1,15 @@
<magics>
<class action="peps" directory="visualisers" prefix="eps" xmltag="epsgraph" name="EpsGraph">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The Epsgraph is repsonsible for plotting the espgram using box and whisker visualisation
</documentation>
diff --git a/src/params/EpsPlume.xml b/src/params/EpsPlume.xml
index 77fad69..442d7e6 100644
--- a/src/params/EpsPlume.xml
+++ b/src/params/EpsPlume.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="visualisers" prefix="eps/eps_plume" xmltag="epsplume" name="EpsPlume">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The EpsPlumeis responsible for plotting epsplume graph
</documentation>
diff --git a/src/params/EpsShade.xml b/src/params/EpsShade.xml
index 1bc58f8..6e62c72 100644
--- a/src/params/EpsShade.xml
+++ b/src/params/EpsShade.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="visualisers" prefix="eps" xmltag="epsshade" name="EpsShade">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The EpsSahde is responsible for plotting climate information as Shaded area.
</documentation>
diff --git a/src/params/EpsWave.xml b/src/params/EpsWave.xml
index 9d3baea..ff69132 100644
--- a/src/params/EpsWave.xml
+++ b/src/params/EpsWave.xml
@@ -1,5 +1,15 @@
<magics>
<class action="peps" directory="visualisers" prefix="eps/eps_rose_wave" xmltag="epswave" name="EpsWave">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The Epsgraph is repsonsible for plotting the espgram using wind rose visualisation
</documentation>
diff --git a/src/params/EpsWind.xml b/src/params/EpsWind.xml
index 4bf9c3b..e968549 100644
--- a/src/params/EpsWind.xml
+++ b/src/params/EpsWind.xml
@@ -1,5 +1,15 @@
<magics>
<class action="peps" directory="visualisers" prefix="eps/eps_rose_wind" xmltag="epswind" name="EpsWind">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The Epsgraph is repsonsible for plotting the espgram using wind rose visualisation
</documentation>
diff --git a/src/params/EpsXmlInput.xml b/src/params/EpsXmlInput.xml
index cfc294f..1020172 100644
--- a/src/params/EpsXmlInput.xml
+++ b/src/params/EpsXmlInput.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="decoders" prefix="epsxml" xmltag="epsxml" name="EpsXmlInput">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="epsxml_input_filename">
<documentation> Path to the file containing the Xml Description </documentation>
</parameter>
diff --git a/src/params/EpsgramDecoder.xml b/src/params/EpsgramDecoder.xml
index 128a048..e2d994c 100644
--- a/src/params/EpsgramDecoder.xml
+++ b/src/params/EpsgramDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="epsgram" name="EpsgramDecoder" xml_data="eps_title" directory="decoders" prefix="eps" action="peps">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The Epsgram is responsible for accessing the espgram database its data to MAGICS.
</documentation>
diff --git a/src/params/EquidistantTableMode.xml b/src/params/EquidistantTableMode.xml
index ac3749f..e1328bb 100644
--- a/src/params/EquidistantTableMode.xml
+++ b/src/params/EquidistantTableMode.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class implements="LookupTableMode" directory="visualisers" name="EquidistantTableMode">
diff --git a/src/params/FixedTableMode.xml b/src/params/FixedTableMode.xml
index 1e5d990..8e9593d 100644
--- a/src/params/FixedTableMode.xml
+++ b/src/params/FixedTableMode.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="LookupTableMode" directory="visualisers" name="FixedTableMode">
<parameter member="levels" to="intarray" default="intarray()" from="intarray" name="image_level_list">
diff --git a/src/params/FlagPlotting.xml b/src/params/FlagPlotting.xml
index fb01a9f..03e88a2 100644
--- a/src/params/FlagPlotting.xml
+++ b/src/params/FlagPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="WindPlotting" xmltag="flags" name="FlagPlotting" directory="visualisers" prefix="wind/wind_flag" action="pwind" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> WMO standard wind flags; represented by barbs and solid pennants </documentation>
<parameter from="string" name="wind_flag_calm_indicator" default="on" member="calm" to="CalmIndicator" values="on/off">
<documentation> Plot calm indicator circle, if wind speed is less than 0.5 m/s (ON / OFF) </documentation>
diff --git a/src/params/FortranRootSceneNode.xml b/src/params/FortranRootSceneNode.xml
index ba48e56..ecdf177 100644
--- a/src/params/FortranRootSceneNode.xml
+++ b/src/params/FortranRootSceneNode.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="super_page" name="FortranRootSceneNode" directory="common" prefix="super_page" action="pnew" include="RootSceneNode.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="width" to="float" default="29.7" from="float" name="super_page_x_length">
<documentation> Horizontal length of super page </documentation>
diff --git a/src/params/FortranSceneNode.xml b/src/params/FortranSceneNode.xml
index 755df8f..2082ac2 100644
--- a/src/params/FortranSceneNode.xml
+++ b/src/params/FortranSceneNode.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="page" name="FortranSceneNode" directory="common" prefix="page" action="pnew" include="SceneNode.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="x" to="float" default="0" from="float" name="page_x_position">
<release>Magics++0.1 </release>
<documentation> X-Coordinate of lower left hand corner of page.Default </documentation>
diff --git a/src/params/FortranViewNode.xml b/src/params/FortranViewNode.xml
index 3938899..02a870b 100644
--- a/src/params/FortranViewNode.xml
+++ b/src/params/FortranViewNode.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="subpage" name="FortranViewNode" directory="common" prefix="subpage/subpage/subpage" action="pnew" include="ViewNode.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/GDDriver.xml b/src/params/GDDriver.xml
index f0b3094..8de0e77 100644
--- a/src/params/GDDriver.xml
+++ b/src/params/GDDriver.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="drivers" inherits="BaseDriver" prefix="output" xmltag="gd" name="GDDriver">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation for_docs="no">
This output driver produces raster output in PNG, GIF, and JPEG format.
PNG output can be produced with a transparent background which can be used for overlays.
diff --git a/src/params/GenericSQLDecoder.xml b/src/params/GenericSQLDecoder.xml
index 7caff0c..50fef10 100644
--- a/src/params/GenericSQLDecoder.xml
+++ b/src/params/GenericSQLDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="decoders" prefix="sql" xmltag="genericsql" name="GenericSQLDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Here comes the description of the GenericSQLDcoder
</documentation>
diff --git a/src/params/GeoJSon.xml b/src/params/GeoJSon.xml
index 9e021ff..c7d4b8a 100644
--- a/src/params/GeoJSon.xml
+++ b/src/params/GeoJSon.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="geojson" name="GeoJSon" directory="web" prefix="geojson" action="pgeojson" include="GeoJSon.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="type" to="string" default="file" from="string" name="geojson_input_type" values='string/file'>
<documentation> data are in a file ( file ) or passed as a string (string) </documentation>
</parameter>
diff --git a/src/params/GeoJsonDriver.xml b/src/params/GeoJsonDriver.xml
index 8536c2d..6d9d9ba 100644
--- a/src/params/GeoJsonDriver.xml
+++ b/src/params/GeoJsonDriver.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="BaseDriver" xmltag="GeoJson" name="GeoJsonDriver" directory="drivers" prefix="GeoJson" action="GeoJson">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation for_docs="no">
This output driver produces output in the GeoJson format.
diff --git a/src/params/GeoPointsDecoder.xml b/src/params/GeoPointsDecoder.xml
index 652bd19..21e4390 100644
--- a/src/params/GeoPointsDecoder.xml
+++ b/src/params/GeoPointsDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pgeo" directory="decoders" prefix="geo/geo_input" xmltag="geopoints" name="GeoPointsDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="geo_input_file_name">
<release>Magics++1.1 </release>
<documentation> The name of the input file containing the GeoPoints code field(s) </documentation>
diff --git a/src/params/GeoRectangularProjection.xml b/src/params/GeoRectangularProjection.xml
index 367f976..7ea1abe 100644
--- a/src/params/GeoRectangularProjection.xml
+++ b/src/params/GeoRectangularProjection.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="Transformation" xmltag="cylindrical" name="GeoRectangularProjection" directory="common" prefix="subpage" action="projection">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
These are the attributes of the GeoRectangular projection.
</documentation>
diff --git a/src/params/Graph.xml b/src/params/Graph.xml
index 3eed461..6eb26dd 100644
--- a/src/params/Graph.xml
+++ b/src/params/Graph.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" name="Graph">
</class></magics>
diff --git a/src/params/GraphArrow.xml b/src/params/GraphArrow.xml
index ce3c73c..547a6a5 100644
--- a/src/params/GraphArrow.xml
+++ b/src/params/GraphArrow.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" inherits="Graph" xmltag="arrow" include="Bar.h" name="GraphArrow">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="colour" to="Colour" default="black" from="string" name="graph_arrow_colour">
<documentation> The colour of the arrows </documentation>
</parameter>
diff --git a/src/params/GraphFlag.xml b/src/params/GraphFlag.xml
index 9573278..1aa85e9 100644
--- a/src/params/GraphFlag.xml
+++ b/src/params/GraphFlag.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" inherits="Graph" xmltag="flag" include="Bar.h" name="GraphFlag">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="colour" to="Colour" default="black" from="string" name="graph_flag_colour">
<documentation> The colour of the Flags! </documentation>
</parameter>
diff --git a/src/params/GraphPlotting.xml b/src/params/GraphPlotting.xml
index ebe8b92..998cc73 100644
--- a/src/params/GraphPlotting.xml
+++ b/src/params/GraphPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" xmltag="graph" name="GraphPlotting">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This action routine (and C++object) controls the plotting of curves, bar charts and area charts.
</documentation>
diff --git a/src/params/GraphShade.xml b/src/params/GraphShade.xml
index 3a79438..aa228f7 100644
--- a/src/params/GraphShade.xml
+++ b/src/params/GraphShade.xml
@@ -3,6 +3,16 @@
<parameter member="style" to="GraphShadeStyle" default="area_fill" from="string" name="graph_shade_style">
<option xml="solid" fortran="area_fill" include="GraphShadeStyle.h" name="GraphShadeStyle"> </option>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<option xml="hatch" fortran="hatch" include="GraphShadeStyle.h" name="HatchGraphShadeStyle"> </option>
<option xml="dot" fortran="dot" include="GraphShadeStyle.h" name="DotGraphShadeStyle"> </option>
<documentation> Style of shading </documentation>
diff --git a/src/params/GraphShadeStyle.xml b/src/params/GraphShadeStyle.xml
index 702dc43..f9c6fa7 100644
--- a/src/params/GraphShadeStyle.xml
+++ b/src/params/GraphShadeStyle.xml
@@ -1,6 +1,16 @@
<magics>
<class directory="visualisers" name="GraphShadeStyle">
<parameter xml="colour" from="string" name="graph_shade_colour" default="blue" member="colour" to="Colour">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> The colour of the shaded part of bars </documentation>
</parameter>
</class></magics>
diff --git a/src/params/GribAddressByteMode.xml b/src/params/GribAddressByteMode.xml
index 502ed38..5cc0033 100644
--- a/src/params/GribAddressByteMode.xml
+++ b/src/params/GribAddressByteMode.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="GribAddressMode" directory="decoders" include="GribAddressMode.h" name="GribAddressByteMode"/></magics>
diff --git a/src/params/GribAddressMode.xml b/src/params/GribAddressMode.xml
index 5ad6211..8ca58cf 100644
--- a/src/params/GribAddressMode.xml
+++ b/src/params/GribAddressMode.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="decoders" include="GribAddressMode.h" name="GribAddressMode"/></magics>
diff --git a/src/params/GribAddressRecordMode.xml b/src/params/GribAddressRecordMode.xml
index 47eae4b..b4e12ed 100644
--- a/src/params/GribAddressRecordMode.xml
+++ b/src/params/GribAddressRecordMode.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="GribAddressMode" directory="decoders" include="GribAddressMode.h" name="GribAddressRecordMode"/></magics>
diff --git a/src/params/GribDecoder.xml b/src/params/GribDecoder.xml
index e3837df..9e8e0f1 100644
--- a/src/params/GribDecoder.xml
+++ b/src/params/GribDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pgrib" directory="decoders" prefix="grib/grib" xmltag="grib" name="GribDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Responsible for reading and interpolating GRIB data.
</documentation>
diff --git a/src/params/GribLoop.xml b/src/params/GribLoop.xml
index 26d8fd7..d1da947 100644
--- a/src/params/GribLoop.xml
+++ b/src/params/GribLoop.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="gribloop" name="GribLoop" directory="decoders" prefix="grib" action="pgrib" include="GribDecoder.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The purpose of the GRIB loop is to easily create an animation. This feature
is only available in MagML.
diff --git a/src/params/GribLoopStep.xml b/src/params/GribLoopStep.xml
index b4d0841..da174fb 100644
--- a/src/params/GribLoopStep.xml
+++ b/src/params/GribLoopStep.xml
@@ -1,2 +1,12 @@
<magics>
<class action="pgrib" directory="decoders" prefix="grib/grib_loop_step" xmltag="loopondate" name="GribLoopStep"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/GridPlotting.xml b/src/params/GridPlotting.xml
index 3bfb1c0..07b235c 100644
--- a/src/params/GridPlotting.xml
+++ b/src/params/GridPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NoGridPlotting" xmltag="grid" name="GridPlotting" directory="visualisers" prefix="map/map_grid" action="pcoast" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This object will control the settings of the Map Grids.
</documentation>
diff --git a/src/params/GridShading.xml b/src/params/GridShading.xml
index e8c8826..ea333e0 100644
--- a/src/params/GridShading.xml
+++ b/src/params/GridShading.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="PolyShadingTechnique" name="GridShading" directory="visualisers" action="pcont" include="PolyShadingTechnique.h" doc_inherits="no">
diff --git a/src/params/HatchGraphShadeStyle.xml b/src/params/HatchGraphShadeStyle.xml
index 26b0e41..15a31bd 100644
--- a/src/params/HatchGraphShadeStyle.xml
+++ b/src/params/HatchGraphShadeStyle.xml
@@ -1,6 +1,16 @@
<magics>
<class directory="visualisers" inherits="GraphShadeStyle" include="GraphShadeStyle.h" name="HatchGraphShadeStyle">
<parameter xml="hatch_index" from="int" name="graph_shade_hatch_index" default="0" member="index" to="int">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>Hatch index number </documentation>
</parameter>
</class></magics>
diff --git a/src/params/HatchPolyShadingMethod.xml b/src/params/HatchPolyShadingMethod.xml
index d0758f6..4d82a11 100644
--- a/src/params/HatchPolyShadingMethod.xml
+++ b/src/params/HatchPolyShadingMethod.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="PolyShadingMethod" xmltag="hatch" name="HatchPolyShadingMethod" directory="visualisers" prefix="contour/contour/contour_shade/contour_shade/contour_shade_hatch" action="pcont" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="index" to="int" default="0" from="int" name="contour_shade_hatch_index">
<documentation>The hatching pattern(s) to use. 0 Provides an automatic sequence of patterns, other values set a constant pattern across all contour bands. </documentation>
diff --git a/src/params/HeightTechnique.xml b/src/params/HeightTechnique.xml
index 6d4763e..99bf612 100644
--- a/src/params/HeightTechnique.xml
+++ b/src/params/HeightTechnique.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" name="HeightTechnique"/></magics>
diff --git a/src/params/HiLo.xml b/src/params/HiLo.xml
index a2e4ccd..2e80f93 100644
--- a/src/params/HiLo.xml
+++ b/src/params/HiLo.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="HiLoBase" xmltag="hilo" name="HiLo" directory="visualisers" prefix="contour/contour_hilo" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Maxima/minima may be plotted as text and/or as numerical values,
default being symbols (H and L ).
diff --git a/src/params/HiLoBase.xml b/src/params/HiLoBase.xml
index 385210b..3075b63 100644
--- a/src/params/HiLoBase.xml
+++ b/src/params/HiLoBase.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" include="HiLoBase.h" name="HiLoBase"/></magics>
diff --git a/src/params/HiLoBoth.xml b/src/params/HiLoBoth.xml
index e775ed9..a6a919a 100644
--- a/src/params/HiLoBoth.xml
+++ b/src/params/HiLoBoth.xml
@@ -1,2 +1,12 @@
<magics>
<class action="pcont" directory="visualisers" inherits="HiLoTechnique" xmltag="both" name="HiLoBoth"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/HiLoMarker.xml b/src/params/HiLoMarker.xml
index c368ca5..2c1ff04 100644
--- a/src/params/HiLoMarker.xml
+++ b/src/params/HiLoMarker.xml
@@ -5,6 +5,16 @@
Users may define their own symbol by setting the parameter CONTOUR_HILO_MARKER_INDEX
</documentation>
<parameter xml="height" from="float" name="contour_hilo_marker_height" default="0.1" member="height" to="float">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Height of HILO marker symbol </documentation>
<release>Magics++0.2 </release>
</parameter>
diff --git a/src/params/HiLoMarkerBase.xml b/src/params/HiLoMarkerBase.xml
index e212e10..aef2f4a 100644
--- a/src/params/HiLoMarkerBase.xml
+++ b/src/params/HiLoMarkerBase.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" include="HiLoMarkerBase.h" name="HiLoMarkerBase"/></magics>
diff --git a/src/params/HiLoNumber.xml b/src/params/HiLoNumber.xml
index c9596c9..97c6361 100644
--- a/src/params/HiLoNumber.xml
+++ b/src/params/HiLoNumber.xml
@@ -4,6 +4,16 @@
This object is reponsible for plotting the HI/Lo as text.
</documentation>
<parameter xml="format" from="string" name="contour_hilo_format" default="(automatic)" member="format" to="string">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Format of HILO numbers (MAGICS Format/(AUTOMATIC)) </documentation>
<release>Magics++0.1 </release>
<release_info>Parameter defined but not implemented : expected in 0.7 </release_info>
diff --git a/src/params/HiLoTechnique.xml b/src/params/HiLoTechnique.xml
index 3d12cae..da12d29 100644
--- a/src/params/HiLoTechnique.xml
+++ b/src/params/HiLoTechnique.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pcont" directory="visualisers" prefix="contour/contour_hilo" xmltag="hilo" name="HiLoTechnique">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> common attributes to the HiLo technique plotting </documentation>
<parameter xml="height" from="float" name="contour_hilo_height" default="0.4" member="contour_hilo_height" to="float">
diff --git a/src/params/HiLoText.xml b/src/params/HiLoText.xml
index cb13fc4..549c158 100644
--- a/src/params/HiLoText.xml
+++ b/src/params/HiLoText.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="HiLoTechnique" xmltag="text" name="HiLoText" directory="visualisers" prefix="contour" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This object is reponsible for plotting the HI/Lo as text.
</documentation>
diff --git a/src/params/HighHiLo.xml b/src/params/HighHiLo.xml
index aa28b68..31d82e4 100644
--- a/src/params/HighHiLo.xml
+++ b/src/params/HighHiLo.xml
@@ -1,2 +1,12 @@
<magics>
<class inherits="HiLo" xmltag="high" name="HighHiLo" directory="visualisers" action="pcont" include="HiLo.h"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/Histogram.xml b/src/params/Histogram.xml
index 20a3b78..d0f7806 100644
--- a/src/params/Histogram.xml
+++ b/src/params/Histogram.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" xmltag="histogram" name="Histogram">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Here comes the description of the Histogram action
</documentation>
diff --git a/src/params/HistogramLegendMethod.xml b/src/params/HistogramLegendMethod.xml
index fb204f6..f86ac11 100644
--- a/src/params/HistogramLegendMethod.xml
+++ b/src/params/HistogramLegendMethod.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="LegendMethod" name="HistogramLegendMethod" used_by="Legend" directory="visualisers" action="legend" include="LegendMethod.h" doc_inherits="no">
<parameter member="label_frequency" to="int" default="1" from="int" name="legend_label_frequency">
diff --git a/src/params/HyperAxisMethod.xml b/src/params/HyperAxisMethod.xml
index ebde696..22d58b1 100644
--- a/src/params/HyperAxisMethod.xml
+++ b/src/params/HyperAxisMethod.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" inherits="AxisMethod" include="AxisMethod.h" name="HyperAxisMethod"/></magics>
diff --git a/src/params/ImageCalculateColourTechnique.xml b/src/params/ImageCalculateColourTechnique.xml
index 7490bff..0286a09 100644
--- a/src/params/ImageCalculateColourTechnique.xml
+++ b/src/params/ImageCalculateColourTechnique.xml
@@ -1,5 +1,15 @@
<magics>
<class implements="ColourTableDefinitionComputeInterface" xmltag="lut_computed" name="ImageCalculateColourTechnique" directory="visualisers" prefix="image" action="pimage">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="max" to="Colour" default="blue" from="string" name="image_max_level_colour">
<documentation> Highest image band colour </documentation>
<release>Magics++0.8 </release>
diff --git a/src/params/ImageListColourTechnique.xml b/src/params/ImageListColourTechnique.xml
index b508e16..c19a608 100644
--- a/src/params/ImageListColourTechnique.xml
+++ b/src/params/ImageListColourTechnique.xml
@@ -1,5 +1,15 @@
<magics>
<class implements="ColourTableDefinitionListInterface" xmltag="list" name="ImageListColourTechnique" directory="visualisers" prefix="image" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="values" to="stringarray" default="stringarray()" from="stringarray" name="image_colour_table">
<documentation> List of colours to be used in image plotting. </documentation>
<release>Magics++0.8 </release>
diff --git a/src/params/ImagePlotting.xml b/src/params/ImagePlotting.xml
index 5dea344..66ed113 100644
--- a/src/params/ImagePlotting.xml
+++ b/src/params/ImagePlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pimage" directory="visualisers" prefix="image" xmltag="image" name="ImagePlotting">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Here comes the documentation of the ImagePlotting object </documentation>
<parameter member="mode" to="LookupTableMode" default="equidistant" from="string" name="image_colour_table_creation_mode">
diff --git a/src/params/ImportAction.xml b/src/params/ImportAction.xml
index abfaa1c..b9e2d14 100644
--- a/src/params/ImportAction.xml
+++ b/src/params/ImportAction.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pimport" directory="decoders" prefix="import" xmltag="import" name="ImportAction">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Import facilities allow users to import external graphics files (jpeg/gif/eps) </documentation>
<parameter member="path" to="string" default="" from="string" name="import_file_name">
diff --git a/src/params/ImportObjectHandler.xml b/src/params/ImportObjectHandler.xml
index 3ce1940..c960e9b 100644
--- a/src/params/ImportObjectHandler.xml
+++ b/src/params/ImportObjectHandler.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pimport" directory="basic" xmltag="import" name="ImportObjectHandler">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="import_file_name">
<documentation>File to import </documentation>
</parameter>
diff --git a/src/params/ImportPlot.xml b/src/params/ImportPlot.xml
index a7a5018..36c2234 100644
--- a/src/params/ImportPlot.xml
+++ b/src/params/ImportPlot.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="pplot" directory="visualisers" name="ImportPlot">
diff --git a/src/params/InputData.xml b/src/params/InputData.xml
index f5079f6..709a31a 100644
--- a/src/params/InputData.xml
+++ b/src/params/InputData.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="decoders" xmltag="input" name="InputData">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Input data for curve </documentation>
diff --git a/src/params/InputMatrix.xml b/src/params/InputMatrix.xml
index 9e5b2b0..129d1d3 100644
--- a/src/params/InputMatrix.xml
+++ b/src/params/InputMatrix.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="decoders" prefix="input" xmltag="matrix" name="InputMatrix">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This object contains this attributes to set how to interpret data stored in 2-dimensional arrays in memory.
</documentation>
diff --git a/src/params/InputMatrixIrregularInterpretor.xml b/src/params/InputMatrixIrregularInterpretor.xml
index 75c5591..4aaca0a 100644
--- a/src/params/InputMatrixIrregularInterpretor.xml
+++ b/src/params/InputMatrixIrregularInterpretor.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="decoders" name="InputMatrixIrregularInterpretor">
diff --git a/src/params/InputMatrixRegularInterpretor.xml b/src/params/InputMatrixRegularInterpretor.xml
index 283801d..12e7b22 100644
--- a/src/params/InputMatrixRegularInterpretor.xml
+++ b/src/params/InputMatrixRegularInterpretor.xml
@@ -2,6 +2,16 @@
<class directory="decoders" name="InputMatrixRegularInterpretor">
<parameter xml="origin_latitude" from="float" name="input_field_initial_latitude" default="90" member="latitude" to="float">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> used in a geographical projection context: Latitude of the point (1,1) in the input array </documentation>
</parameter>
diff --git a/src/params/IntervalSelectionType.xml b/src/params/IntervalSelectionType.xml
index 0df51c1..f15ed7c 100644
--- a/src/params/IntervalSelectionType.xml
+++ b/src/params/IntervalSelectionType.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="LevelSelection" xmltag="interval" name="IntervalSelectionType" directory="visualisers" prefix="contour/contour/contour" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
If the parameter CONTOUR_LEVEL_SELECTION_TYPE is set to 'INTERVAL' ,
MAGICS will plot contours at regularly spaced intervals
diff --git a/src/params/IsoHighlight.xml b/src/params/IsoHighlight.xml
index 30edec2..81b9b2d 100644
--- a/src/params/IsoHighlight.xml
+++ b/src/params/IsoHighlight.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NoIsoHighlight" xmltag="highlight" name="IsoHighlight" directory="visualisers" prefix="contour/contour/contour_highlight" action="pcont" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> This object is responsible of plotting the hightlight isolines </documentation>
<parameter xml="style" priority="0.2" from="string" name="contour_highlight_style" default="solid" member="style" to="LineStyle">
<documentation> Style of highlighting (SOLID/ DASH/ DOT/ CHAIN_DASH/ CHAIN_DOT) </documentation>
diff --git a/src/params/IsoLabel.xml b/src/params/IsoLabel.xml
index 729305a..5f67f2c 100644
--- a/src/params/IsoLabel.xml
+++ b/src/params/IsoLabel.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NoIsoLabel" xmltag="label" name="IsoLabel" directory="visualisers" prefix="contour/contour/contour_label" action="pcont" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The action routine PCONT will plot labels on contour lines either by default
or as directed by the user.
diff --git a/src/params/IsoPlot.xml b/src/params/IsoPlot.xml
index b204761..3db2a35 100644
--- a/src/params/IsoPlot.xml
+++ b/src/params/IsoPlot.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="isoline" name="IsoPlot" used_by="Contour" directory="visualisers" prefix="contour/contour_line" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> This object contains all the attributes of the isolines </documentation>
diff --git a/src/params/IsoShading.xml b/src/params/IsoShading.xml
index 086c64a..413399e 100644
--- a/src/params/IsoShading.xml
+++ b/src/params/IsoShading.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NoIsoShading" xmltag="shading" name="IsoShading" directory="visualisers" prefix="contour/contour/contour_shade/contour_shade/contour_shade" action="pcont" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="technique" to="ShadingTechnique" default="polygon_shading" from="string" name="contour_shade_technique">
<documentation> Technique used for shading (POLYGON_SHADING/ CELL_SHADING/ MARKER) </documentation>
diff --git a/src/params/KMLDriver.xml b/src/params/KMLDriver.xml
index ff31bf5..9953398 100644
--- a/src/params/KMLDriver.xml
+++ b/src/params/KMLDriver.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="BaseDriver" xmltag="kml" name="KMLDriver" directory="drivers" prefix="kml" action="KML">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation for_docs="no">
This output driver produces output in the KML (Keyhole XML) format. This is the input format for
Google Earth (http://earth.google.com) and Google Maps (http://maps.google.com).
diff --git a/src/params/LabelPlotting.xml b/src/params/LabelPlotting.xml
index a52fdd7..0ac2048 100644
--- a/src/params/LabelPlotting.xml
+++ b/src/params/LabelPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NoLabelPlotting" xmltag="label" name="LabelPlotting" directory="visualisers" prefix="map/map_label" action="pcoast" doc_inherits="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This object will control the settings of the Map Labels.
</documentation>
diff --git a/src/params/LandgramBox.xml b/src/params/LandgramBox.xml
index 7b59185..c4b3a41 100644
--- a/src/params/LandgramBox.xml
+++ b/src/params/LandgramBox.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" prefix="landbox" xmltag="landgrambox" name="LandgramBox">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> LandBox visualisation </documentation>
<parameter member="width" to="float" default="6" from="float" name="landgram_width">
<documentation> Colour of the box </documentation>
diff --git a/src/params/LandgramDecoder.xml b/src/params/LandgramDecoder.xml
index 3a860aa..7b62ac6 100644
--- a/src/params/LandgramDecoder.xml
+++ b/src/params/LandgramDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="decoders" prefix="landgram" xmltag="landgram" name="LandgramDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Landgram aplication </documentation>
<parameter member="path" to="string" default="" from="string" name="landgram_input_file_name">
diff --git a/src/params/LegendMethod.xml b/src/params/LegendMethod.xml
index f1d8922..93bb33d 100644
--- a/src/params/LegendMethod.xml
+++ b/src/params/LegendMethod.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="legend" directory="visualisers" used_by="Legend" include="LegendMethod.h" name="LegendMethod"/></magics>
diff --git a/src/params/LegendVisitor.xml b/src/params/LegendVisitor.xml
index e5ac687..4787651 100644
--- a/src/params/LegendVisitor.xml
+++ b/src/params/LegendVisitor.xml
@@ -1,5 +1,15 @@
<magics>
<class action="legend" directory="basic" prefix="legend" xmltag="legend" name="LegendVisitor">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Collection of parameters defining how a legend will be plotted. To plot a legend the parameter 'Legend'
needs to set to 'on'.
diff --git a/src/params/LevelListSelectionType.xml b/src/params/LevelListSelectionType.xml
index ce434a3..78fc57c 100644
--- a/src/params/LevelListSelectionType.xml
+++ b/src/params/LevelListSelectionType.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="LevelSelection" xmltag="list" name="LevelListSelectionType" directory="visualisers" prefix="contour" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>Users may supply a list of the contour levels to be plotted
by setting the parameter CONTOUR_LEVEL_SELECTION_TYPE to 'LEVEL_LIST'
and passing an array of contour level values.
diff --git a/src/params/LevelSelection.xml b/src/params/LevelSelection.xml
index 401c7b6..a506201 100644
--- a/src/params/LevelSelection.xml
+++ b/src/params/LevelSelection.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pcont" directory="visualisers" prefix="contour" name="LevelSelection" xml_tag="level">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> </documentation>
<parameter from="float" name="contour_max_level" default="1.0e+21" member="max" to="float" inherit_parent_reqs="no">
diff --git a/src/params/ListColourTechnique.xml b/src/params/ListColourTechnique.xml
index ad4584c..94228db 100644
--- a/src/params/ListColourTechnique.xml
+++ b/src/params/ListColourTechnique.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="ColourTechnique" implements="ColourTableDefinitionListInterface" xmltag="list" name="ListColourTechnique" directory="visualisers" prefix="contour/contour/contour_shade/contour_shade/contour_shade" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter from="stringarray" name="contour_shade_colour_list" default="stringarray()" member="values" to="stringarray" colourlist="on">
<documentation> List of colours to be used in contour shading. </documentation>
diff --git a/src/params/ListHeightTechnique.xml b/src/params/ListHeightTechnique.xml
index 02f2394b..5796012 100644
--- a/src/params/ListHeightTechnique.xml
+++ b/src/params/ListHeightTechnique.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" inherits="HeightTechnique" include="HeightTechnique.h" name="ListHeightTechnique"/></magics>
diff --git a/src/params/LogarithmicAxisMethod.xml b/src/params/LogarithmicAxisMethod.xml
index ba2e4b9..7493248 100644
--- a/src/params/LogarithmicAxisMethod.xml
+++ b/src/params/LogarithmicAxisMethod.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" inherits="AxisMethod" include="AxisMethod.h" name="LogarithmicAxisMethod"/></magics>
diff --git a/src/params/LogoPlotting.xml b/src/params/LogoPlotting.xml
index b31f502..85164f7 100644
--- a/src/params/LogoPlotting.xml
+++ b/src/params/LogoPlotting.xml
@@ -1,2 +1,12 @@
<magics>
<class inherits="NoLogoPlotting" include="LogoPlotting.h" directory="common" xmltag="logo" name="LogoPlotting"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/LookupTableMode.xml b/src/params/LookupTableMode.xml
index 676b899..0e09326 100644
--- a/src/params/LookupTableMode.xml
+++ b/src/params/LookupTableMode.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" prefix="image" name="LookupTableMode">
diff --git a/src/params/LowHiLo.xml b/src/params/LowHiLo.xml
index 443fa12..53a3f5e 100644
--- a/src/params/LowHiLo.xml
+++ b/src/params/LowHiLo.xml
@@ -1,2 +1,12 @@
<magics>
<class inherits="HiLo" xmltag="low" name="LowHiLo" directory="visualisers" action="pcont" include="HiLo.h"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/MagnifierVisitor.xml b/src/params/MagnifierVisitor.xml
index 7978844..b35a9e6 100644
--- a/src/params/MagnifierVisitor.xml
+++ b/src/params/MagnifierVisitor.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="basic" inherits="NoMagnifierVisitor" name="MagnifierVisitor">
<parameter member="symbol_name" to="string" default="magics_3" from="string" name="magnifier_symbol_name">
diff --git a/src/params/MapGenDecoder.xml b/src/params/MapGenDecoder.xml
index 9bbba3b..547076c 100644
--- a/src/params/MapGenDecoder.xml
+++ b/src/params/MapGenDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class perfix="mapgen" action="pmapgen" directory="decoders" xmltag="mapgen" name="MapGenDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="mapgen_input_file_name">
<release>Magics++2.1 </release>
<documentation> The name of the input file containing the MapGen data </documentation>
diff --git a/src/params/MarkerShadingTechnique.xml b/src/params/MarkerShadingTechnique.xml
index 9cf9faf..4fffabc 100644
--- a/src/params/MarkerShadingTechnique.xml
+++ b/src/params/MarkerShadingTechnique.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="ShadingTechnique" xmltag="marker" name="MarkerShadingTechnique" directory="visualisers" prefix="contour/contour/contour_shade/contour_shade/contour_shade" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="colour" to="stringarray" default="stringarray()" from="stringarray" name="contour_shade_colour_table">
<documentation> Colour table to be used with MARKER shading technique </documentation>
diff --git a/src/params/MarkerValuePlotMethod.xml b/src/params/MarkerValuePlotMethod.xml
index 604bc0a..39d2d76 100644
--- a/src/params/MarkerValuePlotMethod.xml
+++ b/src/params/MarkerValuePlotMethod.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="ValuePlotMethod" xmltag="marker" name="MarkerValuePlotMethod" directory="visualisers" prefix="contour/contour_grid_value/contour_grid_value" action="pcont" doc_inherits="no" inherit_parent_reqs="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="markerHeight" to="float" default="0.25" from="float" name="contour_grid_value_marker_height">
<documentation> Height of grid point markers </documentation>
diff --git a/src/params/MercatorProjection.xml b/src/params/MercatorProjection.xml
index f70bbb0..a60c865 100644
--- a/src/params/MercatorProjection.xml
+++ b/src/params/MercatorProjection.xml
@@ -1,2 +1,12 @@
<magics>
<class inherits="GeoRectangularProjection" xmltag="rectangular" name="MercatorProjection" directory="common" prefix="subpage" action="projection" include="GeoRectangularProjection.h"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/MetaData.xml b/src/params/MetaData.xml
index de1ece0..c6dc71c 100644
--- a/src/params/MetaData.xml
+++ b/src/params/MetaData.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="common" prefix="metadata" xmltag="meta" name="MetaData">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> </documentation>
<parameter xml="path" from="string" name="metadata_path" default="meta.xml" member="path" to="string">
diff --git a/src/params/MetgramBar.xml b/src/params/MetgramBar.xml
index e63afa2..8c0f375 100644
--- a/src/params/MetgramBar.xml
+++ b/src/params/MetgramBar.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="visualisers" prefix="metgram" xmltag="metgraph" name="MetgramBar">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The metgram curve will plot the metgram a s a curve!
</documentation>
diff --git a/src/params/MetgramCurve.xml b/src/params/MetgramCurve.xml
index 66dfb9f..2746388 100644
--- a/src/params/MetgramCurve.xml
+++ b/src/params/MetgramCurve.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="visualisers" prefix="metgram" xmltag="metgraph" name="MetgramCurve">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The metgram curve will plot the metgram a s a curve!
</documentation>
diff --git a/src/params/MetgramFlags.xml b/src/params/MetgramFlags.xml
index 20c65b5..b33b047 100644
--- a/src/params/MetgramFlags.xml
+++ b/src/params/MetgramFlags.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="visualisers" prefix="metgram" xmltag="metflags" name="MetgramFlags">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The metgram curve will plot the metgram a s a curve!
</documentation>
diff --git a/src/params/MetgramGraph.xml b/src/params/MetgramGraph.xml
index 2374345..467b9a9 100644
--- a/src/params/MetgramGraph.xml
+++ b/src/params/MetgramGraph.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pmetgram" directory="visualisers" prefix="metgram" xmltag="metgraph" name="MetgramGraph">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
The Epsgram is responsible for accessing the espgram database its data to MAGICS.
</documentation>
diff --git a/src/params/MingDriver.xml b/src/params/MingDriver.xml
index b1a7e66..33f3a64 100644
--- a/src/params/MingDriver.xml
+++ b/src/params/MingDriver.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="Ming" directory="drivers" inherits="BaseDriver" name="MingDriver">
<documentation>
diff --git a/src/params/MvRootSceneNode.xml b/src/params/MvRootSceneNode.xml
index 05e3a8a..21b9b90 100644
--- a/src/params/MvRootSceneNode.xml
+++ b/src/params/MvRootSceneNode.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="super_page" name="MvRootSceneNode" directory="common" prefix="super_page" action="pnew" include="RootSceneNode.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="width" to="float" default="29.7" from="float" name="super_page_x_length">
<release>Magics++0.1 </release>
diff --git a/src/params/NetcdfDecoder.xml b/src/params/NetcdfDecoder.xml
index 51e8296..548b463 100644
--- a/src/params/NetcdfDecoder.xml
+++ b/src/params/NetcdfDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pnetcdf" directory="decoders" prefix="netcdf" xmltag="netcdf" name="NetcdfDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This handles the decoding of NetCDF Files.
</documentation>
diff --git a/src/params/NetcdfGeoMatrixInterpretor.xml b/src/params/NetcdfGeoMatrixInterpretor.xml
index a419cff..8054666 100644
--- a/src/params/NetcdfGeoMatrixInterpretor.xml
+++ b/src/params/NetcdfGeoMatrixInterpretor.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NetcdfInterpretor" xmltag="geopoints" name="NetcdfGeoMatrixInterpretor" directory="decoders" prefix="netcdf" action="pnetcdf">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="latitude" to="string" default="latitude" from="string" name="netcdf_latitude_variable">
<release>Magics++0.1 </release>
<documentation>Variable name representing the latitude dimension </documentation>
diff --git a/src/params/NetcdfGeoPolarMatrixInterpretor.xml b/src/params/NetcdfGeoPolarMatrixInterpretor.xml
index 23401a4..4e0ff57 100644
--- a/src/params/NetcdfGeoPolarMatrixInterpretor.xml
+++ b/src/params/NetcdfGeoPolarMatrixInterpretor.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NetcdfInterpretor" xmltag="netcdf" name="NetcdfGeoPolarMatrixInterpretor" directory="decoders" prefix="netcdf" action="pnetcdf" include="NetcdfVectorInterpretor.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="speed" to="string" default="" from="string" name="netcdf_speed_component_variable">
<release>Magics++2.6 </release>
<documentation>Variable name representing the speed component of the vector </documentation>
diff --git a/src/params/NetcdfGeoVectorInterpretor.xml b/src/params/NetcdfGeoVectorInterpretor.xml
index 830bf5e..11b8368 100644
--- a/src/params/NetcdfGeoVectorInterpretor.xml
+++ b/src/params/NetcdfGeoVectorInterpretor.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NetcdfInterpretor" xmltag="geopoints" name="NetcdfGeoVectorInterpretor" directory="decoders" prefix="netcdf" action="pnetcdf" include="NetcdfVectorInterpretor.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="x_component" to="string" default="" from="string" name="netcdf_x_component_variable">
<release>Magics++2.6 </release>
<documentation>Variable name representing the x component of the vector </documentation>
diff --git a/src/params/NetcdfGeopointsInterpretor.xml b/src/params/NetcdfGeopointsInterpretor.xml
index 6961a8d..0715c93 100644
--- a/src/params/NetcdfGeopointsInterpretor.xml
+++ b/src/params/NetcdfGeopointsInterpretor.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NetcdfInterpretor" xmltag="geopoints" name="NetcdfGeopointsInterpretor" directory="decoders" prefix="netcdf" action="pnetcdf">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="latitude" to="string" default="latitude" from="string" name="netcdf_latitude_variable">
<documentation>Variable name representing the x dimension </documentation>
diff --git a/src/params/NetcdfInterpretor.xml b/src/params/NetcdfInterpretor.xml
index aea77be..5fb21e2 100644
--- a/src/params/NetcdfInterpretor.xml
+++ b/src/params/NetcdfInterpretor.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pnetcdf" directory="decoders" prefix="netcdf" xmltag="netcdf" name="NetcdfInterpretor">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This object contains this attributes to set how to load the data from the file.
It is possible to load only a subarray of the data, by setting the dimensions.
diff --git a/src/params/NetcdfMatrixInterpretor.xml b/src/params/NetcdfMatrixInterpretor.xml
index 4443dec..0bfbccd 100644
--- a/src/params/NetcdfMatrixInterpretor.xml
+++ b/src/params/NetcdfMatrixInterpretor.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NetcdfInterpretor" xmltag="geopoints" name="NetcdfMatrixInterpretor" directory="decoders" prefix="netcdf" action="pnetcdf">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="y" to="string" default="y" from="string" name="netcdf_y_variable">
<release>Magics++0.1 </release>
diff --git a/src/params/NetcdfOrcaInterpretor.xml b/src/params/NetcdfOrcaInterpretor.xml
index 4732e11..f64628b 100644
--- a/src/params/NetcdfOrcaInterpretor.xml
+++ b/src/params/NetcdfOrcaInterpretor.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NetcdfInterpretor" xmltag="geopoints" name="NetcdfOrcaInterpretor" directory="decoders" prefix="netcdf" action="pnetcdf">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="latitude" to="string" default="latitude" from="string" name="netcdf_latitude_variable">
<release>Magics++0.1 </release>
<documentation>Variable name representing the latitude dimension </documentation>
diff --git a/src/params/NetcdfVectorInterpretor.xml b/src/params/NetcdfVectorInterpretor.xml
index 9d56a49..dd34de1 100644
--- a/src/params/NetcdfVectorInterpretor.xml
+++ b/src/params/NetcdfVectorInterpretor.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NetcdfInterpretor" xmltag="geopoints" name="NetcdfVectorInterpretor" directory="decoders" prefix="netcdf" action="pnetcdf">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="x_component" to="string" default="" from="string" name="netcdf_x_component_variable">
<release>Magics++2.6 </release>
<documentation>Variable name representing the x component of the vector </documentation>
diff --git a/src/params/NetcdfXYpointsInterpretor.xml b/src/params/NetcdfXYpointsInterpretor.xml
index deda93a..afe96da 100644
--- a/src/params/NetcdfXYpointsInterpretor.xml
+++ b/src/params/NetcdfXYpointsInterpretor.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NetcdfInterpretor" xmltag="xypoints" name="NetcdfXYpointsInterpretor" directory="decoders" prefix="netcdf" action="pnetcdf" include="NetcdfGeopointsInterpretor.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="x" to="string" default="x" from="string" name="netcdf_x_variable">
<release>Magics++0.1 </release>
<documentation>Variable name for the x values </documentation>
diff --git a/src/params/NoBinningObject.xml b/src/params/NoBinningObject.xml
index 901bb03..c838225 100644
--- a/src/params/NoBinningObject.xml
+++ b/src/params/NoBinningObject.xml
@@ -1,2 +1,12 @@
<magics>
<class inherits="BinningObject" xmltag="binning" name="NoBinningObject" directory="decoders" prefix="binning" action="pbinning" include="BinningObject.h" doc_inherits="no"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/NoBoundaries.xml b/src/params/NoBoundaries.xml
index ebe65ab..a80a750 100644
--- a/src/params/NoBoundaries.xml
+++ b/src/params/NoBoundaries.xml
@@ -1,4 +1,14 @@
<magics>
<class action="pcoast" directory="visualisers" xmltag="noboundaries" include="Boundaries.h" name="NoBoundaries">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>This object suppresses the political boundaries </documentation>
</class></magics>
diff --git a/src/params/NoBoxPlotBoxBorder.xml b/src/params/NoBoxPlotBoxBorder.xml
index 7a0be85..04f92b6 100644
--- a/src/params/NoBoxPlotBoxBorder.xml
+++ b/src/params/NoBoxPlotBoxBorder.xml
@@ -1,4 +1,14 @@
<magics>
<class directory="visualisers" prefix="boxplot/boxplot_median" xmltag="median" name="NoBoxPlotBoxBorder" include='BoxPlotItem.h'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
</class>
</magics>
diff --git a/src/params/NoBoxPlotMedian.xml b/src/params/NoBoxPlotMedian.xml
index 89a61b2..74f2058 100644
--- a/src/params/NoBoxPlotMedian.xml
+++ b/src/params/NoBoxPlotMedian.xml
@@ -1,4 +1,14 @@
<magics>
<class directory="visualisers" prefix="boxplot/boxplot_median" xmltag="median" name="NoBoxPlotMedian" include='BoxPlotItem.h'>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
</class>
</magics>
diff --git a/src/params/NoCalmIndicator.xml b/src/params/NoCalmIndicator.xml
index 43749d5..f988774 100644
--- a/src/params/NoCalmIndicator.xml
+++ b/src/params/NoCalmIndicator.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="CalmIndicator" directory="visualisers" include="CalmIndicator.h" name="NoCalmIndicator"/></magics>
diff --git a/src/params/NoCities.xml b/src/params/NoCities.xml
index aa325ec..a490318 100644
--- a/src/params/NoCities.xml
+++ b/src/params/NoCities.xml
@@ -1,4 +1,14 @@
<magics>
<class action="pcoast" directory="visualisers" xmltag="noboundaries" include="Cities.h" name="NoCities">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>This object suppresses the plotting of cities. </documentation>
</class></magics>
diff --git a/src/params/NoCoastPlotting.xml b/src/params/NoCoastPlotting.xml
index 5be93c3..14064bd 100644
--- a/src/params/NoCoastPlotting.xml
+++ b/src/params/NoCoastPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="coast" name="NoCoastPlotting" used_by="Coastlines" directory="visualisers" prefix="map/map_coastline" action="pcoast" include="CoastPlotting.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Coastlines may be turned off by setting the parameter MAP_COASTLINE to 'OFF' ,
the default being 'ON' .
diff --git a/src/params/NoGraphShade.xml b/src/params/NoGraphShade.xml
index db3fa1d..0fa78ed 100644
--- a/src/params/NoGraphShade.xml
+++ b/src/params/NoGraphShade.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" inherits="GraphShade" include="GraphShade.h" name="NoGraphShade"/></magics>
diff --git a/src/params/NoGridPlotting.xml b/src/params/NoGridPlotting.xml
index 79806d9..e4a6705 100644
--- a/src/params/NoGridPlotting.xml
+++ b/src/params/NoGridPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pcoast" directory="visualisers" xmltag="nogrid" include="GridPlotting.h" name="NoGridPlotting">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This object suppresses the plotting of the map grid.
</documentation>
diff --git a/src/params/NoHiLo.xml b/src/params/NoHiLo.xml
index 49c51f9..a228c36 100644
--- a/src/params/NoHiLo.xml
+++ b/src/params/NoHiLo.xml
@@ -1,4 +1,14 @@
<magics>
<class inherits="HiLoBase" xmltag="nohilo" name="NoHiLo" directory="visualisers" action="pcont" include="HiLo.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>This object suppresses Hi/Lo information. </documentation>
</class></magics>
diff --git a/src/params/NoHiLoMarker.xml b/src/params/NoHiLoMarker.xml
index 71cf709..dbdce91 100644
--- a/src/params/NoHiLoMarker.xml
+++ b/src/params/NoHiLoMarker.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="HiLoMarkerBase" xmltag="nomarker" name="NoHiLoMarker" directory="visualisers" action="pcont" include="HiLoMarker.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This object suppresses the plotting of Hi/Lo markers
</documentation>
diff --git a/src/params/NoIsoHighlight.xml b/src/params/NoIsoHighlight.xml
index ea36f30..505295f 100644
--- a/src/params/NoIsoHighlight.xml
+++ b/src/params/NoIsoHighlight.xml
@@ -1,2 +1,12 @@
<magics>
<class xmltag="nohighlight" name="NoIsoHighlight" directory="visualisers" action="pcont" include="IsoHighlight.h" doc_inherits="no"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/NoIsoLabel.xml b/src/params/NoIsoLabel.xml
index 6e62f4e..79ae8c2 100644
--- a/src/params/NoIsoLabel.xml
+++ b/src/params/NoIsoLabel.xml
@@ -1,2 +1,12 @@
<magics>
<class xmltag="nolabel" name="NoIsoLabel" used_by="IsoPlot" directory="visualisers" action="pcont" include="IsoLabel.h" doc_inherits="no"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/NoIsoPlot.xml b/src/params/NoIsoPlot.xml
index 094faa3..e3dac12 100644
--- a/src/params/NoIsoPlot.xml
+++ b/src/params/NoIsoPlot.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="IsoPlot" directory="visualisers" include="IsoPlot.h" name="NoIsoPlot" doc_inherits="no"/></magics>
diff --git a/src/params/NoIsoShading.xml b/src/params/NoIsoShading.xml
index 07f7a00..1587b19 100644
--- a/src/params/NoIsoShading.xml
+++ b/src/params/NoIsoShading.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="pcont" directory="visualisers" include="IsoShading.h" name="NoIsoShading" doc_inherits="no"/></magics>
diff --git a/src/params/NoLabelPlotting.xml b/src/params/NoLabelPlotting.xml
index 1d56131..250d857 100644
--- a/src/params/NoLabelPlotting.xml
+++ b/src/params/NoLabelPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pcoast" directory="visualisers" xmltag="nolabel" include="LabelPlotting.h" name="NoLabelPlotting">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This object suppresses the plotting of the map grid labels
</documentation>
diff --git a/src/params/NoLegendNode.xml b/src/params/NoLegendNode.xml
index 163bbf1..b996ccd 100644
--- a/src/params/NoLegendNode.xml
+++ b/src/params/NoLegendNode.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" include="LegendNode.h" name="NoLegendNode"/></magics>
diff --git a/src/params/NoLegendVisitor.xml b/src/params/NoLegendVisitor.xml
index 6c36321..7855626 100644
--- a/src/params/NoLegendVisitor.xml
+++ b/src/params/NoLegendVisitor.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="basic" include="LegendVisitor.h" name="NoLegendVisitor"/></magics>
diff --git a/src/params/NoLogoPloting.xml b/src/params/NoLogoPloting.xml
index 488ed2d..4ca11f4 100644
--- a/src/params/NoLogoPloting.xml
+++ b/src/params/NoLogoPloting.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class include="LogoPlotting.h" name="NoLogoPlotting"/>
</magics>
diff --git a/src/params/NoLogoPlotting.xml b/src/params/NoLogoPlotting.xml
index 488ed2d..4ca11f4 100644
--- a/src/params/NoLogoPlotting.xml
+++ b/src/params/NoLogoPlotting.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class include="LogoPlotting.h" name="NoLogoPlotting"/>
</magics>
diff --git a/src/params/NoMagnifierVisitor.xml b/src/params/NoMagnifierVisitor.xml
index 2ba7042..8613519 100644
--- a/src/params/NoMagnifierVisitor.xml
+++ b/src/params/NoMagnifierVisitor.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="basic" include="MagnifierVisitor.h" name="NoMagnifierVisitor"/></magics>
diff --git a/src/params/NoOriginMarker.xml b/src/params/NoOriginMarker.xml
index 54ce571..a244e44 100644
--- a/src/params/NoOriginMarker.xml
+++ b/src/params/NoOriginMarker.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="OriginMarker" directory="visualisers" include="OriginMarker.h" name="NoOriginMarker"/></magics>
diff --git a/src/params/NoOutLayerTechnique.xml b/src/params/NoOutLayerTechnique.xml
index d97bdcc..e5aff74 100644
--- a/src/params/NoOutLayerTechnique.xml
+++ b/src/params/NoOutLayerTechnique.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" include="OutLayerTechnique.h" name="NoOutLayerTechnique"/></magics>
diff --git a/src/params/NoPageID.xml b/src/params/NoPageID.xml
index 24a3958..e6269ae 100644
--- a/src/params/NoPageID.xml
+++ b/src/params/NoPageID.xml
@@ -1,4 +1,14 @@
<magics>
<class directory="common" include="PageID.h" xmltag="nopageid" name="NoPageID">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>This object suppresses the plotting the page ID </documentation>
</class></magics>
diff --git a/src/params/NoPreviewVisitor.xml b/src/params/NoPreviewVisitor.xml
index 0cc0021..d66d225 100644
--- a/src/params/NoPreviewVisitor.xml
+++ b/src/params/NoPreviewVisitor.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="basic" include="PreviewVisitor.h" name="NoPreviewVisitor"/></magics>
diff --git a/src/params/NoTitle.xml b/src/params/NoTitle.xml
index f9acd2a..c763aab 100644
--- a/src/params/NoTitle.xml
+++ b/src/params/NoTitle.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="TitleBase" directory="visualisers" include="Title.h" name="NoTitle"/></magics>
diff --git a/src/params/NoValuePlot.xml b/src/params/NoValuePlot.xml
index 6f17c11..59d88a4 100644
--- a/src/params/NoValuePlot.xml
+++ b/src/params/NoValuePlot.xml
@@ -1,4 +1,14 @@
<magics>
<class inherits="ValuePlotBase" xmltag="nogridvalues" name="NoValuePlot" directory="visualisers" action="pcont" include="ValuePlot.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>This object suppresses the plotting of grid values. </documentation>
</class></magics>
diff --git a/src/params/ObsCloud.xml b/src/params/ObsCloud.xml
index 0818c27..879d3a1 100644
--- a/src/params/ObsCloud.xml
+++ b/src/params/ObsCloud.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" action_routine="pobs" prefix="obs" xmltag="cloud" name="ObsCloud">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
</parameter>
diff --git a/src/params/ObsDecoder.xml b/src/params/ObsDecoder.xml
index 10a151b..e6b6c64 100644
--- a/src/params/ObsDecoder.xml
+++ b/src/params/ObsDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="decoders" action_routine="pobs" prefix="obs" xmltag="bufr" name="ObsDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="file_name" to="string" default="" from="string" name="obs_input_file_name">
<documentation> The name of the input file containing the BUFR code field(s) </documentation>
diff --git a/src/params/ObsDemoItem2.xml b/src/params/ObsDemoItem2.xml
index fa60d6c..6dfd75b 100644
--- a/src/params/ObsDemoItem2.xml
+++ b/src/params/ObsDemoItem2.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" action_routine="pobs" prefix="obs" xmltag="demo2" name="ObsDemoItem2">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="text" to="string" default="///" from="string" name="obs_demo2_missing_text">
<documentation> text to be displayed in case of missinmg data </documentation>
</parameter>
diff --git a/src/params/ObsDewPoint.xml b/src/params/ObsDewPoint.xml
index 73b6acc..27c501c 100644
--- a/src/params/ObsDewPoint.xml
+++ b/src/params/ObsDewPoint.xml
@@ -1,4 +1,14 @@
<magics>
<class directory="visualisers" action_routine="pobs" prefix="obs" xmltag="dewpoint" name="ObsDewPoint">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
</class></magics>
diff --git a/src/params/ObsJSon.xml b/src/params/ObsJSon.xml
index 3484874..79f7987 100644
--- a/src/params/ObsJSon.xml
+++ b/src/params/ObsJSon.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="obsjson" name="ObsJSon" directory="web" prefix="obsjson" action="pobsjson" include="ObsJSon.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="obsjson_input_filename">
<documentation> Path to the file containing the Observation data </documentation>
</parameter>
diff --git a/src/params/ObsPlotting.xml b/src/params/ObsPlotting.xml
index fb6cea4..00ac5ac 100644
--- a/src/params/ObsPlotting.xml
+++ b/src/params/ObsPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" action_routine="pobs" prefix="obs" xmltag="obs" name="ObsPlotting">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter xml="distance_apart" from="float" name="obs_distance_apart" default="1.0" member="apart" to="float">
<documentation>Minimum distance between the centre of any two observations in cm </documentation>
diff --git a/src/params/ObsStatDecoder.xml b/src/params/ObsStatDecoder.xml
index cc9e76f..50c5bb5 100644
--- a/src/params/ObsStatDecoder.xml
+++ b/src/params/ObsStatDecoder.xml
@@ -4,6 +4,16 @@
The Obstat decoder is responsible for decoding Obstat Ascii file.
</documentation>
<parameter xml="path" from="string" name="obsstat_filename" default="" member="path" to="string">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Epsgram Database Path </documentation>
<migration> New Magics: Parameter eps_database sent to new Magics[EpsgramDecoder]. </migration>
diff --git a/src/params/ObsTable.xml b/src/params/ObsTable.xml
index a17fbb0..eec86d6 100644
--- a/src/params/ObsTable.xml
+++ b/src/params/ObsTable.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" action_routine="pobs" prefix="obs" xmltag="obs" name="ObsTable">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="obs_template_file_name">
<release>Magics++ 2.10 </release>
diff --git a/src/params/OdaGeoDecoder.xml b/src/params/OdaGeoDecoder.xml
index 04bcd23..2a8300e 100644
--- a/src/params/OdaGeoDecoder.xml
+++ b/src/params/OdaGeoDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="odb" name="OdaGeoDecoder" directory="oda" prefix="odb" action="podb" include="OdaDecoder.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
New odb Access (Prototype Status)
</documentation>
diff --git a/src/params/OdaXYDecoder.xml b/src/params/OdaXYDecoder.xml
index 2b1f8c1..55a3ccd 100644
--- a/src/params/OdaXYDecoder.xml
+++ b/src/params/OdaXYDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="odb" name="OdaXYDecoder" directory="oda" prefix="odb" action="podb" include="OdaDecoder.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
New odb Access (Prototype Status)
</documentation>
diff --git a/src/params/OdbDecoder.xml b/src/params/OdbDecoder.xml
index 6e2da4c..630ab07 100644
--- a/src/params/OdbDecoder.xml
+++ b/src/params/OdbDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class action="podb" directory="odb" prefix="odb" xmltag="odb" name="OdbDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This is responsible for accessing the ODB and passing
its data to MAGICS.
diff --git a/src/params/OriginMarker.xml b/src/params/OriginMarker.xml
index 88d85ee..f35b470 100644
--- a/src/params/OriginMarker.xml
+++ b/src/params/OriginMarker.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" name="OriginMarker"/></magics>
diff --git a/src/params/OutputHandler.xml b/src/params/OutputHandler.xml
index 7b10e59..90fdb0c 100644
--- a/src/params/OutputHandler.xml
+++ b/src/params/OutputHandler.xml
@@ -1,5 +1,15 @@
<magics>
<class action="popen" directory="common" xmltag="output" name="OutputHandler">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter xml="format" from="string" name="output_format" default="ps" member="format" to="string">
<documentation>Defines the device to be used (ps/png/pdf/svg/kml).</documentation>
diff --git a/src/params/PageID.xml b/src/params/PageID.xml
index 598069b..06180a5 100644
--- a/src/params/PageID.xml
+++ b/src/params/PageID.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="common" inherits="NoPageID" prefix="page_id/page_id_line" xmltag="pageid" name="PageID">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="height" to="float" default="0.25" from="float" name="page_id_line_height">
<documentation> Height of identification line</documentation>
<release>2.0</release>
diff --git a/src/params/ParamGribLoopStep.xml b/src/params/ParamGribLoopStep.xml
index 0ddef19..d8c5dcd 100644
--- a/src/params/ParamGribLoopStep.xml
+++ b/src/params/ParamGribLoopStep.xml
@@ -1,4 +1,14 @@
<magics>
<class inherits="GribLoopStep" xmltag="looponparam" name="ParamGribLoopStep" directory="decoders" prefix="grib/grib_loop_step" action="pgrib" include="GribLoopStep.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> </documentation>
</class></magics>
diff --git a/src/params/PolarStereographicProjection.xml b/src/params/PolarStereographicProjection.xml
index a22ebf0..7ce0cc2 100644
--- a/src/params/PolarStereographicProjection.xml
+++ b/src/params/PolarStereographicProjection.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="Transformation" xmltag="polar_stereographic" name="PolarStereographicProjection" directory="common" prefix="subpage/subpage/subpage_map/subpage_map_area" action="projection">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
These are the attributes of the PolarStereographic projection.
</documentation>
diff --git a/src/params/PolyShadingMethod.xml b/src/params/PolyShadingMethod.xml
index 8a1b217..4ab917d 100644
--- a/src/params/PolyShadingMethod.xml
+++ b/src/params/PolyShadingMethod.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" include="PolyShadingMethod.h" name="PolyShadingMethod"/></magics>
diff --git a/src/params/PolyShadingTechnique.xml b/src/params/PolyShadingTechnique.xml
index 3a39137..ed232a6 100644
--- a/src/params/PolyShadingTechnique.xml
+++ b/src/params/PolyShadingTechnique.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="ShadingTechnique" xmltag="polygon" name="PolyShadingTechnique" directory="visualisers" prefix="contour/contour/contour_shade/contour_shade/contour_shade" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="method" to="PolyShadingMethod" default="dot" from="string" name="contour_shade_method">
<documentation> Method used for shading (DOT/ AREA_FILL/ HATCH) </documentation>
diff --git a/src/params/PositionListAxisMethod.xml b/src/params/PositionListAxisMethod.xml
index 29d82bf..f24150e 100644
--- a/src/params/PositionListAxisMethod.xml
+++ b/src/params/PositionListAxisMethod.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" inherits="AxisMethod" include="AxisMethod.h" name="PositionListAxisMethod"/></magics>
diff --git a/src/params/PostScriptDriver.xml b/src/params/PostScriptDriver.xml
index b31a24f..bd105fd 100644
--- a/src/params/PostScriptDriver.xml
+++ b/src/params/PostScriptDriver.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="BaseDriver" xmltag="ps" name="PostScriptDriver" directory="drivers" prefix="output_ps/output" action="PostScript">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation for_docs="no">
This is the default driver for Magics, and PostScript is the default output format.
</documentation>
diff --git a/src/params/PpmDecoder.xml b/src/params/PpmDecoder.xml
index 1b9c74f..8414635 100644
--- a/src/params/PpmDecoder.xml
+++ b/src/params/PpmDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="decoders" action_routine="pobs" prefix="ppm" xmltag="ppm" name="PpmDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="filename" to="string" default="" from="string" name="ppm_input_file_name">
<release>Expected in Magics++0.7 </release>
<documentation> The name of the input file containing the PPM image </documentation>
diff --git a/src/params/PreviewVisitor.xml b/src/params/PreviewVisitor.xml
index c7fe8f3..cbd21ec 100644
--- a/src/params/PreviewVisitor.xml
+++ b/src/params/PreviewVisitor.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="basic" inherits="NoPreviewVisitor" name="PreviewVisitor"/></magics>
diff --git a/src/params/Proj4Bonne.xml b/src/params/Proj4Bonne.xml
index 586ce0c..a21a374 100644
--- a/src/params/Proj4Bonne.xml
+++ b/src/params/Proj4Bonne.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Bonne"/></magics>
diff --git a/src/params/Proj4Collignon.xml b/src/params/Proj4Collignon.xml
index 03bdac4..2ab564e 100644
--- a/src/params/Proj4Collignon.xml
+++ b/src/params/Proj4Collignon.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Collignon"/></magics>
diff --git a/src/params/Proj4EPSG32661.xml b/src/params/Proj4EPSG32661.xml
index 2485c3e..cd5b2d7 100644
--- a/src/params/Proj4EPSG32661.xml
+++ b/src/params/Proj4EPSG32661.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4EPSG32661"/></magics>
diff --git a/src/params/Proj4EPSG3857.xml b/src/params/Proj4EPSG3857.xml
index fa302af..3dfeac5 100644
--- a/src/params/Proj4EPSG3857.xml
+++ b/src/params/Proj4EPSG3857.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4EPSG3857"/></magics>
diff --git a/src/params/Proj4EPSG4326.xml b/src/params/Proj4EPSG4326.xml
index 77fd9b9..3073947 100644
--- a/src/params/Proj4EPSG4326.xml
+++ b/src/params/Proj4EPSG4326.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4EPSG4326"/></magics>
diff --git a/src/params/Proj4Efas.xml b/src/params/Proj4Efas.xml
index 62b5a14..a7e5b8d 100644
--- a/src/params/Proj4Efas.xml
+++ b/src/params/Proj4Efas.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Efas"/></magics>
diff --git a/src/params/Proj4Geos.xml b/src/params/Proj4Geos.xml
index fa23aab..8780f5e 100644
--- a/src/params/Proj4Geos.xml
+++ b/src/params/Proj4Geos.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Geos"/></magics>
diff --git a/src/params/Proj4Geose.xml b/src/params/Proj4Geose.xml
index ed9eee8..aa22fdb 100644
--- a/src/params/Proj4Geose.xml
+++ b/src/params/Proj4Geose.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Geose"/></magics>
diff --git a/src/params/Proj4Geosw.xml b/src/params/Proj4Geosw.xml
index d6fc319..d64de3f 100644
--- a/src/params/Proj4Geosw.xml
+++ b/src/params/Proj4Geosw.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Geosw"/></magics>
diff --git a/src/params/Proj4Goode.xml b/src/params/Proj4Goode.xml
index ec4dda9..cc8ccd7 100644
--- a/src/params/Proj4Goode.xml
+++ b/src/params/Proj4Goode.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Goode"/></magics>
diff --git a/src/params/Proj4Google.xml b/src/params/Proj4Google.xml
index f23e228..77e9d29 100644
--- a/src/params/Proj4Google.xml
+++ b/src/params/Proj4Google.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Google"/></magics>
diff --git a/src/params/Proj4Lambert.xml b/src/params/Proj4Lambert.xml
index 348b69f..4a8aa8d 100644
--- a/src/params/Proj4Lambert.xml
+++ b/src/params/Proj4Lambert.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Lambert"/></magics>
diff --git a/src/params/Proj4LambertNorthAtlantic.xml b/src/params/Proj4LambertNorthAtlantic.xml
index 0d916bb..3ce86d5 100644
--- a/src/params/Proj4LambertNorthAtlantic.xml
+++ b/src/params/Proj4LambertNorthAtlantic.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4LambertNorthAtlantic"/></magics>
diff --git a/src/params/Proj4Meteosat0.xml b/src/params/Proj4Meteosat0.xml
index c7c6dff..0f4c760 100644
--- a/src/params/Proj4Meteosat0.xml
+++ b/src/params/Proj4Meteosat0.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Meteosat0"/></magics>
diff --git a/src/params/Proj4Meteosat145.xml b/src/params/Proj4Meteosat145.xml
index 5179399..f8a1b1e 100644
--- a/src/params/Proj4Meteosat145.xml
+++ b/src/params/Proj4Meteosat145.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Meteosat145"/></magics>
diff --git a/src/params/Proj4Meteosat57.xml b/src/params/Proj4Meteosat57.xml
index 8ea9c89..dc2a282 100644
--- a/src/params/Proj4Meteosat57.xml
+++ b/src/params/Proj4Meteosat57.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Meteosat57"/></magics>
diff --git a/src/params/Proj4Mollweide.xml b/src/params/Proj4Mollweide.xml
index cd7df34..4a7f2b3 100644
--- a/src/params/Proj4Mollweide.xml
+++ b/src/params/Proj4Mollweide.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Mollweide"/></magics>
diff --git a/src/params/Proj4PolarNorth.xml b/src/params/Proj4PolarNorth.xml
index 5857555..aedcb54 100644
--- a/src/params/Proj4PolarNorth.xml
+++ b/src/params/Proj4PolarNorth.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4PolarNorth"/></magics>
diff --git a/src/params/Proj4Projection.xml b/src/params/Proj4Projection.xml
index 3a83660..e00a9b0 100644
--- a/src/params/Proj4Projection.xml
+++ b/src/params/Proj4Projection.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Transformation" action="projection" prefix="subpage" directory="common" name="Proj4Projection">
<documentation>
diff --git a/src/params/Proj4Robinson.xml b/src/params/Proj4Robinson.xml
index 3fa8838..0aec245 100644
--- a/src/params/Proj4Robinson.xml
+++ b/src/params/Proj4Robinson.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="Proj4Projection" directory="common" prefix="subpage" include="Proj4Projection.h" name="Proj4Robinson"/></magics>
diff --git a/src/params/QtDriver.xml b/src/params/QtDriver.xml
index 652dad5..d801888 100644
--- a/src/params/QtDriver.xml
+++ b/src/params/QtDriver.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="BaseDriver" xmltag="qt" name="QtDriver" directory="drivers" prefix="output/output_qt" action="Qt">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
These are the attributes of the Qt output driver. This driver is intended for Qt applications such as Metview.
diff --git a/src/params/SDWindMode.xml b/src/params/SDWindMode.xml
index 4db4c05..e009735 100644
--- a/src/params/SDWindMode.xml
+++ b/src/params/SDWindMode.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="pgrib" directory="decoders" inherits="WindMode" include="WindMode.h" name="SDWindMode"/></magics>
diff --git a/src/params/SVGDriver.xml b/src/params/SVGDriver.xml
index 9447ea6..0189838 100644
--- a/src/params/SVGDriver.xml
+++ b/src/params/SVGDriver.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="BaseDriver" xmltag="svg" name="SVGDriver" directory="drivers" prefix="output_svg/output" action="SVG">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation for_docs="no">
The output driver produces vector graphics in the SVG format. See also the parameters for the Base Driver.
</documentation>
diff --git a/src/params/SampleContourMethod.xml b/src/params/SampleContourMethod.xml
index 9bc80ce..6a455c3 100644
--- a/src/params/SampleContourMethod.xml
+++ b/src/params/SampleContourMethod.xml
@@ -2,6 +2,16 @@
<class inherits="ContourMethod" directory="visualisers" include="AutomaticContourMethod.h" name="SampleContourMethod" doc_inherits="no">
<parameter xml="x_interval" from="int" name="contour_sample_x_interval" default="2" member="x" to="int">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>X sampling interval used in 'sample' method (takes every nth point) </documentation>/>
</parameter>
diff --git a/src/params/SelectionMode.xml b/src/params/SelectionMode.xml
index 3927ee7..ed93831 100644
--- a/src/params/SelectionMode.xml
+++ b/src/params/SelectionMode.xml
@@ -1,5 +1,15 @@
<magics>
<class action="Interactive" directory="drivers" prefix="selection_mode" xmltag="interactive_mode" name="SelectionMode">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="background_colour" to="Colour" default="blue" from="string" name="selection_mode_background_colour">
<release>Magics++3.2 </release>
<documentation> Background colour of selectables objets. </documentation>
diff --git a/src/params/ShadingTechnique.xml b/src/params/ShadingTechnique.xml
index f62a457..f9935ad 100644
--- a/src/params/ShadingTechnique.xml
+++ b/src/params/ShadingTechnique.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" include="ShadingTechnique.h" name="ShadingTechnique"/></magics>
diff --git a/src/params/ShapeDecoder.xml b/src/params/ShapeDecoder.xml
index 0496633..249f994 100644
--- a/src/params/ShapeDecoder.xml
+++ b/src/params/ShapeDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pshape" directory="decoders" prefix="shape" xmltag="shape" name="ShapeDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="shape_input_file_name">
<release>Magics++2.1 </release>
<documentation> The name of the input file containing the shape data ( geography only) </documentation>
diff --git a/src/params/SimpleOutLayerTechnique.xml b/src/params/SimpleOutLayerTechnique.xml
index 2038ed0..6532af9 100644
--- a/src/params/SimpleOutLayerTechnique.xml
+++ b/src/params/SimpleOutLayerTechnique.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="NoOutLayerTechnique" directory="visualisers" include="OutLayerTechnique.h" name="SimpleOutLayerTechnique"/></magics>
diff --git a/src/params/SimplePolyline.xml b/src/params/SimplePolyline.xml
index 75a85ce..85e606a 100644
--- a/src/params/SimplePolyline.xml
+++ b/src/params/SimplePolyline.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="SimplePolylineInput" xmltag="polyline" name="SimplePolyline" directory="visualisers" prefix="polyline/polyline_line" action="pline" interface="ColourTechniqueInterface/LevelSelectionInterface">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="legend" to="bool" default="off" from="string" name="legend">
<release>Magics++2.80 </release>
<documentation> Turn the legend on </documentation>f
diff --git a/src/params/SimplePolylineInput.xml b/src/params/SimplePolylineInput.xml
index a3321e3..8d1d7c3 100644
--- a/src/params/SimplePolylineInput.xml
+++ b/src/params/SimplePolylineInput.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pline" directory="decoders" prefix="polyline/polyline_input" xmltag="polyline_input" name="SimplePolylineInput">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="latitudes" to="floatarray" default="floatarray()" from="floatarray" name="polyline_input_latitudes">
<release>Magics++2.1 </release>
diff --git a/src/params/Streamlines.xml b/src/params/Streamlines.xml
index e668747..ea59fad 100644
--- a/src/params/Streamlines.xml
+++ b/src/params/Streamlines.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class inherits="WindPlotting" name="Streamlines" directory="visualisers" prefix="wind/wind_streamlines" action="pwind" doc_inherits="no">
<documentation>
diff --git a/src/params/SymbolAdvancedTableMode.xml b/src/params/SymbolAdvancedTableMode.xml
index 4533917..248004a 100644
--- a/src/params/SymbolAdvancedTableMode.xml
+++ b/src/params/SymbolAdvancedTableMode.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" inherits="SymbolMode" prefix="symbol/symbol_advanced_table" xmltag="advanced" name="SymbolAdvancedTableMode">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Here comes the description of the SymbolTableMode object
</documentation>
diff --git a/src/params/SymbolIndividualMode.xml b/src/params/SymbolIndividualMode.xml
index 087801f..42c6b8d 100644
--- a/src/params/SymbolIndividualMode.xml
+++ b/src/params/SymbolIndividualMode.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="SymbolMode" xmltag="individual" name="SymbolIndividualMode" prefix="symbol" directory="visualisers" include="SymbolMode.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>Here comes the description of the SymbolIndividualMode object </documentation>
<parameter default="" to="string" member="legend_text" from="string" name="legend_user_text">
diff --git a/src/params/SymbolInput.xml b/src/params/SymbolInput.xml
index 32dc945..0c4112e 100644
--- a/src/params/SymbolInput.xml
+++ b/src/params/SymbolInput.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="decoders" action_routine="psymb" prefix="symbol/symbol_input" xmltag="input" name="SymbolInput">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Here comes the description of the Symbol Plotting action
</documentation>
diff --git a/src/params/SymbolMode.xml b/src/params/SymbolMode.xml
index 508c4ae..bec3e18 100644
--- a/src/params/SymbolMode.xml
+++ b/src/params/SymbolMode.xml
@@ -1,3 +1,13 @@
<magics>
<class directory="visualisers" prefix="symbol" xmltag="table" name="SymbolMode">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
</class></magics>
diff --git a/src/params/SymbolPlotting.xml b/src/params/SymbolPlotting.xml
index 4364526..e2891b5 100644
--- a/src/params/SymbolPlotting.xml
+++ b/src/params/SymbolPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="symbol" name="SymbolPlotting" metview="MSYMB" directory="visualisers" prefix="symbol" action="psymb">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
This action routine (and C++object) controls the plotting of meteorological and marker symbols.
</documentation>
diff --git a/src/params/SymbolTableMode.xml b/src/params/SymbolTableMode.xml
index 9aba5d2..fcbf173 100644
--- a/src/params/SymbolTableMode.xml
+++ b/src/params/SymbolTableMode.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="SymbolMode" xmltag="table" name="SymbolTableMode" prefix="symbol" directory="visualisers" include="SymbolMode.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
Here comes the description of the SymbolTableMode object
</documentation>
diff --git a/src/params/TableDecoder.xml b/src/params/TableDecoder.xml
index ed6b9ba..9e9f7e0 100644
--- a/src/params/TableDecoder.xml
+++ b/src/params/TableDecoder.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="decoders" xmltag="table" name="TableDecoder">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> table data for curve </documentation>
<parameter member="path" to="string" default="" from="string" name="table_filename">
diff --git a/src/params/TaylorGrid.xml b/src/params/TaylorGrid.xml
index cafcf5f..9de8d45 100644
--- a/src/params/TaylorGrid.xml
+++ b/src/params/TaylorGrid.xml
@@ -1,5 +1,15 @@
<magics>
<class action="ptaylor" directory="visualisers" prefix="taylor/taylor" xmltag="taylorgrid" name="TaylorGrid">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> description of the grid </documentation>
<parameter member="label" to="string" default="Correlation" from="string" name="taylor_label">
<documentation>
diff --git a/src/params/TaylorProjection.xml b/src/params/TaylorProjection.xml
index 007c809..803fcdb 100644
--- a/src/params/TaylorProjection.xml
+++ b/src/params/TaylorProjection.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="Transformation" xmltag="taylor" name="TaylorProjection" directory="common" prefix="taylor/taylor/taylor_standard_deviation" action="ptaylor">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
</documentation>
diff --git a/src/params/TephiGrid.xml b/src/params/TephiGrid.xml
index f0ddd31..3b631ef 100644
--- a/src/params/TephiGrid.xml
+++ b/src/params/TephiGrid.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="ptephi" directory="visualisers" name="TephiGrid">
<documentation> description of the grid </documentation>
diff --git a/src/params/TephiInfo.xml b/src/params/TephiInfo.xml
index 18e87de..517bb1f 100644
--- a/src/params/TephiInfo.xml
+++ b/src/params/TephiInfo.xml
@@ -1,2 +1,12 @@
<magics>
<class inherits="Tephigram" xmltag="thermo" name="TephiInfo" directory="common" action="ptephi" include="Tephigram.h"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/Tephigram.xml b/src/params/Tephigram.xml
index bdc236f..479a68d 100644
--- a/src/params/Tephigram.xml
+++ b/src/params/Tephigram.xml
@@ -1,5 +1,15 @@
<magics>
<class action="ptephi" inherits="Transformation" directory="common" xmltag="thermo" name="Tephigram">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="x_min" to="float" default="0" from="float" name="x_min">
diff --git a/src/params/TextVisitor.xml b/src/params/TextVisitor.xml
index 2e62044..e174f7f 100644
--- a/src/params/TextVisitor.xml
+++ b/src/params/TextVisitor.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="text" name="TextVisitor" xml_data="text_lines" directory="basic" prefix="text" xml_doc_inherits="XmlBasicNode" action="ptext">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> </documentation>
diff --git a/src/params/Title.xml b/src/params/Title.xml
index d4121dc..f0d9950 100644
--- a/src/params/Title.xml
+++ b/src/params/Title.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="visualisers" inherits="TitleBase" name="Title" xml_data="title_text">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> </documentation>
<parameter xml="colour" from="string" name="title_colour" default="blue" member="colour" to="Colour">
diff --git a/src/params/TitleBase.xml b/src/params/TitleBase.xml
index 678b497..9551544 100644
--- a/src/params/TitleBase.xml
+++ b/src/params/TitleBase.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" include="TitleBase.h" name="TitleBase"/></magics>
diff --git a/src/params/TitleTemplate.xml b/src/params/TitleTemplate.xml
index 8e22817..ce71361 100644
--- a/src/params/TitleTemplate.xml
+++ b/src/params/TitleTemplate.xml
@@ -4,6 +4,16 @@
Here comes the description of the TitleTemplate
</documentation>
<parameter member="file" to="string" default="title_template.xml" from="string" name="title_template_filename">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Description in Xml of the titles </documentation>
<migration> New Magics: Parameter title_template_filename sent to new Magics[TitleTemplate]. </migration>
</parameter>
diff --git a/src/params/Transformation.xml b/src/params/Transformation.xml
index 1b94d33..77f5ac0 100644
--- a/src/params/Transformation.xml
+++ b/src/params/Transformation.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="common" name="Transformation"/></magics>
diff --git a/src/params/UVWindMode.xml b/src/params/UVWindMode.xml
index b79ef48..41681eb 100644
--- a/src/params/UVWindMode.xml
+++ b/src/params/UVWindMode.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="pgrib" directory="decoders" inherits="WindMode" include="WindMode.h" name="UVWindMode"/></magics>
diff --git a/src/params/UserLogoPlotting.xml b/src/params/UserLogoPlotting.xml
index 59d0b05..408a81e 100644
--- a/src/params/UserLogoPlotting.xml
+++ b/src/params/UserLogoPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="NoLogoPlotting" xmltag="userlogo" name="UserLogoPlotting" prefix="page/page/user_logo" directory="common" include="LogoPlotting.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="user_logo_filename">
<documentation for_docs="no"> Logo's Path </documentation>
diff --git a/src/params/VDWindMode.xml b/src/params/VDWindMode.xml
index 66c3d45..9be03f8 100644
--- a/src/params/VDWindMode.xml
+++ b/src/params/VDWindMode.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="pgrib" directory="decoders" inherits="WindMode" include="WindMode.h" name="VDWindMode"/></magics>
diff --git a/src/params/ValuePlot.xml b/src/params/ValuePlot.xml
index e7e6a36..5e81918 100644
--- a/src/params/ValuePlot.xml
+++ b/src/params/ValuePlot.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="ValuePlotBase" xmltag="gridvalues" name="ValuePlot" directory="visualisers" prefix="contour/contour_grid_value/contour_grid_value" action="pcont">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter from="string" name="contour_grid_value_type" default="normal" member="type" to="string" values="normal/reduced/akima">
<documentation> For Gaussian fields, plot normal (regular) values or reduced grid values. (NORMAL/REDUCED/akima). If akima, the akima grid values will be plotted </documentation>
diff --git a/src/params/ValuePlotBase.xml b/src/params/ValuePlotBase.xml
index 892efaa..5926b3a 100644
--- a/src/params/ValuePlotBase.xml
+++ b/src/params/ValuePlotBase.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" include="ValuePlotBase.h" name="ValuePlotBase"/></magics>
diff --git a/src/params/ValuePlotMethod.xml b/src/params/ValuePlotMethod.xml
index 71bce11..1420c10 100644
--- a/src/params/ValuePlotMethod.xml
+++ b/src/params/ValuePlotMethod.xml
@@ -1,3 +1,13 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="pcont" directory="visualisers" prefix="contour/contour_grid_value/contour_grid_value" name="ValuePlotMethod">
diff --git a/src/params/Wind.xml b/src/params/Wind.xml
index 55dd1e7..8784193 100644
--- a/src/params/Wind.xml
+++ b/src/params/Wind.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="wind" name="Wind" metview="MWIND" directory="visualisers" prefix="wind" action="pwind">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Wind plotting facilities allow users to plot wind fields as either arrows or flags. </documentation>
<parameter member="type" to="WindPlotting" default="arrows" from="string" name="wind_field_type">
diff --git a/src/params/WindMode.xml b/src/params/WindMode.xml
index a4b4d59..a449039 100644
--- a/src/params/WindMode.xml
+++ b/src/params/WindMode.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class action="pgrib" directory="decoders" include="WindMode.h" name="WindMode"/></magics>
diff --git a/src/params/WindPlotting.xml b/src/params/WindPlotting.xml
index b69b722..e99c1e8 100644
--- a/src/params/WindPlotting.xml
+++ b/src/params/WindPlotting.xml
@@ -1,5 +1,15 @@
<magics>
<class action="pwind" directory="visualisers" prefix="wind/wind_flag" xmltag="flags" name="WindPlotting">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>Parameters common to the flags and arrows. </documentation>
<parameter member="legend" to="bool" default="off" from="string" name="legend">
diff --git a/src/params/WrepJSon.xml b/src/params/WrepJSon.xml
index 83d6d9c..1266676 100644
--- a/src/params/WrepJSon.xml
+++ b/src/params/WrepJSon.xml
@@ -1,5 +1,15 @@
<magics>
<class xmltag="wrepjson" name="WrepJSon" directory="web" prefix="wrepjson" action="pwrepjson" include="EpsJSon.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="path" to="string" default="" from="string" name="wrepjson_input_filename">
<documentation> Path to the file containing the Bufr data </documentation>
</parameter>
diff --git a/src/params/WrepRootNode.xml b/src/params/WrepRootNode.xml
index 311eb23..f5c79a3 100644
--- a/src/params/WrepRootNode.xml
+++ b/src/params/WrepRootNode.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="basic" prefix="wrep_node" xmltag="magics" name="WrepRootNode">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation>
In the wrep mode, magics will always try to fill the space: ie the geographical area can be extended!
Different methods cab be used to control this extension..
diff --git a/src/params/XCoordinate.xml b/src/params/XCoordinate.xml
index 8e8f7eb..1208e69 100644
--- a/src/params/XCoordinate.xml
+++ b/src/params/XCoordinate.xml
@@ -1,2 +1,12 @@
<magics>
<class action="pnew" directory="common" xmltag="x_regular" include="Coordinate.h" name="XCoordinate"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/XDateCoordinate.xml b/src/params/XDateCoordinate.xml
index ab81844..9b8c5c8 100644
--- a/src/params/XDateCoordinate.xml
+++ b/src/params/XDateCoordinate.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="XCoordinate" metview_prefix="subpage_" xmltag="x_date" name="XDateCoordinate" directory="common" prefix="subpage/subpage_x/subpage_x_date" action="pnew" include="Coordinate.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
This object contains the common attributes to the cartesian Projections
<parameter xml="automatic" from="string" name="subpage_x_automatic" default="off" member="automatic" to="AxisAutomaticSetting" values="on/off/min_only/max_only">
<release>Magics2.1 </release>
diff --git a/src/params/XHyperCoordinate.xml b/src/params/XHyperCoordinate.xml
index f8c0675..afe975a 100644
--- a/src/params/XHyperCoordinate.xml
+++ b/src/params/XHyperCoordinate.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="XCoordinate" metview_prefix="subpage_" xmltag="x_hyper" name="XHyperCoordinate" directory="common" prefix="subpage/subpage_x/subpage_x_hyper" action="pnew" include="Coordinate.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
This object contains the common attributes to the cartesian Projections
<parameter xml="automatic" from="string" name="subpage_x_automatic" default="off" member="automatic" to="AxisAutomaticSetting" values="on/off/min_only/max_only">
<release>Magics2.1 </release>
diff --git a/src/params/XLogarithmicCoordinate.xml b/src/params/XLogarithmicCoordinate.xml
index 8996a52..3a2d694 100644
--- a/src/params/XLogarithmicCoordinate.xml
+++ b/src/params/XLogarithmicCoordinate.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="XCoordinate" metview_prefix="subpage_" xmltag="x_regular" name="XLogarithmicCoordinate" directory="common" prefix="subpage/subpage_x" action="pnew" include="Coordinate.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
This object contains the common attributes to the cartesian Projections
<parameter xml="automatic" from="string" name="subpage_x_automatic" default="off" member="automatic" to="AxisAutomaticSetting" values="on/off/min_only/max_only">
diff --git a/src/params/XRegularCoordinate.xml b/src/params/XRegularCoordinate.xml
index 852320a..caafe16 100644
--- a/src/params/XRegularCoordinate.xml
+++ b/src/params/XRegularCoordinate.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="XCoordinate" metview_prefix="subpage_" xmltag="x_regular" name="XRegularCoordinate" directory="common" prefix="subpage/subpage_x" action="pnew" include="Coordinate.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
This object contains the common attributes to the cartesian Projections
<parameter xml="automatic" from="string" name="subpage_x_automatic" default="off" member="automatic" to="AxisAutomaticSetting" values="on/off/min_only/max_only">
diff --git a/src/params/XYList.xml b/src/params/XYList.xml
index 51d29b2..9e43f15 100644
--- a/src/params/XYList.xml
+++ b/src/params/XYList.xml
@@ -1,5 +1,15 @@
<magics>
<class directory="decoders" xmltag="xyinput" name="XYList">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Here comes the documentation of the XYSystem object </documentation>
<parameter xml="x_values" from="floatarray" name="x_values" default="floatarray()" member="x" to="floatarray">
diff --git a/src/params/XmlBasicNode.xml b/src/params/XmlBasicNode.xml
index eb6f9d4..0484869 100644
--- a/src/params/XmlBasicNode.xml
+++ b/src/params/XmlBasicNode.xml
@@ -1,5 +1,15 @@
<magics>
<class action="MagML" directory="basic" prefix="view" xmltag="view" name="XmlBasicNode">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="standalone" to="bool" default="off" from="string" name="view_standalone">
<release>Magics++2.9 </release>
<documentation> If true, the node will be created in an external file .. can be useful for legend and text ... </documentation>
diff --git a/src/params/XmlBox.xml b/src/params/XmlBox.xml
index 02952de..580e06f 100644
--- a/src/params/XmlBox.xml
+++ b/src/params/XmlBox.xml
@@ -1,6 +1,16 @@
<magics>
<class directory="visualisers" name="XmlBox">
<parameter xml="left" from="string" name="box_left" default="5%" member="left" to="string">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<release>Magics++0.8 </release>
<documentation> Left Position of Box </documentation>
<migration>Only avalaible in MagML </migration>
diff --git a/src/params/XmlLegendNode.xml b/src/params/XmlLegendNode.xml
index d465594..0e5b529 100644
--- a/src/params/XmlLegendNode.xml
+++ b/src/params/XmlLegendNode.xml
@@ -1,2 +1,12 @@
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<magics>
<class directory="visualisers" inherits="XmlBasicNode/LegendNode" include="LegendNode.h" name="XmlLegendNode" doc_inherits="no"/></magics>
diff --git a/src/params/XmlPage.xml b/src/params/XmlPage.xml
index 180b606..4b4b3b0 100644
--- a/src/params/XmlPage.xml
+++ b/src/params/XmlPage.xml
@@ -2,6 +2,16 @@
<class directory="common" name="XmlPage" embedded_objects="Frame">
<parameter xml="format" from="string" name="format" default="a4" member="format" to="string">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> format of the page </documentation>
<migration> Only used in the MagML Interface </migration>
<release>Magics++0.7 </release>
diff --git a/src/params/XmlRootNode.xml b/src/params/XmlRootNode.xml
index 640ac0d..eacc963 100644
--- a/src/params/XmlRootNode.xml
+++ b/src/params/XmlRootNode.xml
@@ -1,5 +1,15 @@
<magics>
<class name="XmlRootNode" include='RootSceneNode.h' prefix="root_node" xmltag="magics">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="format" to="string" default="a4" from="string" name="root_node_format">
<release>Magics++2.4 </release>
<documentation>Format of super page (A4/A3/A2) </documentation>
diff --git a/src/params/XmlSceneNode.xml b/src/params/XmlSceneNode.xml
index 1a9c09d..23b4df3 100644
--- a/src/params/XmlSceneNode.xml
+++ b/src/params/XmlSceneNode.xml
@@ -1,5 +1,15 @@
<magics>
<class action="MagML" directory="basic" prefix="scene_node/view" xmltag="page" name="XmlSceneNode">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="display" to="DisplayType" default="inline" from="string" name="view_display">
<release>Magics++0.8 </release>
<documentation> Y-Coordinate of bottom of View. </documentation>
diff --git a/src/params/XmlSubPage.xml b/src/params/XmlSubPage.xml
index 880ca07..646571b 100644
--- a/src/params/XmlSubPage.xml
+++ b/src/params/XmlSubPage.xml
@@ -2,6 +2,16 @@
<class directory="common" name="XmlSubPage" embedded_objects="FrameBase/PageIdBase/LegendBase/TitleBase">
<parameter xml="bottom" from="string" name="bottom" default="0%" member="bottom" to="string">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Y-Coordinate of bottom of page. </documentation>
<migration> Only used in the MagML Interface </migration>
<release>Magics++0.8 </release>
diff --git a/src/params/XmlViewNode.xml b/src/params/XmlViewNode.xml
index d2f72e0..506e0bc 100644
--- a/src/params/XmlViewNode.xml
+++ b/src/params/XmlViewNode.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="XmlBasicNode" xmltag="map" name="XmlViewNode" directory="basic" prefix="view/subpage_map" action="MagML">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<parameter member="fitted" to="string" default="off" from="string" name="view_fitted_mode">
<documentation> If set to cropped, the projection will force a resize of the output to respect the aspect ratio.. Useful in the context of the web.. If set to fitted, the projection willbe expendef to fill the space! a resize of the output to respect the aspect ratio.. Useful in the context of the web.. </documentation>
</parameter>
diff --git a/src/params/YCoordinate.xml b/src/params/YCoordinate.xml
index c2c0752..33b2c80 100644
--- a/src/params/YCoordinate.xml
+++ b/src/params/YCoordinate.xml
@@ -1,2 +1,12 @@
<magics>
<class action="pnew" directory="common" xmltag="y_regular" include="Coordinate.h" name="YCoordinate"/></magics>
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
diff --git a/src/params/YDateCoordinate.xml b/src/params/YDateCoordinate.xml
index 9bd349a..7ce9949 100644
--- a/src/params/YDateCoordinate.xml
+++ b/src/params/YDateCoordinate.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="YCoordinate" metview_prefix="subpage_" xmltag="y_date" name="YDateCoordinate" directory="common" prefix="subpage/subpage_y/subpage_y_date" action="pnew" include="Coordinate.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
This object contains the common attributes to the cartesian Projections
<parameter xml="automatic" from="string" name="subpage_y_automatic" default="off" member="automatic" to="AxisAutomaticSetting" values="on/off/min_only/max_only">
<release>Magics 2.1 </release>
diff --git a/src/params/YHyperCoordinate.xml b/src/params/YHyperCoordinate.xml
index 8cd610f..c7f8609 100644
--- a/src/params/YHyperCoordinate.xml
+++ b/src/params/YHyperCoordinate.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="YCoordinate" metview_prefix="subpage_" xmltag="y_hyper" name="YHyperCoordinate" directory="common" prefix="subpage/subpage_y/subpage_y_hyper" action="pnew" include="Coordinate.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
This object contains the common attributes to the cartesian Projections
<parameter xml="automatic" from="string" name="subpage_y_automatic" default="off" member="automatic" to="AxisAutomaticSetting" values="on/off/min_only/max_only">
<release>Magics 2.1 </release>
diff --git a/src/params/YLogarithmicCoordinate.xml b/src/params/YLogarithmicCoordinate.xml
index 033408d..87de474 100644
--- a/src/params/YLogarithmicCoordinate.xml
+++ b/src/params/YLogarithmicCoordinate.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="YCoordinate" metview_prefix="subpage_" xmltag="y_regular" name="YLogarithmicCoordinate" directory="common" prefix="subpage/subpage_y" action="pnew" include="Coordinate.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
This object contains the common attributes to the cartesian Projections
<parameter xml="automatic" from="string" name="subpage_y_automatic" default="off" member="automatic" to="AxisAutomaticSetting" values="on/off/min_only/max_only">
<release>Magics 2.1 </release>
diff --git a/src/params/YRegularCoordinate.xml b/src/params/YRegularCoordinate.xml
index eb2274a..6153b12 100644
--- a/src/params/YRegularCoordinate.xml
+++ b/src/params/YRegularCoordinate.xml
@@ -1,5 +1,15 @@
<magics>
<class inherits="YCoordinate" metview_prefix="subpage_" xmltag="y_regular" name="YRegularCoordinate" directory="common" prefix="subpage/subpage_y" action="pnew" include="Coordinate.h">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
This object contains the common attributes off the cartesian Projection
<parameter xml="automatic" from="string" name="subpage_y_automatic" default="off" member="automatic" to="AxisAutomaticSetting" values="on/off/min_only/max_only">
<release>Magics 2.1 </release>
diff --git a/src/params/todo.xml b/src/params/todo.xml
index 3badec0..a28ec11 100644
--- a/src/params/todo.xml
+++ b/src/params/todo.xml
@@ -3,6 +3,16 @@
<parameter xml="colour_direction" from="string" name="image_colour_direction" default="" member="colour_direction" to="string" implemented="no">
+<!--
+(C) Copyright 1996-2016 ECMWF.
+
+This software is licensed under the terms of the Apache Licence Version 2.0
+which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+In applying this licence, ECMWF does not waive the privileges and immunities
+granted to it by virtue of its status as an intergovernmental organisation nor
+does it submit to any jurisdiction.
+-->
+
<documentation> Direction for pixel colour calculation
</documentation>
<migration> New Magics: Parameter image_colour_direction sent to new Magics[ImagePlotting]. </migration>
diff --git a/src/terralib/CMakeLists.txt b/src/terralib/CMakeLists.txt
index 4a67c9a..c17a580 100644
--- a/src/terralib/CMakeLists.txt
+++ b/src/terralib/CMakeLists.txt
@@ -1,132 +1,17 @@
set( _terralib_srcs
# headers
- kernel/checkvec.h kernel/dynpq.h kernel/graph.h kernel/showseq.h
- kernel/Gra_algo.h
- kernel/TeAbstractFactory.h kernel/TeAbstractTheme.h
- kernel/TeAffineGT.h kernel/TeAffineGTFactory.h
- kernel/TeAgnostic.h kernel/TeAsciiFile.h
- kernel/TeAssertions.h kernel/TeAttribute.h
- kernel/TeBaseSTInstance.h kernel/TeBaseSTInstanceSet.h
- kernel/TeBox.h kernel/TeBufferRegion.h
- kernel/TeComposite.h kernel/TeCoord2D.h
- kernel/TeCounted.h
- kernel/TeDBConnection.h kernel/TeDBConnectionsPool.h
- kernel/TeDataTypes.h kernel/TeDatabase.h
- kernel/TeDatabaseFactory.h kernel/TeDatabaseFactoryParams.h
- kernel/TeDatum.h kernel/TeDecoder.h
- kernel/TeDecoderASCIIGrid.h kernel/TeDecoderDatabase.h
- kernel/TeDecoderFile.h kernel/TeDecoderMemory.h
- kernel/TeDecoderMemoryMap.h kernel/TeDecoderSPR.h
- kernel/TeDecoderSmartMem.h kernel/TeDecoderVirtualMemory.h
- kernel/TeDefines.h
- kernel/TeErrorLog.h kernel/TeErrorMessage.h
- kernel/TeException.h kernel/TeExternalTheme.h
- kernel/TeFactory.h kernel/TeFragmentation.h
- kernel/TeGTFactory.h kernel/TeGTParams.h
- kernel/TeGeometricTransformation.h kernel/TeGeometry.h
- kernel/TeGeometryAlgorithms.h kernel/TeGroupingAlgorithms.h
- kernel/TeImportRaster.h kernel/TeInitRasterDecoders.h
- kernel/TeIntersector.h
- kernel/TeKdTree.h
- kernel/TeLayer.h kernel/TeLegendEntry.h
- kernel/TeMappedMemory.h kernel/TeMatrix.h
- kernel/TeMeasure.h kernel/TeMetaModelCache.h
- kernel/TeMultiContainer.h kernel/TeMultiGeometry.h
- kernel/TeMutex.h
- kernel/TeNeighbours.h kernel/TeNetwork.h
- kernel/TeOverlay.h kernel/TeOverlayUtils.h
- kernel/TePieBar.h kernel/TePrecision.h
- kernel/TeProgress.h kernel/TeProgressBase.h
- kernel/TeProject.h kernel/TeProjection.h
- kernel/TeProjectiveGT.h kernel/TeProjectiveGTFactory.h
- kernel/TePrototype.h kernel/TeProxMatrixConstructionStrategy.h
- kernel/TeProxMatrixImplementation.h
- kernel/TeProxMatrixSlicingStrategy.h
- kernel/TeProxMatrixWeightsStrategy.h
- kernel/TeQuerier.h kernel/TeQuerierDB.h
- kernel/TeQuerierDBStr1.h kernel/TeQuerierDBStr2.h
- kernel/TeQuerierDBStr3.h kernel/TeQuerierImpl.h
- kernel/TeQuerierParams.h
- kernel/TeRTree.h kernel/TeRaster.h
- kernel/TeRasterMemManager.h kernel/TeRasterParams.h
- kernel/TeRasterRemap.h kernel/TeRasterTransform.h
- kernel/TeRepresentation.h
- kernel/TeSTEFunctionsDB.h kernel/TeSTElementSet.h
- kernel/TeSTEvent.h kernel/TeSTInstance.h
- kernel/TeSharedPtr.h kernel/TeSingleton.h
- kernel/TeSlice.h kernel/TeSpatialOperations.h
- kernel/TeStatistics.h kernel/TeStdFile.h
- kernel/TeTable.h kernel/TeTemporalSeries.h
- kernel/TeTheme.h kernel/TeThread.h
- kernel/TeThreadDatatypes.h kernel/TeThreadFunctor.h
- kernel/TeThreadParameters.h kernel/TeThreadSignal.h
- kernel/TeTime.h kernel/TeTimeInterval.h
- kernel/TeTin.h
- kernel/TeUtils.h
- kernel/TeVectorRemap.h kernel/TeView.h
- kernel/TeViewNode.h kernel/TeVisual.h
- kernel/yyTemporal.h
- utils/TeDatabaseUtils.h
- jpeg/ijl.h jpeg/jpeg.h
-# cpp sources
- kernel/TeAbstractTheme.cpp
- kernel/TeAffineGT.cpp kernel/TeAffineGTFactory.cpp
- kernel/TeAgnostic.cpp kernel/TeAsciiFile.cpp
- kernel/TeBox.cpp kernel/TeBufferRegion.cpp
- kernel/TeCentroid.cpp
- kernel/TeDBConnection.cpp kernel/TeDBConnectionsPool.cpp
- kernel/TeDatabase.cpp kernel/TeDatabaseFactoryParams.cpp
- kernel/TeDatum.cpp kernel/TeDecoderASCIIGrid.cpp
- kernel/TeDecoderDatabase.cpp kernel/TeDecoderFile.cpp
- kernel/TeDecoderMemory.cpp kernel/TeDecoderMemoryMap.cpp
- kernel/TeDecoderSPR.cpp kernel/TeDecoderSmartMem.cpp
- kernel/TeDecoderVirtualMemory.cpp
- kernel/TeErrorLog.cpp kernel/TeErrorMessage.cpp
- kernel/TeException.cpp kernel/TeExternalTheme.cpp
- kernel/TeFragmentation.cpp
- kernel/TeGTFactory.cpp kernel/TeGTParams.cpp
- kernel/TeGeometricTransformation.cpp kernel/TeGeometry.cpp
- kernel/TeGeometryAlgorithms.cpp kernel/TeGroupingAlgorithms.cpp
- kernel/TeImportRaster.cpp kernel/TeInitRasterDecoders.cpp
- kernel/TeIntersector.cpp
- kernel/TeLayer.cpp kernel/TeLegendEntry.cpp
- kernel/TeMappedMemory.cpp kernel/TeMatrix.cpp
- kernel/TeMetaModelCache.cpp kernel/TeMultiGeometry.cpp
- kernel/TeMutex.cpp
- kernel/TeNeighbours.cpp kernel/TeNetwork.cpp
- kernel/TeOverlay.cpp kernel/TeOverlayUtils.cpp
- kernel/TeProgress.cpp kernel/TeProject.cpp
- kernel/TeProjection.cpp kernel/TeProjectiveGT.cpp
- kernel/TeProjectiveGTFactory.cpp
- kernel/TeProxMatrixConstructionStrategy.cpp
- kernel/TeProxMatrixImplementation.cpp
- kernel/TeProxMatrixStrategies.cpp
- kernel/TeQuerier.cpp kernel/TeQuerierDB.cpp
- kernel/TeQuerierDBStr1.cpp kernel/TeQuerierDBStr2.cpp
- kernel/TeQuerierDBStr3.cpp kernel/TeQuerierImpl.cpp
- kernel/TeQuerierParams.cpp
- kernel/TeRaster.cpp kernel/TeRasterMemManager.cpp
- kernel/TeRasterParams.cpp kernel/TeRasterRemap.cpp
- kernel/TeRasterTransform.cpp kernel/TeRepresentation.cpp
- kernel/TeSTElementSet.cpp kernel/TeSTEvent.cpp
- kernel/TeSTInstance.cpp kernel/TeSpatialOperations.cpp
- kernel/TeStdFile.cpp
- kernel/TeTable.cpp kernel/TeTemporalSeries.cpp
- kernel/TeTheme.cpp kernel/TeThread.cpp
- kernel/TeThreadFunctor.cpp kernel/TeThreadSignal.cpp
- kernel/TeTime.cpp kernel/TeTimeInterval.cpp
- kernel/TeTin.cpp
- kernel/TeUtils.cpp
- kernel/TeVectorRemap.cpp kernel/TeViewNode.cpp
- kernel/TeVisual.cpp
- kernel/lexTemporal.cpp kernel/yyTemporal.cpp
-
+ kernel/TeProjection.h kernel/TeProjection.cpp
+ kernel/TeDatum.cpp kernel/TeDatum.h
+ kernel/TeUtils.h kernel/TeUtils.cpp
+ kernel/TeGeometry.h kernel/TeGeometry.cpp
+ kernel/TeMultiGeometry.h kernel/TeMultiGeometry.cpp
+ kernel/TeBox.h kernel/TeBox.cpp
+ kernel/TeErrorLog.h kernel/TeErrorLog.cpp
+ kernel/TeException.h kernel/TeException.cpp
+ kernel/TeCoord2D.h kernel/TeDefines.h kernel/TePrecision.h kernel/TeSingleton.h kernel/TeComposite.h kernel/TeCounted.h kernel/TeMeasure.h kernel/TeDataTypes.h
)
foreach( file ${_terralib_srcs} )
list( APPEND terralib_srcs terralib/${file} )
endforeach()
set( terralib_srcs ${terralib_srcs} PARENT_SCOPE )
-
-# libterralib_la_CXXFLAGS = -DNO_HUGE -DXTFUNCPROTO -DLITTLEENDIAN -DS4LINUX -DS4MDX -DS4NO_STRNICMP -DXK_MISCELLANY -DNO_TEJPEG -DNO_TETIFF
-# AM_CPPFLAGS = -I$(top_srcdir)/src/terralib -I$(top_srcdir)/src/terralib/kernel -I$(top_srcdir)/src/terralib/utils
diff --git a/src/terralib/jpeg/ijl.h b/src/terralib/jpeg/ijl.h
deleted file mode 100644
index 26ff912..0000000
--- a/src/terralib/jpeg/ijl.h
+++ /dev/null
@@ -1,1513 +0,0 @@
-/*M*
-//
-//
-// INTEL CORPORATION PROPRIETARY INFORMATION
-// This software is supplied under the terms of a license agreement or
-// nondisclosure agreement with Intel Corporation and may not be copied
-// or disclosed except in accordance with the terms of that agreement.
-// Copyright (c) 1998 Intel Corporation. All Rights Reserved.
-//
-//
-// File:
-// ijl.h
-//
-// Purpose:
-// IJL Common Header File
-// This file contains: definitions for data types, data
-// structures, error codes, and function prototypes used
-// in the Intel(R) JPEG Library (IJL).
-//
-// Version:
-// 1.5
-//
-*M*/
-
-#ifndef __IJL_H__
-#define __IJL_H__
-
-
-#if defined( __cplusplus )
-extern "C" {
-#endif
-
-
-#ifndef IJL_ALL_WARNINGS
-
-#if _MSC_VER >= 1000
-
-/* nonstandard extension used : nameless struct/union */
-#pragma warning(disable : 4201)
-/* nonstandard extension used : bit field types other than int */
-#pragma warning(disable : 4214)
-/* unreferenced inline function has been removed */
-#pragma warning(disable : 4514)
-/* named type definition in parentheses */
-#pragma warning(disable : 4115)
-
-#endif /* _MSC_VER >= 1000 */
-
-#endif /* IJL_ALL_WARNINGS */
-
-
-#define IJL_STDCALL __stdcall
-
-
-/* align struct on 8 bytes boundary */
-#pragma pack (8)
-
-
-/* /////////////////////////////////////////////////////////////////////////
-// Macros/Constants */
-
-/* Size of file I/O buffer (4K). */
-#define JBUFSIZE 4096
-
-
-#define IJL_INT64 __int64
-#define IJL_UINT64 unsigned IJL_INT64
-
-
-#ifndef IJLAPI
- #ifdef IJL_MSEXPORTS
- #define IJLAPI(type,name,arg) \
- extern __declspec(dllimport) type IJL_STDCALL name arg
- #else
- #define IJLAPI(type,name,arg) \
- extern type IJL_STDCALL name arg
- #endif
-#endif
-
-
-
-#define IJL_DIB_ALIGN (sizeof(int) - 1)
-
-#define IJL_DIB_UWIDTH(width,nchannels) \
- ((width) * (nchannels))
-
-#define IJL_DIB_AWIDTH(width,nchannels) \
- ( ((IJL_DIB_UWIDTH(width,nchannels) + IJL_DIB_ALIGN) & (~IJL_DIB_ALIGN)) )
-
-#define IJL_DIB_PAD_BYTES(width,nchannels) \
- ( IJL_DIB_AWIDTH(width,nchannels) - IJL_DIB_UWIDTH(width,nchannels) )
-
-
-#define IJL_DIB_SCALE_SIZE(jpgsize,scale) \
- ( ((jpgsize) + (scale) - 1) / (scale) )
-
-
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: IJLibVersion
-//
-// Purpose: Stores library version info.
-//
-// Context:
-//
-// Example:
-// major - 1
-// minor - 0
-// build - 1
-// Name - "ijl10.dll"
-// Version - "1.0.1 Beta1"
-// InternalVersion - "1.0.1.1"
-// BuildDate - "Sep 22 1998"
-// CallConv - "DLL"
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _IJLibVersion
-{
- int major;
- int minor;
- int build;
- const char* Name;
- const char* Version;
- const char* InternalVersion;
- const char* BuildDate;
- const char* CallConv;
-
-} IJLibVersion;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: IJL_RECT
-//
-// Purpose: Keep coordinates for rectangle region of image
-//
-// Context: Used to specify roi
-//
-// Fields:
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _IJL_RECT
-{
- long left;
- long top;
- long right;
- long bottom;
-
-} IJL_RECT;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: IJL_HANDLE
-//
-// Purpose: file handle
-//
-// Context: used internally
-//
-// Fields:
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef void* IJL_HANDLE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: IJLIOTYPE
-//
-// Purpose: Possible types of data read/write/other operations to be
-// performed by the functions IJL_Read and IJL_Write.
-//
-// See the Developer's Guide for details on appropriate usage.
-//
-// Fields:
-//
-// IJL_JFILE_XXXXXXX Indicates JPEG data in a stdio file.
-//
-// IJL_JBUFF_XXXXXXX Indicates JPEG data in an addressable buffer.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef enum _IJLIOTYPE
-{
- IJL_SETUP = -1,
-
-
- /* Read JPEG parameters (i.e., height, width, channels, sampling, etc.) */
- /* from a JPEG bit stream. */
- IJL_JFILE_READPARAMS = 0,
- IJL_JBUFF_READPARAMS = 1,
-
- /* Read a JPEG Interchange Format image. */
- IJL_JFILE_READWHOLEIMAGE = 2,
- IJL_JBUFF_READWHOLEIMAGE = 3,
-
- /* Read JPEG tables from a JPEG Abbreviated Format bit stream. */
- IJL_JFILE_READHEADER = 4,
- IJL_JBUFF_READHEADER = 5,
-
- /* Read image info from a JPEG Abbreviated Format bit stream. */
- IJL_JFILE_READENTROPY = 6,
- IJL_JBUFF_READENTROPY = 7,
-
- /* Write an entire JFIF bit stream. */
- IJL_JFILE_WRITEWHOLEIMAGE = 8,
- IJL_JBUFF_WRITEWHOLEIMAGE = 9,
-
- /* Write a JPEG Abbreviated Format bit stream. */
- IJL_JFILE_WRITEHEADER = 10,
- IJL_JBUFF_WRITEHEADER = 11,
-
- /* Write image info to a JPEG Abbreviated Format bit stream. */
- IJL_JFILE_WRITEENTROPY = 12,
- IJL_JBUFF_WRITEENTROPY = 13,
-
-
- /* Scaled Decoding Options: */
-
- /* Reads a JPEG image scaled to 1/2 size. */
- IJL_JFILE_READONEHALF = 14,
- IJL_JBUFF_READONEHALF = 15,
-
- /* Reads a JPEG image scaled to 1/4 size. */
- IJL_JFILE_READONEQUARTER = 16,
- IJL_JBUFF_READONEQUARTER = 17,
-
- /* Reads a JPEG image scaled to 1/8 size. */
- IJL_JFILE_READONEEIGHTH = 18,
- IJL_JBUFF_READONEEIGHTH = 19,
-
- /* Reads an embedded thumbnail from a JFIF bit stream. */
- IJL_JFILE_READTHUMBNAIL = 20,
- IJL_JBUFF_READTHUMBNAIL = 21
-
-} IJLIOTYPE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: IJL_COLOR
-//
-// Purpose: Possible color space formats.
-//
-// Note these formats do *not* necessarily denote
-// the number of channels in the color space.
-// There exists separate "channel" fields in the
-// JPEG_CORE_PROPERTIES data structure specifically
-// for indicating the number of channels in the
-// JPEG and/or DIB color spaces.
-//
-// See the Developer's Guide for details on appropriate usage.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef enum _IJL_COLOR
-{
- IJL_RGB = 1, /* Red-Green-Blue color space. */
- IJL_BGR = 2, /* Reversed channel ordering from IJL_RGB. */
- IJL_YCBCR = 3, /* Luminance-Chrominance color space as defined */
- /* by CCIR Recommendation 601. */
- IJL_G = 4, /* Grayscale color space. */
- IJL_RGBA_FPX = 5, /* FlashPix RGB 4 channel color space that */
- /* has pre-multiplied opacity. */
- IJL_YCBCRA_FPX = 6, /* FlashPix YCbCr 4 channel color space that */
- /* has pre-multiplied opacity. */
-
- IJL_OTHER = 255 /* Some other color space not defined by the IJL. */
- /* (This means no color space conversion will */
- /* be done by the IJL.) */
-
-} IJL_COLOR;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: IJL_JPGSUBSAMPLING
-//
-// Purpose: Possible subsampling formats used in the JPEG.
-//
-// See the Developer's Guide for details on appropriate usage.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef enum _IJL_JPGSUBSAMPLING
-{
- IJL_NONE = 0, /* Corresponds to "No Subsampling". */
- /* Valid on a JPEG w/ any number of channels. */
- IJL_411 = 1, /* Valid on a JPEG w/ 3 channels. */
- IJL_422 = 2, /* Valid on a JPEG w/ 3 channels. */
-
- IJL_4114 = 3, /* Valid on a JPEG w/ 4 channels. */
- IJL_4224 = 4 /* Valid on a JPEG w/ 4 channels. */
-
-} IJL_JPGSUBSAMPLING;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: IJL_DIBSUBSAMPLING
-//
-// Purpose: Possible subsampling formats used in the DIB.
-//
-// See the Developer's Guide for details on appropriate usage.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef IJL_JPGSUBSAMPLING IJL_DIBSUBSAMPLING;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: HUFFMAN_TABLE
-//
-// Purpose: Stores Huffman table information in a fast-to-use format.
-//
-// Context: Used by Huffman encoder/decoder to access Huffman table
-// data. Raw Huffman tables are formatted to fit this
-// structure prior to use.
-//
-// Fields:
-// huff_class 0 == DC Huffman or lossless table, 1 == AC table.
-// ident Huffman table identifier, 0-3 valid (Extended Baseline).
-// huffelem Huffman elements for codes <= 8 bits long;
-// contains both zero run-length and symbol length in bits.
-// huffval Huffman values for codes 9-16 bits in length.
-// mincode Smallest Huffman code of length n.
-// maxcode Largest Huffman code of length n.
-// valptr Starting index into huffval[] for symbols of length k.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _HUFFMAN_TABLE
-{
- int huff_class;
- int ident;
- unsigned int huffelem[256];
- unsigned short huffval[256];
- unsigned short mincode[17];
- short maxcode[18];
- unsigned short valptr[17];
-
-} HUFFMAN_TABLE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: JPEGHuffTable
-//
-// Purpose: Stores pointers to JPEG-binary spec compliant
-// Huffman table information.
-//
-// Context: Used by interface and table methods to specify encoder
-// tables to generate and store JPEG images.
-//
-// Fields:
-// bits Points to number of codes of length i (<=16 supported).
-// vals Value associated with each Huffman code.
-// hclass 0 == DC table, 1 == AC table.
-// ident Specifies the identifier for this table.
-// 0-3 for extended JPEG compliance.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _JPEGHuffTable
-{
- unsigned char* bits;
- unsigned char* vals;
- unsigned char hclass;
- unsigned char ident;
-
-} JPEGHuffTable;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: QUANT_TABLE
-//
-// Purpose: Stores quantization table information in a
-// fast-to-use format.
-//
-// Context: Used by quantizer/dequantizer to store formatted
-// quantization tables.
-//
-// Fields:
-// precision 0 => elements contains 8-bit elements,
-// 1 => elements contains 16-bit elements.
-// ident Table identifier (0-3).
-// elements Pointer to 64 table elements + 16 extra elements to catch
-// input data errors that may cause malfunction of the
-// Huffman decoder.
-// elarray Space for elements (see above) plus 8 bytes to align
-// to a quadword boundary.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _QUANT_TABLE
-{
- int precision;
- int ident;
- short* elements;
- short elarray [84];
-
-} QUANT_TABLE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: JPEGQuantTable
-//
-// Purpose: Stores pointers to JPEG binary spec compliant
-// quantization table information.
-//
-// Context: Used by interface and table methods to specify encoder
-// tables to generate and store JPEG images.
-//
-// Fields:
-// quantizer Zig-zag order elements specifying quantization factors.
-// ident Specifies identifier for this table.
-// 0-3 valid for Extended Baseline JPEG compliance.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _JPEGQuantTable
-{
- unsigned char* quantizer;
- unsigned char ident;
-
-} JPEGQuantTable;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: FRAME_COMPONENT
-//
-// Purpose: One frame-component structure is allocated per component
-// in a frame.
-//
-// Context: Used by Huffman decoder to manage components.
-//
-// Fields:
-// ident Component identifier. The tables use this ident to
-// determine the correct table for each component.
-// hsampling Horizontal subsampling factor for this component,
-// 1-4 are legal.
-// vsampling Vertical subsampling factor for this component,
-// 1-4 are legal.
-// quant_sel Quantization table selector. The quantization table
-// used by this component is determined via this selector.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _FRAME_COMPONENT
-{
- int ident;
- int hsampling;
- int vsampling;
- int quant_sel;
-
-} FRAME_COMPONENT;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: FRAME
-//
-// Purpose: Stores frame-specific data.
-//
-// Context: One Frame structure per image.
-//
-// Fields:
-// precision Sample precision in bits.
-// width Width of the source image in pixels.
-// height Height of the source image in pixels.
-// MCUheight Height of a frame MCU.
-// MCUwidth Width of a frame MCU.
-// max_hsampling Max horiz sampling ratio of any component in the frame.
-// max_vsampling Max vert sampling ratio of any component in the frame.
-// ncomps Number of components/channels in the frame.
-// horMCU Number of horizontal MCUs in the frame.
-// totalMCU Total number of MCUs in the frame.
-// comps Array of 'ncomps' component descriptors.
-// restart_interv Indicates number of MCUs after which to restart the
-// entropy parameters.
-// SeenAllDCScans Used when decoding Multiscan images to determine if
-// all channels of an image have been decoded.
-// SeenAllACScans (See SeenAllDCScans)
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _FRAME
-{
- int precision;
- int width;
- int height;
- int MCUheight;
- int MCUwidth;
- int max_hsampling;
- int max_vsampling;
- int ncomps;
- int horMCU;
- long totalMCU;
- FRAME_COMPONENT* comps;
- int restart_interv;
- int SeenAllDCScans;
- int SeenAllACScans;
-
-} FRAME;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: SCAN_COMPONENT
-//
-// Purpose: One scan-component structure is allocated per component
-// of each scan in a frame.
-//
-// Context: Used by Huffman decoder to manage components within scans.
-//
-// Fields:
-// comp Component number, index to the comps member of FRAME.
-// hsampling Horizontal sampling factor.
-// vsampling Vertical sampling factor.
-// dc_table DC Huffman table pointer for this scan.
-// ac_table AC Huffman table pointer for this scan.
-// quant_table Quantization table pointer for this scan.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _SCAN_COMPONENT
-{
- int comp;
- int hsampling;
- int vsampling;
- HUFFMAN_TABLE* dc_table;
- HUFFMAN_TABLE* ac_table;
- QUANT_TABLE* quant_table;
-
-} SCAN_COMPONENT;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: SCAN
-//
-// Purpose: One SCAN structure is allocated per scan in a frame.
-//
-// Context: Used by Huffman decoder to manage scans.
-//
-// Fields:
-// ncomps Number of image components in a scan, 1-4 legal.
-// gray_scale If TRUE, decode only the Y channel.
-// start_spec Start coefficient of spectral or predictor selector.
-// end_spec End coefficient of spectral selector.
-// approx_high High bit position in successive approximation
-// Progressive coding.
-// approx_low Low bit position in successive approximation
-// Progressive coding.
-// restart_interv Restart interval, 0 if disabled.
-// curxMCU Next horizontal MCU index to be processed after
-// an interrupted SCAN.
-// curyMCU Next vertical MCU index to be processed after
-// an interrupted SCAN.
-// dc_diff Array of DC predictor values for DPCM modes.
-// comps Array of ncomps SCAN_COMPONENT component identifiers.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _SCAN
-{
- int ncomps;
- int gray_scale;
- int start_spec;
- int end_spec;
- int approx_high;
- int approx_low;
- unsigned int restart_interv;
- int curxMCU;
- int curyMCU;
- int dc_diff[4];
- SCAN_COMPONENT* comps;
-
-} SCAN;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: DCTTYPE
-//
-// Purpose: Possible algorithms to be used to perform the discrete
-// cosine transform (DCT).
-//
-// Fields:
-// IJL_AAN The AAN (Arai, Agui, and Nakajima) algorithm from
-// Trans. IEICE, vol. E 71(11), 1095-1097, Nov. 1988.
-// IJL_IPP The modified K. R. Rao and P. Yip algorithm from
-// Intel Performance Primitives Library
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef enum _DCTTYPE
-{
- IJL_AAN = 0,
- IJL_IPP = 1
-
-} DCTTYPE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: UPSAMPLING_TYPE
-//
-// Purpose: - Possible algorithms to be used to perform upsampling
-//
-// Fields:
-// IJL_BOX_FILTER - the algorithm is simple replication of the input pixel
-// onto the corresponding output pixels (box filter);
-// IJL_TRIANGLE_FILTER - 3/4 * nearer pixel + 1/4 * further pixel in each
-// dimension
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef enum _UPSAMPLING_TYPE
-{
- IJL_BOX_FILTER = 0,
- IJL_TRIANGLE_FILTER = 1
-
-} UPSAMPLING_TYPE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: SAMPLING_STATE
-//
-// Purpose: Stores current conditions of sampling. Only for upsampling
-// with triangle filter is used now.
-//
-// Fields:
-// top_row - pointer to buffer with MCUs, that are located above than
-// current row of MCUs;
-// cur_row - pointer to buffer with current row of MCUs;
-// bottom_row - pointer to buffer with MCUs, that are located below than
-// current row of MCUs;
-// last_row - pointer to bottom boundary of last row of MCUs
-// cur_row_number - number of row of MCUs, that is decoding;
-// user_interrupt - field to store jprops->interrupt, because of we prohibit
-// interrupts while top row of MCUs is upsampling.
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _SAMPLING_STATE
-{
- short* top_row;
- short* cur_row;
- short* bottom_row;
- short* last_row;
- int cur_row_number;
-
-} SAMPLING_STATE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: PROCESSOR_TYPE
-//
-// Purpose: Possible types of processors.
-// Note that the enums are defined in ascending order
-// depending upon their various IA32 instruction support.
-//
-// Fields:
-//
-// IJL_OTHER_PROC
-// Does not support the CPUID instruction and
-// assumes no Pentium(R) processor instructions.
-//
-// IJL_PENTIUM_PROC
-// Corresponds to an Intel(R) Pentium(R) processor
-// (or a 100% compatible) that supports the
-// Pentium(R) processor instructions.
-//
-// IJL_PENTIUM_PRO_PROC
-// Corresponds to an Intel(R) Pentium(R) Pro processor
-// (or a 100% compatible) that supports the
-// Pentium(R) Pro processor instructions.
-//
-// IJL_PENTIUM_PROC_MMX_TECH
-// Corresponds to an Intel(R) Pentium(R) processor
-// with MMX(TM) technology (or a 100% compatible)
-// that supports the MMX(TM) instructions.
-//
-// IJL_PENTIUM_II_PROC
-// Corresponds to an Intel(R) Pentium(R) II processor
-// (or a 100% compatible) that supports both the
-// Pentium(R) Pro processor instructions and the
-// MMX(TM) instructions.
-//
-// IJL_PENTIUM_III_PROC
-// Corresponds to an Intel(R) Pentium(R) III processor
-//
-// IJL_NEW_PROCESSOR
-// Correponds to new processor
-//
-// Any additional processor types that support a superset
-// of both the Pentium(R) Pro processor instructions and the
-// MMX(TM) instructions should be given an enum value greater
-// than IJL_PENTIUM_III_PROC.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef enum _PROCESSOR_TYPE
-{
- IJL_OTHER_PROC = 0,
- IJL_PENTIUM_PROC = 1,
- IJL_PENTIUM_PRO_PROC = 2,
- IJL_PENTIUM_PROC_MMX_TECH = 3,
- IJL_PENTIUM_II_PROC = 4,
- IJL_PENTIUM_III_PROC = 5,
- IJL_PENTIUM_4_PROC = 6,
- IJL_NEW_PROCESSOR = 7
-
-} PROCESSOR_TYPE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: RAW_DATA_TYPES_STATE
-//
-// Purpose: Stores data types: raw dct coefficients or raw sampled data.
-// Pointer to structure in JPEG_PROPERTIES is NULL, if any raw
-// data isn't request (DIBBytes!=NULL).
-//
-// Fields:
-// short* raw_ptrs[4] - pointers to buffers with raw data; one pointer
-// corresponds one JPG component;
-// data_type - 0 - raw dct coefficients, 1 - raw sampled data.
-////////////////////////////////////////////////////////////////////////////
-*D*/
-typedef struct _RAW_DATA_TYPES_STATE
-{
- int data_type;
- unsigned short* raw_ptrs[4];
-
-} RAW_DATA_TYPES_STATE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: ENTROPYSTRUCT
-//
-// Purpose: Stores the decoder state information necessary to "jump"
-// to a particular MCU row in a compressed entropy stream.
-//
-// Context: Used to persist the decoder state within Decode_Scan when
-// decoding using ROIs.
-//
-// Fields:
-// offset Offset (in bytes) into the entropy stream
-// from the beginning.
-// dcval1 DC val at the beginning of the MCU row
-// for component 1.
-// dcval2 DC val at the beginning of the MCU row
-// for component 2.
-// dcval3 DC val at the beginning of the MCU row
-// for component 3.
-// dcval4 DC val at the beginning of the MCU row
-// for component 4.
-// bit_buffer_64 64-bit Huffman bit buffer. Stores current
-// bit buffer at the start of a MCU row.
-// Also used as a 32-bit buffer on 32-bit
-// architectures.
-// bitbuf_bits_valid Number of valid bits in the above bit buffer.
-// unread_marker Have any markers been decoded but not
-// processed at the beginning of a MCU row?
-// This entry holds the unprocessed marker, or
-// 0 if none.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _ENTROPYSTRUCT
-{
- unsigned int offset;
- int dcval1;
- int dcval2;
- int dcval3;
- int dcval4;
- IJL_UINT64 bit_buffer_64;
- int bitbuf_bits_valid;
- unsigned char unread_marker;
-
-} ENTROPYSTRUCT;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: STATE
-//
-// Purpose: Stores the active state of the IJL.
-//
-// Context: Used by all low-level routines to store pseudo-global or
-// state variables.
-//
-// Fields:
-// bit_buffer_64 64-bit bitbuffer utilized by Huffman
-// encoder/decoder algorithms utilizing routines
-// designed for MMX(TM) technology.
-// bit_buffer_32 32-bit bitbuffer for all other Huffman
-// encoder/decoder algorithms.
-// bitbuf_bits_valid Number of bits in the above two fields that
-// are valid.
-//
-// cur_entropy_ptr Current position (absolute address) in
-// the entropy buffer.
-// start_entropy_ptr Starting position (absolute address) of
-// the entropy buffer.
-// end_entropy_ptr Ending position (absolute address) of
-// the entropy buffer.
-// entropy_bytes_processed Number of bytes actually processed
-// (passed over) in the entropy buffer.
-// entropy_buf_maxsize Max size of the entropy buffer.
-// entropy_bytes_left Number of bytes left in the entropy buffer.
-// Prog_EndOfBlock_Run Progressive block run counter.
-//
-// DIB_ptr Temporary offset into the input/output DIB.
-//
-// unread_marker If a marker has been read but not processed,
-// stick it in this field.
-// processor_type (0, 1, or 2) == current processor does not
-// support MMX(TM) instructions.
-// (3 or 4) == current processor does
-// support MMX(TM) instructions.
-// cur_scan_comp On which component of the scan are we working?
-// file Process file handle, or
-// 0x00000000 if no file is defined.
-// JPGBuffer Entropy buffer (~4K).
-//
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _STATE
-{
- /* Bit buffer. */
- IJL_UINT64 bit_buffer_64;
- unsigned int bit_buffer_32;
- int bitbuf_bits_valid;
-
- /* Entropy. */
- unsigned char* cur_entropy_ptr;
- unsigned char* start_entropy_ptr;
- unsigned char* end_entropy_ptr;
- int entropy_bytes_processed;
- int entropy_buf_maxsize;
- int entropy_bytes_left;
- int Prog_EndOfBlock_Run;
-
- /* Input or output DIB. */
- unsigned char* DIB_ptr;
-
- /* Control. */
- unsigned char unread_marker;
- PROCESSOR_TYPE processor_type;
- int cur_scan_comp;
- IJL_HANDLE file;
- unsigned char JPGBuffer [JBUFSIZE];
-
-} STATE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: FAST_MCU_PROCESSING_TYPE
-//
-// Purpose: Advanced Control Option. Do NOT modify.
-// WARNING: Used for internal reference only.
-//
-// Fields:
-//
-// IJL_(sampling)_(JPEG color space)_(sampling)_(DIB color space)
-// Decode is read left to right w/ upsampling.
-// Encode is read right to left w/ subsampling.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef enum _FAST_MCU_PROCESSING_TYPE
-{
- IJL_NO_CC_OR_US = 0,
-
- IJL_111_YCBCR_111_RGB = 1,
- IJL_111_YCBCR_111_BGR = 2,
-
- IJL_411_YCBCR_111_RGB = 3,
- IJL_411_YCBCR_111_BGR = 4,
-
- IJL_422_YCBCR_111_RGB = 5,
- IJL_422_YCBCR_111_BGR = 6,
-
- IJL_111_YCBCR_1111_RGBA_FPX = 7,
- IJL_411_YCBCR_1111_RGBA_FPX = 8,
- IJL_422_YCBCR_1111_RGBA_FPX = 9,
-
- IJL_1111_YCBCRA_FPX_1111_RGBA_FPX = 10,
- IJL_4114_YCBCRA_FPX_1111_RGBA_FPX = 11,
- IJL_4224_YCBCRA_FPX_1111_RGBA_FPX = 12,
-
- IJL_111_RGB_1111_RGBA_FPX = 13,
-
- IJL_1111_RGBA_FPX_1111_RGBA_FPX = 14,
-
- IJL_111_OTHER_111_OTHER = 15,
- IJL_411_OTHER_111_OTHER = 16,
- IJL_422_OTHER_111_OTHER = 17,
-
- IJL_YCBYCR_YCBCR = 18,
-
- IJL_YCBCR_YCBYCR = 19 // decoding to YCbCr 422 format
-
-} FAST_MCU_PROCESSING_TYPE;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: JPEG_PROPERTIES
-//
-// Purpose: Stores low-level and control information. It is used by
-// both the encoder and decoder. An advanced external user
-// may access this structure to expand the interface
-// capability.
-//
-// See the Developer's Guide for an expanded description
-// of this structure and its use.
-//
-// Context: Used by all interface methods and most IJL routines.
-//
-// Fields:
-//
-// iotype IN: Specifies type of data operation
-// (read/write/other) to be
-// performed by IJL_Read or IJL_Write.
-// roi IN: Rectangle-Of-Interest to read from, or
-// write to, in pixels.
-// dcttype IN: DCT alogrithm to be used.
-// fast_processing OUT: Supported fast pre/post-processing path.
-// This is set by the IJL.
-// interrupt IN: Signals an interrupt has been requested.
-//
-// DIBBytes IN: Pointer to buffer of uncompressed data.
-// DIBWidth IN: Width of uncompressed data.
-// DIBHeight IN: Height of uncompressed data.
-// DIBPadBytes IN: Padding (in bytes) at end of each
-// row in the uncompressed data.
-// DIBChannels IN: Number of components in the
-// uncompressed data.
-// DIBColor IN: Color space of uncompressed data.
-// DIBSubsampling IN: Required to be IJL_NONE or IJL_422.
-// DIBLineBytes OUT: Number of bytes in an output DIB line
-// including padding.
-//
-// JPGFile IN: Pointer to file based JPEG.
-// JPGBytes IN: Pointer to buffer based JPEG.
-// JPGSizeBytes IN: Max buffer size. Used with JPGBytes.
-// OUT: Number of compressed bytes written.
-// JPGWidth IN: Width of JPEG image.
-// OUT: After reading (except READHEADER).
-// JPGHeight IN: Height of JPEG image.
-// OUT: After reading (except READHEADER).
-// JPGChannels IN: Number of components in JPEG image.
-// OUT: After reading (except READHEADER).
-// JPGColor IN: Color space of JPEG image.
-// JPGSubsampling IN: Subsampling of JPEG image.
-// OUT: After reading (except READHEADER).
-// JPGThumbWidth OUT: JFIF embedded thumbnail width [0-255].
-// JPGThumbHeight OUT: JFIF embedded thumbnail height [0-255].
-//
-// cconversion_reqd OUT: If color conversion done on decode, TRUE.
-// upsampling_reqd OUT: If upsampling done on decode, TRUE.
-// jquality IN: [0-100] where highest quality is 100.
-// jinterleaveType IN/OUT: 0 => MCU interleaved file, and
-// 1 => 1 scan per component.
-// numxMCUs OUT: Number of MCUs in the x direction.
-// numyMCUs OUT: Number of MCUs in the y direction.
-//
-// nqtables IN/OUT: Number of quantization tables.
-// maxquantindex IN/OUT: Maximum index of quantization tables.
-// nhuffActables IN/OUT: Number of AC Huffman tables.
-// nhuffDctables IN/OUT: Number of DC Huffman tables.
-// maxhuffindex IN/OUT: Maximum index of Huffman tables.
-// jFmtQuant IN/OUT: Formatted quantization table info.
-// jFmtAcHuffman IN/OUT: Formatted AC Huffman table info.
-// jFmtDcHuffman IN/OUT: Formatted DC Huffman table info.
-//
-// jEncFmtQuant IN/OUT: Pointer to one of the above, or
-// to externally persisted table.
-// jEncFmtAcHuffman IN/OUT: Pointer to one of the above, or
-// to externally persisted table.
-// jEncFmtDcHuffman IN/OUT: Pointer to one of the above, or
-// to externally persisted table.
-//
-// use_default_qtables IN: Set to default quantization tables.
-// Clear to supply your own.
-// use_default_htables IN: Set to default Huffman tables.
-// Clear to supply your own.
-// rawquanttables IN: Up to 4 sets of quantization tables.
-// rawhufftables IN: Alternating pairs (DC/AC) of up to 4
-// sets of raw Huffman tables.
-// HuffIdentifierAC IN: Indicates what channel the user-
-// supplied Huffman AC tables apply to.
-// HuffIdentifierDC IN: Indicates what channel the user-
-// supplied Huffman DC tables apply to.
-//
-// jframe OUT: Structure with frame-specific info.
-// needframe OUT: TRUE when a frame has been detected.
-//
-// jscan Persistence for current scan pointer when
-// interrupted.
-//
-// state OUT: Contains info on the state of the IJL.
-// SawAdobeMarker OUT: Decoder saw an APP14 marker somewhere.
-// AdobeXform OUT: If SawAdobeMarker TRUE, this indicates
-// the JPEG color space given by that marker.
-//
-// rowoffsets Persistence for the decoder MCU row origins
-// when decoding by ROI. Offsets (in bytes
-// from the beginning of the entropy data)
-// to the start of each of the decoded rows.
-// Fill the offsets with -1 if they have not
-// been initalized and NULL could be the
-// offset to the first row.
-//
-// MCUBuf OUT: Quadword aligned internal buffer.
-// Big enough for the largest MCU
-// (10 blocks) with extra room for
-// additional operations.
-// tMCUBuf OUT: Version of above, without alignment.
-//
-// processor_type OUT: Determines type of processor found
-// during initialization.
-//
-// raw_coefs IN: Place to hold pointers to raw data buffers or
-// raw DCT coefficients buffers
-//
-// progressive_found OUT: 1 when progressive image detected.
-// coef_buffer IN: Pointer to a larger buffer containing
-// frequency coefficients when they
-// cannot be decoded dynamically
-// (i.e., as in progressive decoding).
-//
-// upsampling_type IN: Type of sampling:
-// IJL_BOX_FILTER or IJL_TRIANGLE_FILTER.
-// SAMPLING_STATE* OUT: pointer to structure, describing current
-// condition of upsampling
-//
-// AdobeVersion OUT version field, if Adobe APP14 marker detected
-// AdobeFlags0 OUT flags0 field, if Adobe APP14 marker detected
-// AdobeFlags1 OUT flags1 field, if Adobe APP14 marker detected
-//
-// jfif_app0_detected OUT: 1 - if JFIF APP0 marker detected,
-// 0 - if not
-// jfif_app0_version IN/OUT The JFIF file version
-// jfif_app0_units IN/OUT units for the X and Y densities
-// 0 - no units, X and Y specify
-// the pixel aspect ratio
-// 1 - X and Y are dots per inch
-// 2 - X and Y are dots per cm
-// jfif_app0_Xdensity IN/OUT horizontal pixel density
-// jfif_app0_Ydensity IN/OUT vertical pixel density
-//
-// jpeg_comment IN pointer to JPEG comments
-// jpeg_comment_size IN/OUT size of JPEG comments, in bytes
-//
-// raw_coefs IN/OUT if !NULL, then pointer to vector of pointers
-// (size = JPGChannels) to buffers for raw (short)
-// dct coefficients. 1 pointer corresponds to one
-// component;
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _JPEG_PROPERTIES
-{
- /* Compression/Decompression control. */
- IJLIOTYPE iotype; /* default = IJL_SETUP */
- IJL_RECT roi; /* default = 0 */
- DCTTYPE dcttype; /* default = IJL_AAN */
- FAST_MCU_PROCESSING_TYPE fast_processing; /* default = IJL_NO_CC_OR_US */
- int interrupt; /* default = FALSE */
-
- /* DIB specific I/O data specifiers. */
- unsigned char* DIBBytes; /* default = NULL */
- int DIBWidth; /* default = 0 */
- int DIBHeight; /* default = 0 */
- int DIBPadBytes; /* default = 0 */
- int DIBChannels; /* default = 3 */
- IJL_COLOR DIBColor; /* default = IJL_BGR */
- IJL_DIBSUBSAMPLING DIBSubsampling; /* default = IJL_NONE */
- int DIBLineBytes; /* default = 0 */
-
- /* JPEG specific I/O data specifiers. */
- const char* JPGFile; /* default = NULL */
- unsigned char* JPGBytes; /* default = NULL */
- int JPGSizeBytes; /* default = 0 */
- int JPGWidth; /* default = 0 */
- int JPGHeight; /* default = 0 */
- int JPGChannels; /* default = 3 */
- IJL_COLOR JPGColor; /* default = IJL_YCBCR */
- IJL_JPGSUBSAMPLING JPGSubsampling; /* default = IJL_411 */
- int JPGThumbWidth; /* default = 0 */
- int JPGThumbHeight; /* default = 0 */
-
- /* JPEG conversion properties. */
- int cconversion_reqd; /* default = TRUE */
- int upsampling_reqd; /* default = TRUE */
- int jquality; /* default = 75 */
- int jinterleaveType; /* default = 0 */
- int numxMCUs; /* default = 0 */
- int numyMCUs; /* default = 0 */
-
- /* Tables. */
- int nqtables;
- int maxquantindex;
- int nhuffActables;
- int nhuffDctables;
- int maxhuffindex;
-
- QUANT_TABLE jFmtQuant[4];
- HUFFMAN_TABLE jFmtAcHuffman[4];
- HUFFMAN_TABLE jFmtDcHuffman[4];
-
- short* jEncFmtQuant[4];
- HUFFMAN_TABLE* jEncFmtAcHuffman[4];
- HUFFMAN_TABLE* jEncFmtDcHuffman[4];
-
- /* Allow user-defined tables. */
- int use_external_qtables;
- int use_external_htables;
-
- JPEGQuantTable rawquanttables[4];
- JPEGHuffTable rawhufftables[8];
- char HuffIdentifierAC[4];
- char HuffIdentifierDC[4];
-
- /* Frame specific members. */
- FRAME jframe;
- int needframe;
-
- /* SCAN persistent members. */
- SCAN* jscan;
-
- /* State members. */
- STATE state;
- int SawAdobeMarker;
- int AdobeXform;
-
- /* ROI decoder members. */
- ENTROPYSTRUCT* rowoffsets;
-
- /* Intermediate buffers. */
- unsigned char* MCUBuf;
- unsigned char tMCUBuf[720*2];
-
- /* Processor detected. */
- PROCESSOR_TYPE processor_type;
-
- RAW_DATA_TYPES_STATE* raw_coefs;
-
- /* Progressive mode members. */
- int progressive_found;
- short* coef_buffer;
-
- /* Upsampling mode members. */
- UPSAMPLING_TYPE upsampling_type;
- SAMPLING_STATE* sampling_state_ptr;
-
- /* Adobe APP14 segment variables */
- unsigned short AdobeVersion; /* default = 100 */
- unsigned short AdobeFlags0; /* default = 0 */
- unsigned short AdobeFlags1; /* default = 0 */
-
- /* JFIF APP0 segment variables */
- int jfif_app0_detected;
- unsigned short jfif_app0_version; /* default = 0x0101 */
- unsigned char jfif_app0_units; /* default = 0 - pixel */
- unsigned short jfif_app0_Xdensity; /* default = 1 */
- unsigned short jfif_app0_Ydensity; /* default = 1 */
-
- /* comments related fields */
- char* jpeg_comment; /* default = NULL */
- unsigned short jpeg_comment_size; /* default = 0 */
-
-} JPEG_PROPERTIES;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: JPEG_CORE_PROPERTIES
-//
-// Purpose: This is the primary data structure between the IJL and
-// the external user. It stores JPEG state information
-// and controls the IJL. It is user-modifiable.
-//
-// See the Developer's Guide for details on appropriate usage.
-//
-// Context: Used by all low-level IJL routines to store
-// pseudo-global information.
-//
-// Fields:
-//
-// UseJPEGPROPERTIES Set this flag != 0 if you wish to override
-// the JPEG_CORE_PROPERTIES "IN" parameters with
-// the JPEG_PROPERTIES parameters.
-//
-// DIBBytes IN: Pointer to buffer of uncompressed data.
-// DIBWidth IN: Width of uncompressed data.
-// DIBHeight IN: Height of uncompressed data.
-// DIBPadBytes IN: Padding (in bytes) at end of each
-// row in the uncompressed data.
-// DIBChannels IN: Number of components in the
-// uncompressed data.
-// DIBColor IN: Color space of uncompressed data.
-// DIBSubsampling IN: Required to be IJL_NONE or IJL_422.
-//
-// JPGFile IN: Pointer to file based JPEG.
-// JPGBytes IN: Pointer to buffer based JPEG.
-// JPGSizeBytes IN: Max buffer size. Used with JPGBytes.
-// OUT: Number of compressed bytes written.
-// JPGWidth IN: Width of JPEG image.
-// OUT: After reading (except READHEADER).
-// JPGHeight IN: Height of JPEG image.
-// OUT: After reading (except READHEADER).
-// JPGChannels IN: Number of components in JPEG image.
-// OUT: After reading (except READHEADER).
-// JPGColor IN: Color space of JPEG image.
-// JPGSubsampling IN: Subsampling of JPEG image.
-// OUT: After reading (except READHEADER).
-// JPGThumbWidth OUT: JFIF embedded thumbnail width [0-255].
-// JPGThumbHeight OUT: JFIF embedded thumbnail height [0-255].
-//
-// cconversion_reqd OUT: If color conversion done on decode, TRUE.
-// upsampling_reqd OUT: If upsampling done on decode, TRUE.
-// jquality IN: [0-100] where highest quality is 100.
-//
-// jprops "Low-Level" IJL data structure.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef struct _JPEG_CORE_PROPERTIES
-{
- int UseJPEGPROPERTIES; /* default = 0 */
-
- /* DIB specific I/O data specifiers. */
- unsigned char* DIBBytes; /* default = NULL */
- int DIBWidth; /* default = 0 */
- int DIBHeight; /* default = 0 */
- int DIBPadBytes; /* default = 0 */
- int DIBChannels; /* default = 3 */
- IJL_COLOR DIBColor; /* default = IJL_BGR */
- IJL_DIBSUBSAMPLING DIBSubsampling; /* default = IJL_NONE */
-
- /* JPEG specific I/O data specifiers. */
- const char* JPGFile; /* default = NULL */
- unsigned char* JPGBytes; /* default = NULL */
- int JPGSizeBytes; /* default = 0 */
- int JPGWidth; /* default = 0 */
- int JPGHeight; /* default = 0 */
- int JPGChannels; /* default = 3 */
- IJL_COLOR JPGColor; /* default = IJL_YCBCR */
- IJL_JPGSUBSAMPLING JPGSubsampling; /* default = IJL_411 */
- int JPGThumbWidth; /* default = 0 */
- int JPGThumbHeight; /* default = 0 */
-
- /* JPEG conversion properties. */
- int cconversion_reqd; /* default = TRUE */
- int upsampling_reqd; /* default = TRUE */
- int jquality; /* default = 75 */
-
- /* Low-level properties. */
- JPEG_PROPERTIES jprops;
-
-} JPEG_CORE_PROPERTIES;
-
-
-/*D*
-////////////////////////////////////////////////////////////////////////////
-// Name: IJLERR
-//
-// Purpose: Listing of possible "error" codes returned by the IJL.
-//
-// See the Developer's Guide for details on appropriate usage.
-//
-// Context: Used for error checking.
-//
-////////////////////////////////////////////////////////////////////////////
-*D*/
-
-typedef enum _IJLERR
-{
- /* The following "error" values indicate an "OK" condition. */
- IJL_OK = 0,
- IJL_INTERRUPT_OK = 1,
- IJL_ROI_OK = 2,
-
- /* The following "error" values indicate an error has occurred. */
- IJL_EXCEPTION_DETECTED = -1,
- IJL_INVALID_ENCODER = -2,
- IJL_UNSUPPORTED_SUBSAMPLING = -3,
- IJL_UNSUPPORTED_BYTES_PER_PIXEL = -4,
- IJL_MEMORY_ERROR = -5,
- IJL_BAD_HUFFMAN_TABLE = -6,
- IJL_BAD_QUANT_TABLE = -7,
- IJL_INVALID_JPEG_PROPERTIES = -8,
- IJL_ERR_FILECLOSE = -9,
- IJL_INVALID_FILENAME = -10,
- IJL_ERROR_EOF = -11,
- IJL_PROG_NOT_SUPPORTED = -12,
- IJL_ERR_NOT_JPEG = -13,
- IJL_ERR_COMP = -14,
- IJL_ERR_SOF = -15,
- IJL_ERR_DNL = -16,
- IJL_ERR_NO_HUF = -17,
- IJL_ERR_NO_QUAN = -18,
- IJL_ERR_NO_FRAME = -19,
- IJL_ERR_MULT_FRAME = -20,
- IJL_ERR_DATA = -21,
- IJL_ERR_NO_IMAGE = -22,
- IJL_FILE_ERROR = -23,
- IJL_INTERNAL_ERROR = -24,
- IJL_BAD_RST_MARKER = -25,
- IJL_THUMBNAIL_DIB_TOO_SMALL = -26,
- IJL_THUMBNAIL_DIB_WRONG_COLOR = -27,
- IJL_BUFFER_TOO_SMALL = -28,
- IJL_UNSUPPORTED_FRAME = -29,
- IJL_ERR_COM_BUFFER = -30,
- IJL_RESERVED = -99
-
-} IJLERR;
-
-
-
-
-/* /////////////////////////////////////////////////////////////////////////
-// Function Prototypes (API Calls) //
-///////////////////////////////////////////////////////////////////////// */
-
-
-/*F*
-////////////////////////////////////////////////////////////////////////////
-// Name: ijlInit
-//
-// Purpose: Used to initalize the IJL.
-//
-// See the Developer's Guide for details on appropriate usage.
-//
-// Context: Always call this before anything else.
-// Also, only call this with a new jcprops structure, or
-// after calling IJL_Free. Otherwise, dynamically
-// allocated memory may be leaked.
-//
-// Returns: Any IJLERR value. IJL_OK indicates success.
-//
-// Parameters:
-// jcprops Pointer to an externally allocated
-// JPEG_CORE_PROPERTIES structure.
-//
-////////////////////////////////////////////////////////////////////////////
-*F*/
-
-IJLAPI(IJLERR, ijlInit, ( JPEG_CORE_PROPERTIES* jcprops ));
-
-
-/*F*
-////////////////////////////////////////////////////////////////////////////
-// Name: ijlFree
-//
-// Purpose: Used to properly close down the IJL.
-//
-// See the Developer's Guide for details on appropriate usage.
-//
-// Context: Always call this when done using the IJL to perform
-// clean-up of dynamically allocated memory.
-// Note, IJL_Init will have to be called to use the
-// IJL again.
-//
-// Returns: Any IJLERR value. IJL_OK indicates success.
-//
-// Parameters:
-// jcprops Pointer to an externally allocated
-// JPEG_CORE_PROPERTIES structure.
-//
-////////////////////////////////////////////////////////////////////////////
-*F*/
-
-IJLAPI(IJLERR, ijlFree, ( JPEG_CORE_PROPERTIES* jcprops ));
-
-
-/*F*
-////////////////////////////////////////////////////////////////////////////
-// Name: IJL_Read
-//
-// Purpose: Used to read JPEG data (entropy, or header, or both) into
-// a user-supplied buffer (to hold the image data) and/or
-// into the JPEG_CORE_PROPERTIES structure (to hold the
-// header info).
-//
-// Context: See the Developer's Guide for a detailed description
-// on the use of this function. The jcprops main data
-// members are checked for consistency.
-//
-// Returns: Any IJLERR value. IJL_OK indicates success.
-//
-// Parameters:
-// jcprops Pointer to an externally allocated
-// JPEG_CORE_PROPERTIES structure.
-// iotype Specifies what type of read operation to perform.
-//
-////////////////////////////////////////////////////////////////////////////
-*F*/
-
-IJLAPI(IJLERR, ijlRead, ( JPEG_CORE_PROPERTIES* jcprops, IJLIOTYPE iotype ));
-
-
-/*F*
-////////////////////////////////////////////////////////////////////////////
-// Name: ijlWrite
-//
-// Purpose: Used to write JPEG data (entropy, or header, or both) into
-// a user-supplied buffer (to hold the image data) and/or
-// into the JPEG_CORE_PROPERTIES structure (to hold the
-// header info).
-//
-// Context: See the Developer's Guide for a detailed description
-// on the use of this function. The jcprops main data
-// members are checked for consistency.
-//
-// Returns: Any IJLERR value. IJL_OK indicates success.
-//
-// Parameters:
-// jcprops Pointer to an externally allocated
-// JPEG_CORE_PROPERTIES structure.
-// iotype Specifies what type of write operation to perform.
-//
-////////////////////////////////////////////////////////////////////////////
-*F*/
-
-IJLAPI(IJLERR, ijlWrite, ( JPEG_CORE_PROPERTIES* jcprops, IJLIOTYPE iotype ));
-
-
-/*F*
-////////////////////////////////////////////////////////////////////////////
-// Name: ijlGetLibVersion
-//
-// Purpose: To identify the version number of the IJL.
-//
-// Context: Call to get the IJL version number.
-//
-// Returns: pointer to IJLibVersion struct
-//
-// Parameters: none
-//
-////////////////////////////////////////////////////////////////////////////
-*F*/
-
-IJLAPI(const IJLibVersion*, ijlGetLibVersion, (void));
-
-
-/*F*
-////////////////////////////////////////////////////////////////////////////
-// Name: ijlErrorStr
-//
-// Purpose: Gets the string to describe error code.
-//
-// Context: Is called to get descriptive string on arbitrary IJLERR code.
-//
-// Returns: pointer to string
-//
-// Parameters: IJLERR - IJL error code
-//
-////////////////////////////////////////////////////////////////////////////
-*F*/
-
-IJLAPI(const char*, ijlErrorStr, (IJLERR code));
-
-
-
-
-#if defined( __cplusplus )
-}
-#endif
-
-#endif /* __IJL_H__ */
diff --git a/src/terralib/jpeg/jpeg.h b/src/terralib/jpeg/jpeg.h
deleted file mode 100644
index 848e19b..0000000
--- a/src/terralib/jpeg/jpeg.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*Intel Corporation has released a number of extremely useful libraries and tools as part
-of their performance suite. These tools are designed to assist developers in taking
-advantage of their advanced processors.
-
-One excellent tool is the Intel Jpeg Library which provides a single small DLL which
-will rapidly compress and decompress Jpeg images, a common graphics file format.
-
-The following code snippet provides a static wrapper class for this library. The
-only thing you need besides this code snippet is IJL.H, IJL.LIB, IJL.DLL which can
-be found at the following URL.
-
-
-http://www-cs.intel.com/support/performancetools/libraries/ijl/index.htm
-
-When you see the quantity of code required just to compress or decompress a JPEG image
-using IJL I think you will see the value of the following simplified wrapper layer.
-
-John W. Ratcliff
-jratcliff at verant.com
-*/
-//*** The JPEG.H wrapper layer header file.
-
-#ifndef JPEG_H
-#define JPEG_H
-
-//############################################################################
-//## ##
-//## JPEG.H ##
-//## ##
-//## Wrapper class to compress or decompress a jpeg from a block of memory ##
-//## using the Intel Jpeg Library. ##
-//## OpenSourced 2/4/2000 by John W. Ratcliff ##
-//## ##
-//## No warranty expressed or implied. Released as part of the triangle ##
-//## throughput testbed project. ##
-//############################################################################
-//## ##
-//## Contact John W. Ratcliff at jratcliff at verant.com ##
-//############################################################################
-
-class Jpeg
-{
-public:
-
- static bool ReadFileParams(int &width,
- int &height,
- int &nchannels,
- char *name);
-
- static bool ReadFile(int width,
- int height,
- int nchannels,
- char *name,
- unsigned char *pixbuff);
-
- static void *ReadImage(int &width, // width of the image loaded.
- int &height, // height of the image loaded.
- int &bpp, // BYTES (not bits) PER PIXEL.
- const void *buffer, // memory address containing jpeg compressed data.
- int sizebytes); // size of jpeg compressed data.
-
-
- static void * Compress(const void *buffer, // address of image in memory
- int width, // width of image in pixels
- int height, // height of image in pixels.
- int bpp, // *BYTES* per pixel of image 1 or 3
- int &len, // returns length of compressed data
- int quality=75); // image quality as a percentage
-
- static bool WriteFile(const void *buffer, // address of image in memory
- int width, // width of image in pixels
- int height, // height of image in pixels.
- int bpp, // *BYTES* per pixel of image 1 or 3
- char *name,
- int quality=75); // image quality as a percentage
-
- static bool Compress(const void *source, // address of image in memory
- unsigned char *dest, // buffer to hold the compressed image
- int width, // width of image in pixels
- int height, // height of image in pixels
- int bpp, // *BYTES* per pixel of image 1 or 3
- unsigned long &len, // returns length of compressed data
- int quality=75); // image quality as a percentage
-
- static bool ReadImage(int &width, // width of the image loaded.
- int &height, // height of the image loaded.
- int &bpp, // BYTES (not bits) PER PIXEL.
- const void *buffer, // memory address containing jpeg compressed data.
- long sizebytes, // size of jpeg compressed data.
- unsigned char* dest); // buffer to hold the uncompressed image
-
-};
-
-#endif
-
diff --git a/src/terralib/kernel/Gra_algo.h b/src/terralib/kernel/Gra_algo.h
deleted file mode 100644
index 2372395..0000000
--- a/src/terralib/kernel/Gra_algo.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-// include/gra_algo.h
-#ifndef GRAPH_ALGORITHMS_H
-#define GRAPH_ALGORITHMS_H
-#include <dynpq.h>
-#include <graph.h>
-#include <limits>
-#include <iostream>
-
-namespace br_stl {
-
-template<class GraphType, class EdgeType>
-void Dijkstra(
- GraphType& Gr,
- std::vector<EdgeType>& Dist,
- std::vector<int>& Pred,
- int Start) {
- /* The algorithm proceeds in such a way that the distances are
- estimated and the estimates gradually improved. The distance to
- the starting point is known (0). For all other vertices, the
- worst possible estimate is entered.*/
-
- Dist = std::vector<EdgeType>(Gr.size(),
- TeMAXFLOAT); // as good as infinity
- Dist[Start] = (EdgeType)0;
-
- /* The predecessor vector too is initialized with `impossible'
- values. Subsequently, a dynamic priority queue is defined and
- initialized with the distance vector: */
-
- Pred = std::vector<int>(Gr.size(), -1);
- dynamic_priority_queue<EdgeType> Q(Dist);
-
- // In the next step, all vertices are extracted one by one from
- // the priority queue, and precisely in the order of the estimated
- // distance towards the starting vertex. Obviously, the starting
- //vertex is dealt with first. No vertex is looked at twice.
-
- int u;
- while(!Q.empty()) {
- u = Q.topIndex(); // extract vertex with minimum
- Q.pop();
-
- // Now, the distance estimates for all neighboring vertices of
- // u are updated. If the previous estimate of the distance
- // between the current neighbor of u and the starting vertex
- // (Dist[Neighbor]) is worse than the distance between vertex u
- // and the starting vertex (Dist[u]) plus the distance between
- // u and the neighboring vertex (dist), the estimate is
- // improved: this process is called relaxation. In this case,
- // the path from the starting vertex to the neighbor cannot be
- // longer than (Dist[u] + dist). In this case, u would have to
- // be regarded as predecessor of the neighbor.
-
- // improve estimates for all neighbors of u
- typename GraphType::Successor::const_iterator
- I = Gr[u].second.begin();
-
- while(I != Gr[u].second.end()) {
- int Neighbor = (*I).first;
- EdgeType dist = (*I).second;
-
- // relaxation
- if(Dist[Neighbor] > Dist[u] + dist) {
- // improve estimate
- Q.changeKeyAt(Neighbor, Dist[u] + dist);
- // u is predecessor of the neighbor
- Pred[Neighbor] = u;
- }
- ++I;
- }
- }
- return;
-}
-
-template<class GraphType>
-bool topoSort(
- GraphType& G,
- std::vector<int>& Result) {
- assert(G.isDirected()); // let's play this safe!
- int ResCounter = 0;
- Result = std::vector<int>(G.size(), -1);
-
- /* The vector Result takes the indices of the correspondingly
- distributed vertices. The counter ResCounter is the position in
- Result where the next entry belongs. */
-
- vector<int> PredecessorCount(G.size(), 0);
- int VerticesWithoutSuccessor = 0;
-
- /* For each vertex, the vector PredecessorCount counts how many
- predecessors it has. There are vertices without successors,
- whose number is kept in VerticesWithoutSuccessor. Furthermore,
- the algorithm remains stable if the precondition that a graph
- must not have cycles is violated. The variable
- VerticesWithoutSuccessor is used to recognize this situation
- (see below). */
-
- /*
- for(size_t iv = 0; iv < G.size(); ++iv) {
- if(G[iv].second.size() > 0) { // is predecessor
- typename GraphType::Successor::const_iterator I =
- G[iv].second.begin();
- while(I != G[iv].second.end())
- // update number of predecessors
- ++PredecessorCount[(*I++).first];
- }
- else { // Vertex is no predecessor, that is, without successor
- // an excessively high number of predecessors is used
- // for later recognition
- PredecessorCount[iv] = G.size(); // too many!
- ++VerticesWithoutSuccessor;
- }
- }
- */
-
- /* The dynamic priority queue is initialized with the vector of
- numbers of predecessors. At the beginning of the queue we find
- those vertices that have no predecessors and therefore are to
- be processed next. Only the vertices which are predecessors
- themselves, that is that have successors are processed. The
- subsequent loop is terminated when the queue only contains
- successor vertices which themselves are not predecessors. Their
- number of predecessors can never be 0 because further above
- they were initialized with too high a value.*/
-
- /*
- dynamic_priority_queue<int> Q(PredecessorCount);
-
- // process all predecessors
- while(Q.topKey() == 0) {
- // determine vertex with predecessor number 0
- int oV = Q.topIndex();
- Q.pop();
-
- Result[ResCounter++] = oV;
-
- // In order to ensure that this vertex without predecessors oV
- // is no longer considered in the next cycle, the number of
- // predecessors of all its successors is decreased by 1.
-
- typename GraphType::Successor::const_iterator
- I = G[oV].second.begin();
- while(I != G[oV].second.end()) {
- // decrease number of predecessors with
- // changeKeyAt()}. Do not change directly!
- int V = (*I).first;
- Q.changeKeyAt(V, PredecessorCount[V] -1);
- ++I;
- }
- }
-
- // Now, all vertices without successors are entered. As a
- // countercheck, the variable VerticesWithoutSuccessor is
- // decreased. If the queue contains too many vertices, an error
- // message is displayed.
-
- while(!Q.empty()) {
- Result[ResCounter++] = Q.topIndex();
- Q.pop();
- --VerticesWithoutSuccessor;
- }
-
- if(VerticesWithoutSuccessor < 0)
- std::cerr << "Error: graph contains a cycle!\n";
- return VerticesWithoutSuccessor == 0;
- */
- return false;
-}
-
-} // namespace br_stl
-#endif
-
diff --git a/src/terralib/kernel/TeAbstractFactory.h b/src/terralib/kernel/TeAbstractFactory.h
deleted file mode 100644
index ead298a..0000000
--- a/src/terralib/kernel/TeAbstractFactory.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeAbstractFactory.h
- \brief Implements a template for the Abstract Factory pattern
-*/
-#ifndef __TERRALIB_INTERNAL_NEW_FACTORY_H
-#define __TERRALIB_INTERNAL_NEW_FACTORY_H
-
-#include "TeDefines.h"
-#include <map>
-#include <string>
-
-using std::map;
-using std::string;
-
-//! Implements a template for the Abstract Factory pattern.
-/*
- This file implements a templated version of the Abstract Factory Pattern
- See: "Design Patterns - Elements of Reusable Object-Oriented Software", by Gamma et. al
- page 87.
- \author Gilberto Camara, L�bia Vinhas
-*/
-template <typename PRODUCT, // The product to be made
- typename PARAMS, // The parameter necessary to make the product
- typename PRODUCTIDTYPE=std::string> // The type used to identify the product
-class TeAbstractFactory
-{
-public:
-
- //! To link each product to its factory
- typedef map<PRODUCTIDTYPE, TeAbstractFactory<PRODUCT,PARAMS,PRODUCTIDTYPE>* > TeFactoryMap;
-
- //! Returns the single instance of the factory registration
- static TeFactoryMap& instance()
- {
- static TeFactoryMap Fmap_;
- return Fmap_;
- }
-
-protected:
-
- //! Builds a new product from a set of parameters (should be implemented by descendants)
- virtual PRODUCT* build(PARAMS* /*arg*/)
- {
- return PRODUCT::DefaultObject();
- }
-
- //! Builds a new product without parameters (should be implemented by descendants)
- virtual PRODUCT* build()
- {
- return PRODUCT::DefaultObject();
- }
-
-public:
- //! Factory Constructor
- /*
- \param prodId the identification of the product that the factory produces
- */
- TeAbstractFactory(PRODUCTIDTYPE prodId);
-
- //! Destructor
- virtual ~TeAbstractFactory() {}
-
- //! Virtual constructor: make the product from some arguments
- /*
- \param arg a pointer to an structure that contains the arguments
- necessary to build the product. The type of product has to be extracted
- from the arguments
- */
- static PRODUCT* make(PARAMS* arg);
-
- //! Virtual constructor: explictly identifies which product should be made
- static PRODUCT* make(PRODUCTIDTYPE prodId);
-
-private:
- PRODUCTIDTYPE productIdentification_;
-};
-
-// Factor Constructor
-template <typename PRODUCT, typename PARAMS, typename PRODUCTIDTYPE>
-TeAbstractFactory<PRODUCT,PARAMS,PRODUCTIDTYPE>::TeAbstractFactory(PRODUCTIDTYPE prodId):
- productIdentification_(prodId)
-{
- TeAbstractFactory<PRODUCT,PARAMS,PRODUCTIDTYPE>::instance()[prodId] = this;
-}
-
-//! Builds an object, based on the input parameters
-template <typename PRODUCT, typename PARAMS, typename PRODUCTIDTYPE>
-PRODUCT*
-TeAbstractFactory<PRODUCT,PARAMS,PRODUCTIDTYPE>::make(PRODUCTIDTYPE producId)
-{
- // try to find the name on the factory dictionary
- typename TeFactoryMap::iterator i = TeAbstractFactory<PRODUCT,PARAMS,PRODUCTIDTYPE>::instance().find(producId);
-
- // Not found ? return the Default Object
- if (i == TeAbstractFactory<PRODUCT,PARAMS,PRODUCTIDTYPE>::instance().end())
- return PRODUCT::DefaultObject();
-
- // Create an object, based on the input parameters
- return (*i).second->build();
-}
-
-//! Builds an object, based on the input parameters
-template <typename PRODUCT, typename PARAMS, typename PRODUCTIDTYPE>
-PRODUCT*
-TeAbstractFactory<PRODUCT,PARAMS,PRODUCTIDTYPE>::make(PARAMS* arg)
-{
- // If there are no arguments or factory identification return the default object
- if (!arg)
- return PRODUCT::DefaultObject();
-
- PRODUCTIDTYPE productId = arg->getProductId();
-
- // try to find the name on the factory dictionary
- typename TeFactoryMap::iterator i = TeAbstractFactory<PRODUCT,PARAMS,PRODUCTIDTYPE>::instance().find(productId);
-
- // Not found ? return the Default Object
- if (i == TeAbstractFactory<PRODUCT,PARAMS,PRODUCTIDTYPE>::instance().end())
- return PRODUCT::DefaultObject();
-
- // Create an object, based on the input parameters
- return (*i).second->build(arg);
-}
-#endif
-
diff --git a/src/terralib/kernel/TeAbstractTheme.cpp b/src/terralib/kernel/TeAbstractTheme.cpp
deleted file mode 100644
index 147767c..0000000
--- a/src/terralib/kernel/TeAbstractTheme.cpp
+++ /dev/null
@@ -1,1255 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeAbstractTheme.h"
-#include "TeVisual.h"
-#include "TeRasterTransform.h"
-
-extern int yyparse(string& sqlOut);
-extern int initParse(const string& strIn, TeDatabase* db);
-
-TeAbstractTheme::TeAbstractTheme(const string& name, TeViewNode* parent, const int& view, const int& id, const TeViewNodeType& nodeType)
- : TeViewNode(name, parent, view, id, nodeType),
- generateAttributeRest_(""),
- generateTemporalRest_(""),
- hasSpatialRes_(false),
- geomRest_(0),
- minScale_(0.0),
- maxScale_(0.0),
- visibleRep_(0),
- enableVisibility_(1),
- rasterVisual_(0),
- themeBox_(TeBox())
-{
- grouping_.groupMode_ = TeNoGrouping;
-
- //default legends
- TeVisual* visp = new TeVisual(TePOLYGONS);
- TeVisual* visl = new TeVisual(TeLINES);
- TeVisual* vispt = new TeVisual(TePOINTS);
- TeVisual* vist = new TeVisual(TeTEXT);
-
- TeColor color;
- color.init(100, 220, 220);
- visp->color(color);
- visl->color(color);
- vispt->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- visl->contourColor(color);
- vispt->contourColor(color);
-
- outOfCollectionLegend_.setVisual(visp->copy(), TePOLYGONS);
- outOfCollectionLegend_.setVisual(visl->copy(), TeLINES);
- outOfCollectionLegend_.setVisual(vispt->copy(), TePOINTS);
- outOfCollectionLegend_.setVisual(vist->copy(), TeTEXT);
-
- color.init(220, 100, 220);
- visp->color(color);
- visl->color(color);
- vispt->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- visl->contourColor(color);
- vispt->contourColor(color);
-
- withoutDataConnectionLegend_.setVisual(visp->copy(), TePOLYGONS);
- withoutDataConnectionLegend_.setVisual(visl->copy(), TeLINES);
- withoutDataConnectionLegend_.setVisual(vispt->copy(), TePOINTS);
- withoutDataConnectionLegend_.setVisual(vist->copy(), TeTEXT);
-
- color.init(220, 0, 0);
- visp->color(color);
- color.init(0, 220, 220);
- visl->color(color);
- color.init(220, 90, 180);
- vispt->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- visl->contourColor(color);
- vispt->contourColor(color);
- color.init(0, 0, 0);
- vist->color(color);
-
- defaultLegend_.setVisual(visp->copy(), TePOLYGONS);
- defaultLegend_.setVisual(visl->copy(), TeLINES);
- defaultLegend_.setVisual(vispt->copy(), TePOINTS);
- defaultLegend_.setVisual(vist->copy(), TeTEXT);
-
- color.init(80, 240, 100);
- visp->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- pointingLegend_.setVisual(visp->copy(), TePOLYGONS);
- pointingLegend_.setVisual(visl->copy(), TeLINES);
- pointingLegend_.setVisual(vispt->copy(), TePOINTS);
- pointingLegend_.setVisual(vist->copy(), TeTEXT);
-
- color.init(210, 210, 0);
- visp->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- queryLegend_.setVisual(visp->copy(), TePOLYGONS);
- queryLegend_.setVisual(visl->copy(), TeLINES);
- queryLegend_.setVisual(vispt->copy(), TePOINTS);
- queryLegend_.setVisual(vist->copy(), TeTEXT);
-
- color.init(255, 255, 0);
- visp->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- queryAndPointingLegend_.setVisual(visp->copy(), TePOLYGONS);
- queryAndPointingLegend_.setVisual(visl->copy(), TeLINES);
- queryAndPointingLegend_.setVisual(vispt->copy(), TePOINTS);
- queryAndPointingLegend_.setVisual(vist->copy(), TeTEXT);
-
- delete visp;
- delete visl;
- delete vispt;
- delete vist;
-}
-
-TeAbstractTheme::TeAbstractTheme(const TeViewNodeParams& params) :
- TeViewNode(params),
- generateAttributeRest_(""),
- generateTemporalRest_(""),
- hasSpatialRes_(false),
- geomRest_(0),
- minScale_(0.0),
- maxScale_(0.0),
- visibleRep_(0),
- enableVisibility_(1),
- rasterVisual_(0),
- themeBox_(TeBox())
-{
- grouping_.groupMode_ = TeNoGrouping;
- //default legends
- TeVisual* visp = new TeVisual(TePOLYGONS);
- TeVisual* visl = new TeVisual(TeLINES);
- TeVisual* vispt = new TeVisual(TePOINTS);
- TeVisual* vist = new TeVisual(TeTEXT);
- TeColor color;
- color.init(100, 220, 220);
- visp->color(color);
- visl->color(color);
- vispt->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- visl->contourColor(color);
- vispt->contourColor(color);
-
- outOfCollectionLegend_.setVisual(visp->copy(), TePOLYGONS);
- outOfCollectionLegend_.setVisual(visl->copy(), TeLINES);
- outOfCollectionLegend_.setVisual(vispt->copy(), TePOINTS);
- outOfCollectionLegend_.setVisual(vist->copy(), TeTEXT);
-
- color.init(220, 100, 220);
- visp->color(color);
- visl->color(color);
- vispt->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- visl->contourColor(color);
- vispt->contourColor(color);
-
- withoutDataConnectionLegend_.setVisual(visp->copy(), TePOLYGONS);
- withoutDataConnectionLegend_.setVisual(visl->copy(), TeLINES);
- withoutDataConnectionLegend_.setVisual(vispt->copy(), TePOINTS);
- withoutDataConnectionLegend_.setVisual(vist->copy(), TeTEXT);
-
- color.init(220, 0, 0);
- visp->color(color);
- color.init(0, 220, 220);
- visl->color(color);
- color.init(220, 90, 180);
- vispt->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- visl->contourColor(color);
- vispt->contourColor(color);
- color.init(0, 0, 0);
- vist->color(color);
-
- defaultLegend_.setVisual(visp->copy(), TePOLYGONS);
- defaultLegend_.setVisual(visl->copy(), TeLINES);
- defaultLegend_.setVisual(vispt->copy(), TePOINTS);
- defaultLegend_.setVisual(vist->copy(), TeTEXT);
-
- color.init(80, 240, 100);
- visp->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- pointingLegend_.setVisual(visp->copy(), TePOLYGONS);
- pointingLegend_.setVisual(visl->copy(), TeLINES);
- pointingLegend_.setVisual(vispt->copy(), TePOINTS);
- pointingLegend_.setVisual(vist->copy(), TeTEXT);
-
- color.init(210, 210, 0);
- visp->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- queryLegend_.setVisual(visp->copy(), TePOLYGONS);
- queryLegend_.setVisual(visl->copy(), TeLINES);
- queryLegend_.setVisual(vispt->copy(), TePOINTS);
- queryLegend_.setVisual(vist->copy(), TeTEXT);
-
- color.init(255, 255, 0);
- visp->color(color);
- color.init(100, 100, 100);
- visp->contourColor(color);
- queryAndPointingLegend_.setVisual(visp->copy(), TePOLYGONS);
- queryAndPointingLegend_.setVisual(visl->copy(), TeLINES);
- queryAndPointingLegend_.setVisual(vispt->copy(), TePOINTS);
- queryAndPointingLegend_.setVisual(vist->copy(), TeTEXT);
-
- delete visp;
- delete visl;
- delete vispt;
- delete vist;
-}
-
-//! Copy constructor
-TeAbstractTheme::TeAbstractTheme (const TeAbstractTheme& other) :
- TeViewNode(other.viewNodeParams_)
-{
- generateAttributeRest_ = other.generateAttributeRest_;
- generateTemporalRest_ = other.generateTemporalRest_;
- generateSpatialRest_ = other.generateSpatialRest_;
- spatialRelation_ = other.spatialRelation_;
- hasSpatialRes_ = other.hasSpatialRes_;
- boxRest_ = other.boxRest_;
- geomRest_ = other.geomRest_;
- geomRepRest_ = other.geomRepRest_;
- minScale_ = other.minScale_;
- maxScale_ = other.maxScale_;
- visibleRep_ = other.visibleRep_;
- enableVisibility_ = other.enableVisibility_;
-
- grouping_ = other.grouping_;
-
- cleanLegend();
- legend_.resize(other.legend_.size());
- copy(other.legend_.begin(),other.legend_.end(),legend_.begin());
- outOfCollectionLegend_ = other.outOfCollectionLegend_;
- withoutDataConnectionLegend_ = other.withoutDataConnectionLegend_;
- defaultLegend_ = other.defaultLegend_;
- pointingLegend_ = other.pointingLegend_;
- queryLegend_ = other.queryLegend_;
- queryAndPointingLegend_ = other.queryAndPointingLegend_;
-
- objectSet_ = other.objectSet_;
- numLayerObjects_ = other.numLayerObjects_;
- itemStatusMap_ = other.itemStatusMap_;
- objStatusMap_ = other.objStatusMap_;
- rasterVisual_ = 0;
- if(other.rasterVisual_)
- {
- rasterVisual_ = new TeRasterTransform();
- (*rasterVisual_) = (*other.rasterVisual_);
- }
- themeBox_ = other.themeBox_;
-}
-
-//! Destructor
-TeAbstractTheme::~TeAbstractTheme ()
-{
- if (rasterVisual_)
- delete rasterVisual_;
- generateAttributeRest_.clear();
- generateTemporalRest_.clear();
- generateSpatialRest_.clear();
- cleanLegend();
- outOfCollectionLegend_.clear();
- withoutDataConnectionLegend_.clear();
- defaultLegend_.clear();
- pointingLegend_.clear();
- queryLegend_.clear();
- queryAndPointingLegend_.clear();
-}
-
-TeAbstractTheme&
-TeAbstractTheme::operator= (const TeAbstractTheme& other)
-{
- if ( this != &other )
- {
- viewNodeParams_ = other.viewNodeParams_;
-
- generateAttributeRest_ = other.generateAttributeRest_;
- generateTemporalRest_ = other.generateTemporalRest_;
- generateSpatialRest_ = other.generateSpatialRest_;
- spatialRelation_ = other.spatialRelation_;
- hasSpatialRes_ = other.hasSpatialRes_;
- boxRest_ = other.boxRest_;
- geomRest_ = other.geomRest_;
- geomRepRest_ = other.geomRepRest_;
- minScale_ = other.minScale_;
- maxScale_ = other.maxScale_;
- visibleRep_ = other.visibleRep_;
- enableVisibility_ = other.enableVisibility_;
-
- grouping_ = other.grouping_;
-
- cleanLegend();
- legend_.resize(other.legend_.size());
- copy(other.legend_.begin(),other.legend_.end(),legend_.begin());
- outOfCollectionLegend_ = other.outOfCollectionLegend_;
- withoutDataConnectionLegend_ = other.withoutDataConnectionLegend_;
- defaultLegend_ = other.defaultLegend_;
- pointingLegend_ = other.pointingLegend_;
- queryLegend_ = other.queryLegend_;
- queryAndPointingLegend_ = other.queryAndPointingLegend_;
-
- objectSet_ = other.objectSet_;
- numLayerObjects_ = other.numLayerObjects_;
- itemStatusMap_ = other.itemStatusMap_;
- objStatusMap_ = other.objStatusMap_;
-
- if(rasterVisual_)
- delete rasterVisual_;
- rasterVisual_ = 0;
- if(other.rasterVisual_)
- {
- rasterVisual_ = new TeRasterTransform();
- (*rasterVisual_) = (*other.rasterVisual_);
- }
- themeBox_ = other.themeBox_;
- }
- return *this;
-}
-
-int TeAbstractTheme::visibleGeoRep()
-{
- return (visibleRep_ & ~0x40000000 & ~0x80000000 & ~0x20000000);
-}
-
-void TeAbstractTheme::removeRasterVisual()
-{
- if (rasterVisual_)
- {
- delete rasterVisual_;
- rasterVisual_ = 0;
- }
-}
-
-void TeAbstractTheme::cleanLegend()
-{
- while (legend_.size())
- {
- legend_[0].clear();
- legend_.erase(legend_.begin());
- }
- legend_.clear();
-}
-
-void
-TeAbstractTheme::setSpatialRest(TeBox& box, TeGeomRep rep, TeSpatialRelation relation)
-{
- hasSpatialRes_ = true;
- boxRest_ = box;
- spatialRelation_ = relation;
- geomRepRest_ = rep;
- geomRest_ = 0;
-}
-
-void
-TeAbstractTheme::setSpatialRest(TeGeometry* geom, TeGeomRep rep, TeSpatialRelation relation)
-{
- hasSpatialRes_ = true;
- geomRest_ = geom;
- spatialRelation_ = relation;
- geomRepRest_ = rep;
- boxRest_ = TeBox();
-}
-
-void TeAbstractTheme::legend (TeLegendEntry& leg)
-{
- if(leg.group() == -6) // queried and pointed objects visual
- queryAndPointingLegend_ = leg;
- else if(leg.group() == -5) // queried objects visual
- queryLegend_ = leg;
- else if (leg.group() == -4)
- pointingLegend_ = leg;
- else if (leg.group() == -3)
- defaultLegend_ = leg;
- else if (leg.group() == -2)
- withoutDataConnectionLegend_ = leg;
- else if (leg.group() == -1)
- outOfCollectionLegend_ = leg;
- else if (leg.group() > -1)
- legend_.push_back (leg);
-}
-
-void
-TeAbstractTheme::resetGrouping ()
-{
- if((grouping_.groupMode_ == TeRasterSlicing) && rasterVisual_)
- this->removeRasterVisual();
-
- grouping_.groupMode_ = TeNoGrouping;
- legend_.clear();
- return;
-}
-
-bool
-TeAbstractTheme::buildGrouping(const TeGrouping& g, vector<TeSlice>& slices)
-{
- grouping_ = g;
- legend_.clear();
-
- for(unsigned int j=0; j<slices.size(); j++)
- {
- TeLegendEntry legend(slices[j]);
- legend.group(j);
- legend.theme(id());
- legend_.push_back(legend);
- }
- return true;
-}
-
-bool
-TeAbstractTheme::setGroupingVisual(int n, TeVisual* visual, TeGeomRep rep)
-{
- if( (n > grouping_.groupNumSlices_) ||
- ((int)legend_.size() < n) ||
- (legend_.empty()) )
- return false;
- legend_[(n-1)].setVisual (visual->copy(), rep);
- return true;
-}
-
-bool
-TeAbstractTheme::setGroupingVisual(int n, TeGeomRepVisualMap& vismap)
-{
- if( (n > grouping_.groupNumSlices_) ||
- ((int)legend_.size() < n) ||
- (legend_.empty()) )
- return false;
-
- TeGeomRepVisualMap::iterator it = vismap.begin();
- while (it != vismap.end())
- {
- legend_[(n-1)].setVisual(it->second->copy(),it->first);
- ++it;
- }
- return true;
-}
-
-TeSliceVector
-TeAbstractTheme::getSlices()
-{
- TeSliceVector sliceVec;
- for(unsigned int x=0; x<legend_.size(); ++x)
- {
- TeSlice slice = legend_[x].slice();
- sliceVec.push_back (slice);
- }
- return sliceVec;
-}
-
-
-
-void TeAbstractTheme::createRasterVisual(TeRaster* rst)
-{
- if (rasterVisual_)
- delete rasterVisual_;
-
- if (!rst)
- return;
-
- rasterVisual_ = new TeRasterTransform();
-
- if (rst->params().photometric_[0] == TeRasterParams::TePallete) // raster palette -> uses its palette
- {
- rasterVisual_->setTransfFunction(&TeRasterTransform::Pallete2ThreeBand);
- rasterVisual_->setLutSize(rst->params().lutr_.size());
- return;
- }
-
- if (visibleRep_ & 0x40000000 && // sliced raster -> generate the
- grouping_.groupMode_ == TeRasterSlicing) // appropriate palette
- {
- int band = atoi(grouping_.groupAttribute_.name_.c_str());
- rasterVisual_->setSrcBand(band);
- if (rst->params().dataType_[band] != TeUNSIGNEDCHAR)
- rasterVisual_->generateLUT(legend_, 1024, defaultLegend_.visual(TePOLYGONS)->color());
- else
- rasterVisual_->generateLUT(legend_, 256, defaultLegend_.visual(TePOLYGONS)->color());
- rasterVisual_->setTransfFunction(&TeRasterTransform::LUT2ThreeBand);
- return;
- }
-
- if (rst->params().dataType_[0] != TeUNSIGNEDCHAR) // non unsigned char -> generate linear transformation
- rasterVisual_->setLinearTransfParameters(rst->params().vmin_[0],rst->params().vmax_[0], 0, 255);
-
- if (rst->params().nBands() == 1)
- rasterVisual_->setTransfFunction(&TeRasterTransform::Mono2ThreeBand);
- else if (rst->params().nBands() == 3)
- rasterVisual_->setTransfFunction(&TeRasterTransform::ThreeBand2RGB);
- else
- rasterVisual_->setTransfFunction(&TeRasterTransform::Band2Band);
-}
-
-void TeAbstractTheme::setParent (TeViewNode* )
-{
- viewNodeParams_.myParent_ = 0;
- viewNodeParams_.myParentId_ = 0;
-}
-
-void TeAbstractTheme::setStatus(vector<string>& oidVec, vector<string>& itemVec, int status)
-{
- vector<string>::iterator it;
-
- if(status == 0)
- {
- for(it=oidVec.begin(); it!=oidVec.end();++it)
- {
- string s = *it;
- if(objStatusMap_.find(s) != objStatusMap_.end())
- objStatusMap_.erase(s);
- }
- for(it=itemVec.begin(); it!=itemVec.end();++it)
- {
- string s = *it;
- if(itemStatusMap_.find(s) != itemStatusMap_.end())
- itemStatusMap_.erase(s);
- }
- }
- else
- {
- for(it=oidVec.begin(); it!=oidVec.end();++it)
- {
- string s = *it;
- objStatusMap_[s] = status;
- }
- for(it=itemVec.begin(); it!=itemVec.end();++it)
- {
- string s = *it;
- itemStatusMap_[s] = status;
- }
- }
-}
-
-void TeAbstractTheme::setStatusForObjectToggled(string oid)
-{
- string uid;
-
- int& oidStatus = objStatusMap_[oid];
- if (oidStatus == TeDEFAULT)
- oidStatus = TePOINTED;
- else if (oidStatus == TePOINTED)
- oidStatus = TeDEFAULT;
- else if (oidStatus == TeQUERIED)
- oidStatus = TePOINTED_QUERIED;
- else if (oidStatus == TePOINTED_QUERIED)
- oidStatus = TeQUERIED;
-
- set<string> oidSet;
- oidSet.insert(oid);
- vector<string> uidVec = getItemVector(oidSet);
- for (unsigned int i = 0; i < uidVec.size(); ++i)
- {
- uid = uidVec[i];
- int& uidStatus = itemStatusMap_[uidVec[i]];
- if (uidStatus == TeDEFAULT)
- {
- if (oidStatus == TePOINTED || oidStatus == TePOINTED_QUERIED)
- uidStatus = TePOINTED;
- }
- else if (uidStatus == TePOINTED)
- {
- if (oidStatus == TeDEFAULT || oidStatus == TeQUERIED)
- itemStatusMap_.erase(uid);
- }
- else if (uidStatus == TeQUERIED)
- {
- if (oidStatus == TePOINTED || oidStatus == TePOINTED_QUERIED)
- uidStatus = TePOINTED_QUERIED;
- }
- else if (uidStatus == TePOINTED_QUERIED)
- {
- if (oidStatus == TeDEFAULT || oidStatus == TeQUERIED)
- uidStatus = TeQUERIED;
- }
- }
-
- // Save the status id of the object
- if (oidStatus == TeDEFAULT)
- objStatusMap_.erase(oid);
-}
-
-void TeAbstractTheme::setStatusForItemsToggled(set<string>& oidSet, vector<string>& uidVec)
-{
- unsigned int i;
- int oidStatus;
- string oid, uid;
- set<string>::iterator it;
-
- // Set the new status of the uids
- for (i = 0; i < uidVec.size(); ++i)
- {
- uid = uidVec[i];
- if (itemStatusMap_[uid] == TeDEFAULT)
- itemStatusMap_[uid] = TePOINTED;
- else if (itemStatusMap_[uid] == TePOINTED)
- itemStatusMap_.erase(uid);
- else if (itemStatusMap_[uid] == TeQUERIED)
- itemStatusMap_[uid] = TePOINTED_QUERIED;
- else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
- itemStatusMap_[uid] = TeQUERIED;
- }
-
-
- // Set the new status of the oids
- for (it = oidSet.begin(); it != oidSet.end(); ++it)
- {
- oid = *it;
- oidStatus = 0;
- set<string> objSet;
- objSet.insert(oid);
- vector<string> uidVec = getItemVector(objSet);
- for (i = 0; i < uidVec.size(); ++i)
- {
- uid = uidVec[i];
- if (itemStatusMap_[uid] == TePOINTED_QUERIED)
- {
- oidStatus = TePOINTED_QUERIED;
- break;
- }
- oidStatus = MAX(oidStatus, itemStatusMap_[uid]);
- if (itemStatusMap_[uid] == TeDEFAULT)
- itemStatusMap_.erase(uid);
- }
-
- if (oidStatus == 0)
- objStatusMap_.erase(oid);
- else
- objStatusMap_[oid] = oidStatus;
- }
-}
-
-void TeAbstractTheme::setStatusForNewItemsQueried(set<string>& oidSet, vector<string>& uidVec)
-{
- unsigned int i;
- string oid, uid;
- vector<string> prevOidQVec; // previous oids queried
- vector<string> notInOidSetVec; // oid is not in oidSet
- vector<string> defaultVec; // vector with oids or uids to be set as default
- map<string, int>::iterator mapIt;
- set<string>::iterator setIt;
-
- // Get the previous oids queried
- for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
- {
- oid = mapIt->first;
- if (objStatusMap_[oid] == TeQUERIED || objStatusMap_[oid] == TePOINTED_QUERIED)
- prevOidQVec.push_back(mapIt->first);
- }
-
- // Check if the previous oids queried are in the oidSet; in positive case, remove
- // them from the oidSet; in negative case, put them in the vector notInOidSetVec
- for (i = 0; i < prevOidQVec.size(); ++i)
- {
- oid = prevOidQVec[i];
- if (oidSet.find(oid) != oidSet.end())
- oidSet.erase(oid); // object is in the input oidSet
- else
- notInOidSetVec.push_back(oid); // object is not in the input oidSet
- }
-
- // For the objects in oidSet, set the queried status for them
- for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
- {
- oid = *setIt;
- if (objStatusMap_[oid] == TeDEFAULT)
- objStatusMap_[oid] = TeQUERIED;
- else if (objStatusMap_[oid] == TePOINTED)
- objStatusMap_[oid] = TePOINTED_QUERIED;
- }
-
- // For the objects not in oidSet, insert it in oidSet, and remove their queried status
- for (i = 0; i < notInOidSetVec.size(); ++i)
- {
- oid = notInOidSetVec[i];
- if (objStatusMap_[oid] == TeQUERIED)
- defaultVec.push_back(oid);
- else if (objStatusMap_[oid] == TePOINTED_QUERIED)
- objStatusMap_[oid] = TePOINTED;
-
- oidSet.insert(oid);
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- objStatusMap_.erase(defaultVec[i]);
-
- // Remove the queried status for the uids that were previously queried
- defaultVec.clear();
- for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
- {
- uid = mapIt->first;
- if (itemStatusMap_[uid] == TeQUERIED)
- defaultVec.push_back(uid);
- else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
- itemStatusMap_[uid] = TePOINTED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- itemStatusMap_.erase(defaultVec[i]);
-
- // Set the queried status for the input uidVec
- for (i = 0; i < uidVec.size(); ++i)
- {
- uid = uidVec[i];
- if (itemStatusMap_[uid] == TeDEFAULT)
- itemStatusMap_[uid] = TeQUERIED;
- else if (itemStatusMap_[uid] == TePOINTED)
- itemStatusMap_[uid] = TePOINTED_QUERIED;
- }
-}
-
-void TeAbstractTheme::setStatusForNewObjectsPointed(set<string>& oidSet)
-{
- unsigned int i;
- string oid, uid;
- set<string> prevOidPointedSet; // previous oids pointed
- set<string> objInInputOidSet; // set containing objects in oidSet
- set<string> objNotInInputOidSet; // set containing objects not in oidSet
- vector<string> defaultVec; // vector with oids or uids to be set as default
- vector<string> uidVec; // vector of uids
- map<string, int>::iterator mapIt;
- set<string>::iterator setIt;
-
- // Get the previous oids pointed
- for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
- {
- oid = mapIt->first;
- if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TePOINTED_QUERIED)
- prevOidPointedSet.insert(mapIt->first);
- }
-
- // If the set of objects is empty, remove the pointed status of the previous oids and uids
- if (oidSet.empty())
- {
- for (setIt = prevOidPointedSet.begin(); setIt != prevOidPointedSet.end(); ++setIt)
- {
- oid = *setIt;
- if (objStatusMap_[oid] == TePOINTED)
- defaultVec.push_back(oid);
- else if (objStatusMap_[oid] == TePOINTED_QUERIED)
- objStatusMap_[oid] = TeQUERIED;
-
- oidSet.insert(oid);
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- objStatusMap_.erase(defaultVec[i]);
-
- defaultVec.clear();
-// uidVec = getUidVec(prevOidPointedVec.begin(), prevOidPointedVec.end(), this);
- uidVec = getItemVector(prevOidPointedSet);
- for (i = 0; i < uidVec.size(); ++i)
- {
- uid = uidVec[i];
- if (itemStatusMap_[uid] == TePOINTED)
- defaultVec.push_back(uid);
- else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
- itemStatusMap_[uid] = TeQUERIED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- itemStatusMap_.erase(defaultVec[i]);
-
- return;
- }
-
- // Check if the previous oids pointed are in the oidSet; in positive case, put
- // them in objInOidSetVec; in negative case, put them in the objNotInOidSetVec
- for (setIt = prevOidPointedSet.begin(); setIt != prevOidPointedSet.end(); ++setIt)
- {
- oid = *setIt;
- if (oidSet.find(oid) != oidSet.end())
- objInInputOidSet.insert(oid); // object is in the input oidSet
- else
- objNotInInputOidSet.insert(oid); // object is not in the input oidSet
- }
-
- // For the objects in oidSet, set the pointed status for them
- for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
- {
- oid = *setIt;
- if (objStatusMap_[oid] == TeDEFAULT)
- objStatusMap_[oid] = TePOINTED;
- else if (objStatusMap_[oid] == TeQUERIED)
- objStatusMap_[oid] = TePOINTED_QUERIED;
- }
-
- // For the objects not in oidSet, remove their pointed status
- defaultVec.clear();
- for (setIt = objNotInInputOidSet.begin(); setIt != objNotInInputOidSet.end(); ++setIt)
- {
- oid = *setIt;
- if (objStatusMap_[oid] == TePOINTED)
- defaultVec.push_back(oid);
- else if (objStatusMap_[oid] == TePOINTED_QUERIED)
- objStatusMap_[oid] = TeQUERIED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- objStatusMap_.erase(defaultVec[i]);
-
- // For the objects in oidSet, set the pointed status for their uids
- uidVec = getItemVector(oidSet);
- for (i = 0; i < uidVec.size(); ++i)
- {
- uid = uidVec[i];
- if (itemStatusMap_[uid] == TeDEFAULT)
- itemStatusMap_[uid] = TePOINTED;
- else if (itemStatusMap_[uid] == TeQUERIED)
- itemStatusMap_[uid] = TePOINTED_QUERIED;
- }
-
- // For the objects not in oidSet, remove the pointed status for their uids
- defaultVec.clear();
- uidVec = getItemVector(objNotInInputOidSet);
- for (i = 0; i < uidVec.size(); ++i)
- {
- uid = uidVec[i];
- if (itemStatusMap_[uid] == TePOINTED)
- defaultVec.push_back(uid);
- else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
- itemStatusMap_[uid] = TeQUERIED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- itemStatusMap_.erase(defaultVec[i]);
-
- // Insert in the oidSet the objects that are not in the input oidSet
- for (setIt = objNotInInputOidSet.begin(); setIt != objNotInInputOidSet.end(); ++setIt)
- oidSet.insert(*setIt);
-
- // Remove from the oidSet the objects that were in the input oidSet
- for (setIt = objInInputOidSet.begin(); setIt != objInInputOidSet.end(); ++setIt)
- oidSet.erase(*setIt);
-}
-
-void TeAbstractTheme::setStatusForNewItemsPointed(vector<string>& itemVec)
-{
- unsigned int i;
- string oid, item;
- map<string, int>::iterator mapIt;
- vector<string> defaultVec;
-
- //-----------------------------------------------------------------------
- // Set the pointing status for the input items
- //-----------------------------------------------------------------------
-
- // Remove the pointing status for all the items
- for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
- {
- item = mapIt->first;
- if (itemStatusMap_[item] == TePOINTED)
- defaultVec.push_back(item);
- else if (objStatusMap_[item] == TePOINTED_QUERIED)
- itemStatusMap_[item] = TeQUERIED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- itemStatusMap_.erase(defaultVec[i]);
-
- for (i = 0; i < itemVec.size(); ++i)
- {
- item = itemVec[i];
- if (itemStatusMap_[item] == TeDEFAULT)
- itemStatusMap_[item] = TePOINTED;
- else if (itemStatusMap_[item] == TeQUERIED)
- itemStatusMap_[item] = TePOINTED_QUERIED;
- }
-
- //-----------------------------------------------------------------------
- // Set the pointing status for the objects associated to the input items
- //-----------------------------------------------------------------------
-
- // Remove the pointing status for all the objects
- defaultVec.clear();
- for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
- {
- oid = mapIt->first;
- if (objStatusMap_[oid] == TePOINTED)
- defaultVec.push_back(oid);
- else if (objStatusMap_[oid] == TePOINTED_QUERIED)
- objStatusMap_[oid] = TeQUERIED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- objStatusMap_.erase(defaultVec[i]);
-
- // Set the pointing status for the objects associated to the input items
- set<string> oidSet = getObjects(itemVec);
- set<string>::iterator setIt;
- for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
- {
- oid = *setIt;
- if (objStatusMap_[oid] == TeDEFAULT)
- objStatusMap_[oid] = TePOINTED;
- else if (objStatusMap_[oid] == TeQUERIED)
- objStatusMap_[oid] = TePOINTED_QUERIED;
- }
-}
-
-
-
-void TeAbstractTheme::setStatusForObjectsAddedByPointing(set<string>& oidSet)
-{
- if (oidSet.empty())
- return;
-
- unsigned int i;
- string oid, uid;
- vector<string> prevOidPointedVec; // previous oids pointed
- vector<string> uidVec; // vector of uids
- map<string, int>::iterator mapIt;
- set<string>::iterator setIt;
-
- // Get the previous oids pointed
- for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
- {
- oid = mapIt->first;
- if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TePOINTED_QUERIED)
- prevOidPointedVec.push_back(mapIt->first);
- }
-
- // If there is any object in the oidSet that is already in the previous oids pointed,
- // remove it from the oidSet
- for (i = 0; i < prevOidPointedVec.size(); ++i)
- {
- oid = prevOidPointedVec[i];
- if (oidSet.find(prevOidPointedVec[i]) != oidSet.end())
- oidSet.erase(oid);
- }
-
- // Set the pointed status for the objects added by pointing
- for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
- {
- oid = *setIt;
- if (objStatusMap_[oid] == TeDEFAULT)
- objStatusMap_[oid] = TePOINTED;
- if (objStatusMap_[oid] == TeQUERIED)
- objStatusMap_[oid] = TePOINTED_QUERIED;
- }
-
- // Set the pointed status for the uids of the objects added by pointing
- uidVec = getItemVector(oidSet);
- for (i = 0; i < uidVec.size(); ++i)
- {
- uid = uidVec[i];
- if (itemStatusMap_[uid] == TeDEFAULT)
- itemStatusMap_[uid] = TePOINTED;
- else if (itemStatusMap_[uid] == TeQUERIED)
- itemStatusMap_[uid] = TePOINTED_QUERIED;
- }
-}
-
-void TeAbstractTheme::setStatusForItemsAddedByPointing(vector<string>& itemVec)
-{
- unsigned int i;
- string oid, item;
-
- //-----------------------------------------------------------------------
- // Set the pointing status for the input items
- //-----------------------------------------------------------------------
- for (i = 0; i < itemVec.size(); ++i)
- {
- item = itemVec[i];
- if (itemStatusMap_[item] == TeDEFAULT)
- itemStatusMap_[item] = TePOINTED;
- else if (objStatusMap_[item] == TeQUERIED)
- itemStatusMap_[item] = TePOINTED_QUERIED;
-
- }
-
- //-----------------------------------------------------------------------
- // Set the pointing status for the objects associated to the input items
- //-----------------------------------------------------------------------
- set<string> oidSet = getObjects(itemVec);
- set<string>::iterator setIt;
- for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
- {
- oid = *setIt;
- if (objStatusMap_[oid] == TeDEFAULT)
- objStatusMap_[oid] = TePOINTED;
- else if (objStatusMap_[oid] == TeQUERIED)
- objStatusMap_[oid] = TePOINTED_QUERIED;
- }
-}
-
-
-void TeAbstractTheme::setStatusForItemsAddedByQuerying(set<string>& oidSet, vector<string>& uidVec)
-{
- unsigned int i;
- string oid, uid;
- set<string>::iterator setIt;
-
- // Set the status for the oids in oidSet as "queried"
- for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
- {
- oid = *setIt;
- if (objStatusMap_[oid] == TeDEFAULT)
- objStatusMap_[oid] = TeQUERIED;
- else if (objStatusMap_[oid] == TePOINTED)
- objStatusMap_[oid] = TePOINTED_QUERIED;
- }
-
- // Set the new status for the uidVec
- for (i = 0; i < uidVec.size(); ++i)
- {
- uid = uidVec[i];
- if (itemStatusMap_[uid] == TeDEFAULT)
- itemStatusMap_[uid] = TeQUERIED;
- else if (itemStatusMap_[uid] == TePOINTED)
- itemStatusMap_[uid] = TePOINTED_QUERIED;
- }
-}
-
-
-void TeAbstractTheme::setStatusForItemsFilteredByQuerying(set<string>& oidSet, vector<string>& uidVec)
-{
- unsigned int i;
- string oid, uid;
- vector<string> prevOidQVec; // previous oids queried
- vector<string> notInOidSetVec; // oid is not in oidSet
- vector<string> defaultVec; // vector with oids or uids to be set as default
- map<string, int>::iterator mapIt;
- set<string>::iterator setIt;
-
- // Get the previous oids queried
- for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
- {
- oid = mapIt->first;
- if (objStatusMap_[oid] == TeQUERIED || objStatusMap_[oid] == TePOINTED_QUERIED)
- prevOidQVec.push_back(mapIt->first);
- }
-
- // Check if the previous oids queried are in the oidSet; in positive case, remove
- // them from the oidSet; in negative case, put them in the vector notInOidSetVec
- for (i = 0; i < prevOidQVec.size(); ++i)
- {
- oid = prevOidQVec[i];
- if (oidSet.find(oid) != oidSet.end())
- oidSet.erase(oid); // object is in the input oidSet
- else
- notInOidSetVec.push_back(oid); // object is not in the input oidSet
- }
-
- // For the objects not in oidSet, insert it in oidSet, and remove their queried status
- for (i = 0; i < notInOidSetVec.size(); ++i)
- {
- oid = notInOidSetVec[i];
- if (objStatusMap_[oid] == TeQUERIED)
- defaultVec.push_back(oid);
- else if (objStatusMap_[oid] == TePOINTED_QUERIED)
- objStatusMap_[oid] = TePOINTED;
-
- oidSet.insert(oid);
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- objStatusMap_.erase(defaultVec[i]);
-
- // Remove the queried status for the uids that were previously queried
- defaultVec.clear();
- for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
- {
- uid = mapIt->first;
- if (itemStatusMap_[uid] == TeQUERIED)
- defaultVec.push_back(uid);
- else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
- itemStatusMap_[uid] = TePOINTED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- itemStatusMap_.erase(defaultVec[i]);
-
- // Set the queried status for the input uidVec
- for (i = 0; i < uidVec.size(); ++i)
- {
- uid = uidVec[i];
- if (itemStatusMap_[uid] == TeDEFAULT)
- itemStatusMap_[uid] = TeQUERIED;
- else if (itemStatusMap_[uid] == TePOINTED)
- itemStatusMap_[uid] = TePOINTED_QUERIED;
- }
-}
-
-void TeAbstractTheme::removePointingColor()
-{
- unsigned int i;
- string oid, uid;
- vector<string> defaultVec;
- map<string, int>::iterator mapIt;
-
- // Remove the pointed status for the objects
- for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
- {
- oid = mapIt->first;
- if (objStatusMap_[oid] == TePOINTED)
- defaultVec.push_back(oid);
- else if (objStatusMap_[oid] == TePOINTED_QUERIED)
- objStatusMap_[oid] = TeQUERIED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- objStatusMap_.erase(defaultVec[i]);
-
- // Remove the pointed status for the uids
- defaultVec.clear();
- for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
- {
- uid = mapIt->first;
- if (itemStatusMap_[uid] == TePOINTED)
- defaultVec.push_back(uid);
- else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
- itemStatusMap_[uid] = TeQUERIED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- itemStatusMap_.erase(defaultVec[i]);
-}
-
-
-void TeAbstractTheme::removeQueryColor()
-{
- unsigned int i;
- string oid, uid;
- vector<string> defaultVec;
- map<string, int>::iterator mapIt;
-
- // Remove the pointed status for the objects
- for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
- {
- oid = mapIt->first;
- if (objStatusMap_[oid] == TeQUERIED)
- defaultVec.push_back(oid);
- else if (objStatusMap_[oid] == TePOINTED_QUERIED)
- objStatusMap_[oid] = TePOINTED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- objStatusMap_.erase(defaultVec[i]);
-
- // Remove the pointed status for the uids
- defaultVec.clear();
- for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
- {
- uid = mapIt->first;
- if (itemStatusMap_[uid] == TeQUERIED)
- defaultVec.push_back(uid);
- else if (itemStatusMap_[uid] == TePOINTED_QUERIED)
- itemStatusMap_[uid] = TePOINTED;
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- itemStatusMap_.erase(defaultVec[i]);
-}
-
-
-void TeAbstractTheme::invertObjectStatus()
-{
- unsigned int i;
- string oid, uid;
- set<string> objInvToPointedStatusSet; // objects to be inverted to the pointed status
- set<string> objInvToDefaultStatusSet; // objects to be inverted to the default status
- vector<string> defaultVec;
- map<string, int>::iterator mapIt;
- set<string>::const_iterator setIt;
-
- // Get all the theme objects
- const set<string>& oidSet = getObjects();
-
- // Get the objects that are pointed, queried, or pointed and queried
- // and put their status to the default status, and get the objects
- // that are in the default status and put them in the pointed status
- for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
- {
- oid = *setIt;
- if (objStatusMap_[oid] == TeDEFAULT)
- {
- objStatusMap_[oid] = TePOINTED;
- objInvToPointedStatusSet.insert(oid);
- }
- else if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TeQUERIED ||
- objStatusMap_[oid] == TePOINTED_QUERIED)
- {
- defaultVec.push_back(oid);
- objInvToDefaultStatusSet.insert(oid);
- }
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- objStatusMap_.erase(defaultVec[i]);
-
- // Set the status for the uids according the status of their objects
- vector<string> uidVec = getItemVector(objInvToPointedStatusSet);
- for (i = 0; i < uidVec.size(); ++i)
- itemStatusMap_[uidVec[i]] = TePOINTED;
-
- uidVec = getItemVector(objInvToDefaultStatusSet);
- for (i = 0; i < uidVec.size(); ++i)
- itemStatusMap_.erase(uidVec[i]);
-}
-
-
-void TeAbstractTheme::setObjectsToDefaultStatus()
-{
- unsigned int i;
- string oid, uid;
- vector<string> defaultVec;
- map<string, int>::iterator mapIt;
-
- // Set the default status for objects that are pointed, queried, or pointed and queried
- for (mapIt = objStatusMap_.begin(); mapIt != objStatusMap_.end(); ++mapIt)
- {
- oid = mapIt->first;
- if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TeQUERIED ||
- objStatusMap_[oid] == TePOINTED_QUERIED)
- defaultVec.push_back(oid);
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- objStatusMap_.erase(defaultVec[i]);
-
- // Set the default status for uids that are pointed, queried, or pointed and queried
- defaultVec.clear();
- for (mapIt = itemStatusMap_.begin(); mapIt != itemStatusMap_.end(); ++mapIt)
- {
- uid = mapIt->first;
- if (itemStatusMap_[uid] == TePOINTED || itemStatusMap_[uid] == TeQUERIED ||
- itemStatusMap_[uid] == TePOINTED_QUERIED)
- defaultVec.push_back(uid);
- }
-
- for (i = 0; i < defaultVec.size(); ++i)
- itemStatusMap_.erase(defaultVec[i]);
-}
-
-
-
-
-
diff --git a/src/terralib/kernel/TeAbstractTheme.h b/src/terralib/kernel/TeAbstractTheme.h
deleted file mode 100644
index ffb8308..0000000
--- a/src/terralib/kernel/TeAbstractTheme.h
+++ /dev/null
@@ -1,673 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeAbstractTheme.h
- \brief This file contains definitions about an abstract theme in TerraLib.
-*/
-#ifndef __TERRALIB_INTERNAL_ABSTRACT_THEME_H
-#define __TERRALIB_INTERNAL_ABSTRACT_THEME_H
-
-#include "TeDefines.h"
-#include "TeLegendEntry.h"
-#include "TeGeometry.h"
-#include "TeViewNode.h"
-#include "TeAttribute.h"
-
-class TeRasterTransform;
-class TeRaster;
-class TeDatabase;
-struct TeRepresentation;
-
-#include <string>
-#include <set>
-
-//! A grouping structure
-/*!
- The TeGrouping is a structure that describes how the objects of a theme should
- be grouped, or separated in groups.
-*/
-struct TL_DLL TeGrouping
-{
- //! Returns the attribute used to group the objects of the theme
- TeAttributeRep groupAttribute_;
-
- //! Returns the attribute used to normalize a grouping
- string groupNormAttribute_;
-
- //! Returns the grouping mode
- TeGroupingMode groupMode_;
-
- //! Returns the number of groups
- int groupNumSlices_;
-
- //! Returns the numeric precision used to group objects
- int groupPrecision_;
-
- //! Returns the deviation parameter used to group objects
- double groupStdDev_;
-
- //! Aggregate function
- string groupFunction_;
-
- //! Show missing data
- bool groupNullAttr_;
-
- //! Minimum value used to calculate a equal step grouping
- double groupMinVal_;
-
- //! Maximum value used to calculate a equal step grouping
- double groupMaxVal_;
-
- //! Chronon used for grouping
- TeChronon groupChronon_;
-
- //! Constructor
- TeGrouping(TeAttributeRep att=TeAttributeRep(), const string& normAttr="",
- TeGroupingMode gMode=TeNoGrouping, int numSlice=0, int gPrecision=6,
- double gStDev=1.0, const string& func="", TeChronon gChronon = TeNOCHRONON):
- groupAttribute_(att),
- groupNormAttribute_(normAttr),
- groupMode_(gMode),
- groupNumSlices_(numSlice),
- groupPrecision_(gPrecision),
- groupStdDev_(gStDev),
- groupFunction_(func),
- groupNullAttr_(false),
- groupMinVal_(TeMAXFLOAT),
- groupMaxVal_(TeMINFLOAT),
- groupChronon_(gChronon)
- {}
-
- //! Copy constructor
- TeGrouping(const TeGrouping& other)
- {
- groupAttribute_ = other.groupAttribute_;
- groupNormAttribute_ = other.groupNormAttribute_;
- groupMode_ = other.groupMode_;
- groupNumSlices_ = other.groupNumSlices_;
- groupPrecision_ = other.groupPrecision_;
- groupStdDev_ = other.groupStdDev_;
- groupFunction_ = other.groupFunction_;
- groupNullAttr_ = other.groupNullAttr_;
- groupMinVal_ = other.groupMinVal_;
- groupMaxVal_ = other.groupMaxVal_;
- groupChronon_ = other.groupChronon_;
- }
-
- //! Destructor
- ~TeGrouping() {}
-
- //! Copy constructor
- TeGrouping& operator= (const TeGrouping& other)
- {
- if ( this != &other )
- {
- groupAttribute_ = other.groupAttribute_;
- groupNormAttribute_ = other.groupNormAttribute_;
- groupMode_ = other.groupMode_;
- groupNumSlices_ = other.groupNumSlices_;
- groupPrecision_ = other.groupPrecision_;
- groupStdDev_ = other.groupStdDev_;
- groupFunction_ = other.groupFunction_;
- groupNullAttr_ = other.groupNullAttr_;
- groupNullAttr_ = other.groupNullAttr_;
- groupMinVal_ = other.groupMinVal_;
- groupMaxVal_ = other.groupMaxVal_;
- groupChronon_ = other.groupChronon_;
- }
- return *this;
- }
-};
-
-using namespace std;
-
-
-//! An abstract theme class
-class TL_DLL TeAbstractTheme: public TeViewNode
-{
-
- friend class TeDatabase;
-
-public:
- //! Constructor
- TeAbstractTheme(const string& name, TeViewNode* parent, const int& view, const int& id, const TeViewNodeType& nodeType);
-
- //! Constructor
- TeAbstractTheme(const TeViewNodeParams& params);
-
- //! Copy constructor
- TeAbstractTheme(const TeAbstractTheme& other);
-
- //! Destructor
- virtual ~TeAbstractTheme();
-
- //! Assignment operator
- TeAbstractTheme& operator= (const TeAbstractTheme& other);
-
- /** @name Scale
- Methods related to the range of scales where this theme should be visible
- */
- //@{
-
- //! Returns a pointer to a projection that is the spatial reference for the objects of this theme
- /*! Concrete classes should reimplement this method.*/
- virtual TeProjection* getThemeProjection() = 0;
-
- //! Returns the minimum scale in which the theme is visible
- virtual double minScale() { return minScale_; }
-
- //! Sets the minimum scale in which the theme is visible
- virtual void minScale(double s) { minScale_ = s; }
-
- //! Returns the maximum scale in which the theme is visible
- virtual double maxScale() { return maxScale_; }
-
- //! Sets the maximum scale in which the theme is visible
- virtual void maxScale(double s) { maxScale_ = s; }
- //@}
-
- /** @name Restrictions
- Methods related to the restrictions over the theme used to generate this theme
- */
- //@{
- //! Verifies if this theme has any kind of restrictions
- virtual bool hasRestriction() { return (!(generateAttributeRest_.empty() ||
- generateTemporalRest_.empty()) && hasSpatialRes_); }
-
- //! Returns the attribute restriction (where clause) used to generate the theme
- virtual string attributeRest() { return generateAttributeRest_; }
-
- //! Sets the attribute restriction (where clause) used to generate the theme
- virtual void attributeRest(const string& s) { generateAttributeRest_ = s; }
-
- //! Returns if there is an attribute restriction
- virtual bool hasAttrRest () { return (!generateAttributeRest_.empty());}
-
- //! Returns the temporal restriction used to generate the theme
- virtual string temporalRest() { return generateTemporalRest_; }
-
- //! Sets the temporal restriction used to generate the theme
- virtual void temporalRest(const string& t) { generateTemporalRest_ = t; };
-
- //! Returns TRUE if there is a temporal restriction defined in the theme
- virtual bool hasTemporalRest() { return (!generateTemporalRest_.empty());}
-
- //! Returns the spatial restriction used to generate the theme
- virtual string spatialRest() { return generateSpatialRest_; }
-
- //! Sets the spatial restriction used to generate the theme
- virtual void spatialRest(const string& s) { generateSpatialRest_ = s; };
-
- //! Returns the spatial relation (e.g WITHIN, COVERED BY, etc.) associate to the spatial restriction
- virtual TeSpatialRelation spatialRelation() { return spatialRelation_;}
-
- //! Sets the spatial relation (e.g WITHIN, COVERED BY, etc.) associate to the spatial restriction
- virtual void spatialRelation(TeSpatialRelation s) {spatialRelation_=s;}
-
- //! Returns TRUE if this theme has a spatial restriction
- virtual bool hasSpatialRest() { return hasSpatialRes_;}
-
- //! Sets the flag that indicates that there is a spatial restriction
- virtual void hasSpatialRest(bool a) {hasSpatialRes_ = a;}
-
- //! Returns the box associated with the spatial restriction
- virtual TeBox boxRestriction() { return boxRest_;}
-
- //! Sets the box associated with the spatial restriction
- virtual void boxRestriction(TeBox& b) {boxRest_ = b;}
-
- //! Returns a pointer to the geometry associated with the spatial restriction
- virtual TeGeometry* geomRestriction() { return geomRest_;}
-
- //! Sets a pointer to the geometry associated with the spatial restriction
- virtual void geomRestriction(TeGeometry* g) {geomRest_ = g;}
-
- //! Returns the geometry representation of the theme which will be considered in the spatial restriction
- virtual TeGeomRep geomRepRestriction() { return geomRepRest_; }
-
- //! Sets the geometry representation of the theme which will be considered in the spatial restriction
- virtual void geomRepRestriction (TeGeomRep& rep) { geomRepRest_ = rep; }
-
- //! Sets the spatial restriction to be a spatial relation with a box
- virtual void setSpatialRest(TeBox& box, TeGeomRep rep, TeSpatialRelation relation = TeWITHIN);
-
- //! Sets the spatial restriction to be a spatial relation with a geometry
- virtual void setSpatialRest(TeGeometry* geom, TeGeomRep rep, TeSpatialRelation relation = TeWITHIN);
- //@}
-
-
- /** @name Visibility/Status
- Methods related to the visibility/status of the theme and its components: graphs,
- geometrical representations of the objects, grouping.
- */
- //@{
- //! Sets the components or representations of the theme that are visible
- /*!
- The param rep is a combination of any type of geometrical representation (TeGeomRep) plus:
- - 0x20000000: representing the visibility of the legend
- - 0x40000000: representing the visibility of the groupings
- - 0x80000000: representing the visibility of the pie/chart graphs
- */
- virtual void visibleRep(int rep) { visibleRep_ = rep; }
-
- //! Returns the components or representations of the theme that are visible
- /*!
- The result is a combination of any type of geometrical representation (TeGeomRep) plus:
- - 0x20000000: representing the visibility of the legend
- - 0x40000000: representing the visibility of the groupings
- - 0x80000000: representing the visibility of the pie/chart graphs
- */
- virtual int visibleRep() { return visibleRep_; }
-
- //! Returns the geometrical representations of the theme that are visible
- virtual int visibleGeoRep();
-
- //! Returns a status of a theme
- /*!
- - Returns 0 if the theme is not visible and not active
- - Returns 1 if the theme is visible and not active
- - Returns 2 if theme is and active and not visible
- - Returns 3 if theme is and visible and active
- */
- virtual int visibility()
- { return enableVisibility_; }
-
- //! Sets whether the theme should be visible and/or active
- /*!
- - Returns 0 if the theme is not visible and not active
- - Returns 1 if the theme is visible and not active
- - Returns 2 if theme is and active and not visible
- - Returns 3 if theme is and visible and active
- */
- virtual void visibility(int v)
- { enableVisibility_ = v; }
- //@}
-
- /** @name Grouping
- Methods related to grouping of objects of the theme. Each group is
- represented by a specific presentation visual called legend. An slice
- represents the range of values of an attribute that characterizes a group.
- */
- //@{
- //! Returns a grouping associated the theme
- virtual TeGrouping& grouping() { return grouping_; }
-
- //! Sets a grouping associated to the theme
- virtual void grouping(const TeGrouping& g)
- { grouping_ = g; }
-
- //! Returns the vector of legends of the theme
- virtual TeLegendEntryVector& legend() { return legend_; }
-
- //! Sets the visual associated to a geometric representation in the n-th group of the theme
- virtual bool setGroupingVisual(int n, TeVisual* visual, TeGeomRep rep);
-
- //! Sets the visual of the n-th group of the theme
- virtual bool setGroupingVisual(int n, TeGeomRepVisualMap& vismap);
-
- //! Clear the existing grouping of objects of this theme
- virtual void resetGrouping ();
-
- //! Clear the vector of legends
- virtual void cleanLegend();
-
- //! Save grouping parameters in memory passing an arbitrary set of slices
- virtual bool buildGrouping(const TeGrouping& g, vector<TeSlice>& slices);
-
- //! Returns the slices associated to the grouping of the theme
- virtual TeSliceVector getSlices();
- //@}
-
- /** @name Legends
- Legends are also used to define presentation characteristics of the objets
- of the theme that aren't grouped, according to some specific characteristics
- (such as being pointed, being queried, among others).
- */
- //@{
- //! Sets a default legend of the objects of the theme
- virtual void defaultLegend (TeLegendEntry& leg)
- { defaultLegend_ = leg; }
-
- //! Returns the default legend of the objects of the theme
- virtual TeLegendEntry& defaultLegend ()
- { return defaultLegend_; }
-
- //! Sets the visual of the default legend for a specific geometrical representation
- virtual void setVisualDefault (TeVisual* visual, TeGeomRep rep)
- { defaultLegend_.setVisual(visual, rep); }
-
- //! Sets a legend for objects of the layer that weren't selected in this theme
- /*! Useful when is necessary to see the theme in the context of the layer */
- virtual void outOfCollectionLegend (TeLegendEntry &leg)
- { outOfCollectionLegend_ = leg;}
-
- //! Returns the legend of the layer objects that are not selected in this layer.
- virtual TeLegendEntry& outOfCollectionLegend ()
- { return outOfCollectionLegend_; }
-
- //! Sets the visual of the non-selected objects legend for a specific geometrical representation
- virtual void setVisualOutOfCollection (TeVisual* visual, TeGeomRep rep)
- { outOfCollectionLegend_.setVisual(visual, rep); }
-
- //! Sets a legend for objects that have geometries but not descriptive attributes
- /*! Useful when in intermediary situations such as editing */
- virtual void withoutDataConnectionLegend (TeLegendEntry &leg)
- { withoutDataConnectionLegend_ = leg; }
-
- //! Returns the legend of objects that have geometries but not descriptive attributes
- virtual TeLegendEntry& withoutDataConnectionLegend ()
- { return withoutDataConnectionLegend_; }
-
- //! Sets the visual of the without-attributes objects legend for a specific geometrical representation
- virtual void setVisualWithoutDataConnection (TeVisual* visual, TeGeomRep rep)
- { withoutDataConnectionLegend_.setVisual(visual, rep); }
-
- //! Sets a legend for the theme objects selected by pointing
- virtual void pointingLegend (TeLegendEntry &leg)
- { pointingLegend_ = leg; }
-
- //! Returns the legend of the theme objects selected by pointing
- virtual TeLegendEntry& pointingLegend ()
- { return pointingLegend_; }
-
- //! Sets the visual of the pointed objects legend for a specific geometrical representation
- virtual void setVisualPointing (TeVisual* visual, TeGeomRep rep)
- { pointingLegend_.setVisual(visual, rep); }
-
- //! Sets a legend for the theme objects selected by a query
- virtual void queryLegend (TeLegendEntry &leg)
- { queryLegend_ = leg; }
-
- //! Returns the legend of the theme objects selected by a query
- virtual TeLegendEntry& queryLegend ()
- { return queryLegend_; }
-
- //! Sets the visual of the queried objects legend for a specific geometrical representation
- virtual void setVisualQuery (TeVisual* visual, TeGeomRep rep)
- { queryLegend_.setVisual(visual, rep); }
-
- //! Sets a legend for the theme objects selected by query and pointing
- virtual void queryAndPointingLegend (TeLegendEntry &leg)
- { queryAndPointingLegend_ = leg; }
-
- //! Returns the legend of the theme objects selected by query and pointing
- virtual TeLegendEntry& queryAndPointingLegend ()
- { return queryAndPointingLegend_; }
-
- //! Returns the map of legend ids associated to each object
- virtual map<string, int>& getObjLegendMap()
- { return objLegendMap_; }
-
- //! Returns the map of legend ids associated to each object
- virtual map<string, int>& getObjOwnLegendMap()
- { return objOwnLegendMap_; }
-
- //! Sets the visual of the queried and pointed objects legend for a specific geometrical representation
- virtual void setVisualQueryAndPointing (TeVisual* visual, TeGeomRep rep)
- { queryAndPointingLegend_.setVisual(visual, rep); }
-
- //! Sets a legend for the theme objects
- virtual void legend(TeLegendEntry& leg);
-
- /** @name Raster Visual
- * Methods to deal with the visual presentation of the raster representations
- */
- //@{
- //! Returns the visual presentation of raster geometry
- virtual TeRasterTransform* rasterVisual()
- { return rasterVisual_; }
-
- //! Sets the visual presentation of raster geometry
- virtual void rasterVisual(TeRasterTransform* r)
- { rasterVisual_ = r; }
-
- //! Removes the visual presentation of the raster
- virtual void removeRasterVisual();
-
- //! Creates an appropriate visual presentation to the raster of the theme
- virtual void createRasterVisual(TeRaster* rst=0);
- //@}
- //@}
-
- /** @name Box
- Methods related to the bounding box of a theme
- */
- //@{
- //! Returns the theme box
- virtual TeBox& getThemeBox()
- { return themeBox_; }
-
- //! Sets the theme box
- virtual void setThemeBox(const TeBox& box)
- { themeBox_ = box; }
-
- //! Returns the theme box
- virtual TeBox& box()
- { return themeBox_; }
- //@}
-
- //! Sets the parent node. The abstract theme does not have parent node.
- virtual void setParent (TeViewNode* );
-
- //! Returns TRUE if a theme has lower priority than another
- virtual bool operator< (const TeAbstractTheme& r) const
- { return viewNodeParams_.priority_ < r.viewNodeParams_.priority_; }
-
- //! Clear the set containing the objects of the theme
- virtual void clearObjectSet()
- { objectSet_.clear(); }
-
- //! Return the number of objects of the layer
- virtual int getNumLayerObjects()
- { return numLayerObjects_; }
-
- //! Return the map containing the status of the objects
- virtual map<string, int>& getObjStatusMap()
- { return objStatusMap_; }
-
- //! Set the status of the objects to the default state
- virtual void clearObjStatus()
- { objStatusMap_.clear(); }
-
- //! Set the status of the items to the default state
- virtual void clearItemStatus()
- { itemStatusMap_.clear(); }
-
- //! Return the map containing the status of the items
- virtual map<string, int>& getItemStatusMap()
- { return itemStatusMap_; }
-
- //! the status
- virtual void setStatus(vector<string>& oidVec, vector<string>& itemVec, int status);
-
- //! the status for the items that were toggled
- virtual void setStatusForItemsToggled(set<string>& oidSet, vector<string>& itemVec);
-
- //! Set the status for the objects that were toggled
- virtual void setStatusForObjectToggled(string oid);
-
- //! Set the status for the new set of objects that were pointed
- virtual void setStatusForNewObjectsPointed(set<string>& oidSet);
-
- //! Set the status for the additional set of objects that were pointed
- virtual void setStatusForObjectsAddedByPointing(set<string>& oidSet);
-
- //! Set the status for the new set of items that were pointed
- virtual void setStatusForNewItemsPointed(vector<string>& itemVec);
-
- //! Set the status for the additional set of items that were pointed
- virtual void setStatusForItemsAddedByPointing(vector<string>& itemVec);
-
- //! Set the status for the new set of items that were queried
- virtual void setStatusForNewItemsQueried(set<string>& oidSet, vector<string>& uidVec);
-
- //! Set the status for the additional set of items that were queried
- virtual void setStatusForItemsAddedByQuerying(set<string>& oidSet, vector<string>& uidVec);
-
- //! Set the status for the set of items that were filtered by a query operation
- virtual void setStatusForItemsFilteredByQuerying(set<string>& oidSet, vector<string>& uidVec);
-
- //! Remove the pointing color
- virtual void removePointingColor();
-
- //! Remove the query color
- virtual void removeQueryColor();
-
- //! Invert the pointing status of the objects
- virtual void invertObjectStatus();
-
- //! Set the objects to the default status
- virtual void setObjectsToDefaultStatus();
-
- //! Save the theme parameters
- virtual bool save() = 0;
-
- //! Save the grouping parameters in memory when there is no chronon
- virtual bool buildGrouping(const TeGrouping& g, TeSelectedObjects selectedObjects = TeAll,
- vector<double>* dValuesVec = 0) = 0;
-
- //! Save the grouping parameters in memory when there is chronon
- virtual bool buildGrouping(const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec) = 0;
-
-
- //! Build the grouping and associate each object to its group
- virtual bool saveGrouping(TeSelectedObjects selectedObjects = TeAll) = 0;
-
- //! Delete grouping
- virtual bool deleteGrouping() = 0;
-
- //! Set the legend id for each object of the theme
- virtual void setLegendsForObjects() = 0;
-
- //! Set the own legend id for each object of the theme
- virtual void setOwnLegendsForObjects() = 0;
-
- /** @name Locate geometries
- Returns the geometry(ies) of the theme given coordinate
- */
- //@{
- virtual bool locatePolygon (TeCoord2D &pt, TePolygon &polygon, const double& tol = 0.0) = 0;
- virtual bool locatePolygonSet (TeCoord2D &pt, double tol, TePolygonSet &polygons) = 0;
- virtual bool locateLine (TeCoord2D &pt, TeLine2D &line, const double& tol = 0.0) = 0;
- virtual bool locatePoint (TeCoord2D &pt, TePoint &point, const double& tol = 0.0) = 0;
- virtual bool locateCell (TeCoord2D &pt, TeCell &c, const double& tol = 0.0) = 0;
- //@}
-
- //! Get the set of objects corresponding to the object selection criteria
- virtual set<string> getObjects(TeSelectedObjects selectedObjects = TeAll) = 0;
-
- //! Get the set of objects corresponding to the list of items
- virtual set<string> getObjects(const vector<string>& itemVec) = 0;
-
- //! Get the set of items corresponding to the object selection criteria
- virtual vector<string> getItemVector(TeSelectedObjects selectedObjects) = 0;
-
- //! Get the set of items corresponding to the set of objects
- virtual vector<string> getItemVector(const set<string>& oidSet) = 0;
-
- //! Get the number of objects acessible by this theme
- virtual unsigned int getNumberOfObjects()=0;
-
- //! Save (insert or update) the theme metadata in the database
- virtual bool saveMetadata(TeDatabase* ) = 0;
-
-protected:
- string generateAttributeRest_;
- string generateTemporalRest_;
- string generateSpatialRest_; //future use
-
- TeSpatialRelation spatialRelation_;
- bool hasSpatialRes_;
- TeBox boxRest_; //box which defines the spatial restriction
- TeGeometry* geomRest_; //geometry which defines the spatial restriction
- TeGeomRep geomRepRest_; //geometry representation of the theme which will be
- //considered in the spatial restriction
- // Display scale
- double minScale_;
- double maxScale_;
-
- //representation visible in the theme
- int visibleRep_;
-
- //Theme status
- int enableVisibility_;
-
- // ----------------- grouping information -----------------
- TeGrouping grouping_;
-
- // ----------------- legend information -----------------
- TeLegendEntryVector legend_;
-
- // Background Legend
- TeLegendEntry outOfCollectionLegend_; //group(-1)
- TeLegendEntry withoutDataConnectionLegend_; //group(-2)
- TeLegendEntry defaultLegend_; //group(-3)
- TeLegendEntry pointingLegend_; //group(-4)
- TeLegendEntry queryLegend_; //group(-5)
- TeLegendEntry queryAndPointingLegend_; //group(-6)
-
- map<string, int> objLegendMap_; // object legend
- map<string, int> objOwnLegendMap_; // object own legend
-
- //! visual of raster
- TeRasterTransform* rasterVisual_;
-
- TeBox themeBox_;
-
- //! A set containing the theme objects
- set<string> objectSet_;
-
- //! Number of objects of the layer
- int numLayerObjects_;
-
- //! Status of the item (concatenation of the unique names of each theme table)
- map<string, int> itemStatusMap_;
-
- //! Status of the object
- map<string, int> objStatusMap_;
-
- //! Load the theme metadata from database
- virtual bool loadMetadata(TeDatabase* ) = 0;
-
- //! Erase the theme metadata in the database
- virtual bool eraseMetadata(TeDatabase* ) = 0;
-};
-
-//! A vector of pointers to theme
-typedef vector<TeAbstractTheme*> TeThemeVector;
-
-//! A map from theme identifiers to pointers to theme
-typedef map<int, TeAbstractTheme*> TeThemeMap;
-
-/*! \example creaTeAbstractTheme.cpp
- Shows how to create themes in TerraLib.
- */
-
-/*! \example themeGrouping.cpp
- Shows how to do a grouping on the objects of a TerraLib theme.
- */
-
-/*! \example rasterSlicing.cpp
- Shows how to create a legend over a raster data, stored in a layer TerraLib.
- */
-#endif
-
diff --git a/src/terralib/kernel/TeAffineGT.cpp b/src/terralib/kernel/TeAffineGT.cpp
deleted file mode 100644
index 7fcac17..0000000
--- a/src/terralib/kernel/TeAffineGT.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeAffineGT.h"
-
-#include "TeAgnostic.h"
-
-
-TeAffineGT::TeAffineGT()
-{
-}
-
-
-TeAffineGT::~TeAffineGT()
-{
-}
-
-
-void TeAffineGT::directMap( const TeGTParams& params, const TeCoord2D& pt1,
- TeCoord2D& pt2 ) const
-{
- TEAGN_DEBUG_CONDITION( ( params.direct_parameters_.Ncol() == 3 ),
- "Invalid number of columns" )
- TEAGN_DEBUG_CONDITION( ( params.direct_parameters_.Nrow() == 3 ),
- "Invalid number of rows" )
-
- double x = pt1.x();
- double y = pt1.y();
-
- pt2.x( params.direct_parameters_(0,0) * x +
- params.direct_parameters_(0,1) * y +
- params.direct_parameters_(0,2) );
- pt2.y( params.direct_parameters_(1,0) * x +
- params.direct_parameters_(1,1) * y +
- params.direct_parameters_(1,2) );
-}
-
-
-void TeAffineGT::inverseMap( const TeGTParams& params, const TeCoord2D& pt2,
- TeCoord2D& pt1 ) const
-{
- TEAGN_DEBUG_CONDITION( ( params.inverse_parameters_.Ncol() == 3 ),
- "Invalid number of columns" )
- TEAGN_DEBUG_CONDITION( ( params.inverse_parameters_.Nrow() == 3 ),
- "Invalid number of rows" )
-
- double u = pt2.x();
- double v = pt2.y();
-
- pt1.x( params.inverse_parameters_(0,0) * u +
- params.inverse_parameters_(0,1) * v +
- params.inverse_parameters_(0,2) );
- pt1.y( params.inverse_parameters_(1,0) * u +
- params.inverse_parameters_(1,1) * v +
- params.inverse_parameters_(1,2) );
-}
-
-
-unsigned int TeAffineGT::getMinRequiredTiePoints() const
-{
- return 3;
-}
-
-
-bool TeAffineGT::computeParameters( TeGTParams& params )
-{
- /*
- u = a1.x + a2.y + a3
- v = b1.x + b2.y + b3
-
- A . X + L = 0
- N = At . A
- U = At . L
- X = - (N ^ -1) . U
-
- A = |x1 y1 1 0 0 0| Xt = |a1 a2 a3 b1 b2 b3|
- |0 0 0 x1 y1 1|
- |x2 y2 1 0 0 0|
- |0 0 0 x2 y2 1| Lt = |u1 v1 u2 v2 ... un vn|
- |. . . . . .|
- |xn yn 1 0 0 0|
- |0 0 0 xn yn 1|
-
- */
-
- const unsigned int tiepoints_size = params.tiepoints_.size();
- TEAGN_DEBUG_CONDITION( ( tiepoints_size > 2 ),
- "Invalid tie-points size" )
-
- TeMatrix A;
- if( ! A.Init( 2*tiepoints_size, 6 ) ) {
- return false;
- }
-
- TeMatrix L;
- if( ! L.Init( 2*tiepoints_size, 1 ) ) {
- return false;
- }
-
- TeMatrix At;
- TeMatrix N;
- TeMatrix U;
- TeMatrix X;
- TeMatrix N_inv;
-
- std::vector< TeCoordPair >::const_iterator iterator;
-
- TeCoord2D x_y;
- TeCoord2D u_v;
- double x = 0;
- double y = 0;
-
- /* L calcule */
-
- iterator = params.tiepoints_.begin() ;
- for ( unsigned int L_block_offset = 0 ; ( L_block_offset < tiepoints_size );
- ++L_block_offset ) {
-
- u_v = iterator->pt2;
-
- L( L_block_offset*2 , 0) = u_v.x();
- L( L_block_offset*2 + 1 , 0) = u_v.y();
-
- ++iterator ;
- }
-
- /* A calcule */
-
- iterator = params.tiepoints_.begin();
- for ( unsigned int A_block_offset = 0 ; (A_block_offset < tiepoints_size) ;
- ++A_block_offset) {
-
- x_y = iterator->pt1;
- x = x_y.x();
- y = x_y.y();
-
- A( A_block_offset*2 , 0 ) = x ;
- A( A_block_offset*2 , 1 ) = y ;
- A( A_block_offset*2 , 2 ) = 1 ;
- A( A_block_offset*2 , 3 ) = 0 ;
- A( A_block_offset*2 , 4 ) = 0 ;
- A( A_block_offset*2 , 5 ) = 0 ;
- A( A_block_offset*2+1, 0 ) = 0 ;
- A( A_block_offset*2+1, 1 ) = 0 ;
- A( A_block_offset*2+1, 2 ) = 0 ;
- A( A_block_offset*2+1, 3 ) = x ;
- A( A_block_offset*2+1, 4 ) = y ;
- A( A_block_offset*2+1, 5 ) = 1 ;
-
- ++iterator;
- }
-
- /* At calcule */
- A.Transpose( At );
-
- /* N calcule */
- N = At * A;
-
- /* U calcule */
- U = At * L;
-
- /* N_inv calcule */
- if ( N.Inverse( N_inv ) ) {
- /* X calcule */
-
- X = N_inv * U;
-
- if( ! params.direct_parameters_.Init( 3, 3 ) ) {
- return false;
- }
-
- params.direct_parameters_(0,0) = X(0,0);
- params.direct_parameters_(0,1) = X(1,0);
- params.direct_parameters_(0,2) = X(2,0);
- params.direct_parameters_(1,0) = X(3,0);
- params.direct_parameters_(1,1) = X(4,0);
- params.direct_parameters_(1,2) = X(5,0);
- params.direct_parameters_(2,0) = 0;
- params.direct_parameters_(2,1) = 0;
- params.direct_parameters_(2,2) = 1;
-
- if( params.direct_parameters_.Inverse( params.inverse_parameters_ ) ) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
-}
-
diff --git a/src/terralib/kernel/TeAffineGT.h b/src/terralib/kernel/TeAffineGT.h
deleted file mode 100644
index a86dcea..0000000
--- a/src/terralib/kernel/TeAffineGT.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeAffineGT.h
- \brief Affine geometric trasformation.
-*/
-
-
-#ifndef TEAFFINEGT_H
- #define TEAFFINEGT_H
-
- #include "TeDefines.h"
- #include <TeGeometricTransformation.h>
-
- /**
- * @brief This is the class to deal affine geometric trasformation.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup Utils
- */
- class TL_DLL TeAffineGT : public TeGeometricTransformation {
- public :
-
- /**
- * @brief Default Constructor.
- */
- TeAffineGT();
-
- /**
- * @brief Default Destructor
- */
- ~TeAffineGT();
-
- /**
- * @brief Returns the minimum number of required tie-points for the current
- * transformation.
- *
- * @return The minimum number of required tie-points for the current
- * transformation.
- */
- unsigned int getMinRequiredTiePoints() const;
-
- protected :
-
- /**
- * @brief Direct mapping ( from pt1 space into pt2 space ).
- *
- * @param params Transformation parameters.
- * @param pt1 pt1 coordinate.
- * @param pt2 pt2 coordinate.
- */
- void directMap( const TeGTParams& params, const TeCoord2D& pt1,
- TeCoord2D& pt2 ) const;
-
- /**
- * @brief Inverse mapping ( from pt2 space into pt1 space ).
- *
- * @param params Transformation parameters.
- * @param pt2 pt2 coordinate.
- * @param pt1 pt1 coordinate.
- */
- void inverseMap( const TeGTParams& params, const TeCoord2D& pt2,
- TeCoord2D& pt1 ) const;
-
- /**
- * @brief Calculate the transformation parameters following the
- * new supplied tie-points.
- *
- * @param params Transformation parameters.
- * @return true if OK, false on errors.
- */
- bool computeParameters( TeGTParams& params );
- };
-
-#endif
-
diff --git a/src/terralib/kernel/TeAffineGTFactory.cpp b/src/terralib/kernel/TeAffineGTFactory.cpp
deleted file mode 100644
index 49e8fd9..0000000
--- a/src/terralib/kernel/TeAffineGTFactory.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeAffineGTFactory.h"
-#include <TeAffineGT.h>
-#include <TeException.h>
-
-TeAffineGTFactory::TeAffineGTFactory()
-: TeGTFactory( std::string( "affine" ) )
-{
-};
-
-TeAffineGTFactory::~TeAffineGTFactory()
-{
-};
-
-
-TeGeometricTransformation* TeAffineGTFactory::build (
- const TeGTParams& )
-{
- TeGeometricTransformation* instance_ptr = new TeAffineGT();
-
- if( ! instance_ptr ) {
- throw TeException( FACTORY_PRODUCT_INSTATIATION_ERROR );
- }
-
- return instance_ptr;
-}
diff --git a/src/terralib/kernel/TeAffineGTFactory.h b/src/terralib/kernel/TeAffineGTFactory.h
deleted file mode 100644
index 9b0547b..0000000
--- a/src/terralib/kernel/TeAffineGTFactory.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeAffineGTFactory.h
- \brief This file contains the affine geometric trasformation factory
-*/
-
-#ifndef TEAFFINEGTFACTORY_H
- #define TEAFFINEGTFACTORY_H
-
- #include "TeDefines.h"
- #include <TeGTFactory.h>
-
- /**
- * @brief This is the affine geometric trasformation factory.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup Utils
- */
- class TL_DLL TeAffineGTFactory : public TeGTFactory
- {
- public :
-
- /**
- * @brief Default constructor
- */
- TeAffineGTFactory();
-
- /**
- * @brief Default Destructor
- */
- ~TeAffineGTFactory();
-
- protected :
-
- /**
- * @brief Implementation for the abstract TeFactory::build.
- *
- * @param arg A const reference to the used parameters.
- * @return A pointer to the new generated instance.
- */
- TeGeometricTransformation* build( const TeGTParams& arg );
-
- };
-
- namespace
- {
- /** @brief A concrete factory instance for registering into the factory dictionary */
- static TeAffineGTFactory TeAffineGTFactory_instance;
- };
-
-#endif
-
diff --git a/src/terralib/kernel/TeAgnostic.cpp b/src/terralib/kernel/TeAgnostic.cpp
deleted file mode 100644
index 76bcb8e..0000000
--- a/src/terralib/kernel/TeAgnostic.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "TeAgnostic.h"
-
-namespace TeAgnostic{
-
- bool debugModeCheck()
- {
- #ifdef TEAGN_DEBUG_MODE
- return true;
- #else
- return false;
- #endif
- }
-
-};
diff --git a/src/terralib/kernel/TeAgnostic.h b/src/terralib/kernel/TeAgnostic.h
deleted file mode 100644
index 7b171a8..0000000
--- a/src/terralib/kernel/TeAgnostic.h
+++ /dev/null
@@ -1,395 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-/**
- * @file TeAgnostic.h
- * @brief This file contains a set of macros, routines and classes to deal with
- * system checking and logging facility.
- * They should NOT be used by anyone because the support and interfaces
- * can be changed in future. THIS IS FOR INTERNAL USE ONLY.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- *
- * @note The following macros will be used:
- *
- * @param TEAGN_DEBUG_MODE If defined, debug code macros will be compiled and
- * used or if not defined the compiler debug flag will be used.
- * @param TEAGN_ENABLE_STDOUT_LOG If defined, messages also will be logged
- * to STDOUT ( otherwise only TeErrorLog will log messages )
- * or if not defined the compiler debug flag will be used.
- */
-
-#ifndef TEAGNOSTIC_H
- #define TEAGNOSTIC_H
-
- #include <sstream>
- #include <string>
- #include <iostream>
-
- #include <TeException.h>
- #include <TeErrorLog.h>
-
- /**
- * @brief TeAgnostic debug mode selection based on NDEBUG define.
- */
- #ifndef TEAGN_DEBUG_MODE
- #ifndef NDEBUG
- /** @brief Debug mode selection flag. */
- #define TEAGN_DEBUG_MODE
-
- /** @brief STDOUT logging selection flag. */
- #define TEAGN_ENABLE_STDOUT_LOG
- #endif
- #endif
-
- /**
- * @brief Logs a message to stdout
- *
- * @param message Message to be logged.
- */
- #ifdef TEAGN_ENABLE_STDOUT_LOG
- #define TEAGN_LOGMSG_STDOUT( message ) \
- std::cout << std::endl << "Message : " \
- << __FILE__ \
- << ":" << __LINE__ \
- << " - " << TeAgnostic::to_string( message ) \
- << std::endl;
- #else
- #define TEAGN_LOGMSG_STDOUT( message ) {};
- #endif
-
- /**
- * @brief Logs a error message to stderr
- *
- * @param message Message to be logged.
- */
- #ifdef TEAGN_ENABLE_STDOUT_LOG
- #define TEAGN_LOGERR_STDOUT( message ) \
- std::cerr << std::endl << "Error : " \
- << __FILE__ \
- << ":" << __LINE__ \
- << " - " << TeAgnostic::to_string( message ) \
- << std::endl;
- #else
- #define TEAGN_LOGERR_STDOUT( message ) {};
- #endif
-
- /**
- * @brief Logs a warning message to stdout
- *
- * @param message Message to be logged.
- */
- #ifdef TEAGN_ENABLE_STDOUT_LOG
- #define TEAGN_LOGWARN_STDOUT( message ) \
- std::cout << std::endl << "Warning : " \
- << __FILE__ \
- << ":" << __LINE__ \
- << " - " << TeAgnostic::to_string( message ) \
- << std::endl;
- #else
- #define TEAGN_LOGWARN_STDOUT( message ) {};
- #endif
-
-
- /**
- * @brief Logs a message.
- *
- * @param message Message to be logged.
- */
- #define TEAGN_LOGMSG( message ) \
- { \
- TeErrorLog::instance().insert( LOG_MESSAGE, \
- TeAgnostic::to_string( message ) ); \
- TEAGN_LOGMSG_STDOUT( message ); \
- };
-
- /**
- * @brief Logs a message.
- *
- * @param message Message to be logged.
- */
- #define TEAGN_LOGERR( message ) \
- { \
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE, \
- TeAgnostic::to_string( message ) ); \
- TEAGN_LOGERR_STDOUT( message ); \
- };
-
- /**
- * @brief Logs a warning message.
- *
- * @param message Message to be logged.
- */
- #define TEAGN_LOGWARN( message ) \
- { \
- TeErrorLog::instance().insert( LOG_MESSAGE, \
- TeAgnostic::to_string( message ) ); \
- TEAGN_LOGWARN_STDOUT( message ); \
- };
-
- /**
- * @brief Logs a message to stderr and throws.
- *
- * @param message Message to be logged.
- */
- #define TEAGN_LOG_AND_THROW( message ) \
- { \
- TEAGN_LOGERR_STDOUT( message ); \
- throw TeException( UNKNOWN_ERROR_TYPE, \
- TeAgnostic::to_string( message ), false ); \
- };
-
- /**
- * @brief Checks if value is true and throws an exception if not.
- *
- * @param value Value to be checked.
- * @param message Message to be logged.
- */
- #define TEAGN_TRUE_OR_THROW( value , message ) \
- if( value == 0 ) { \
- TEAGN_LOGERR_STDOUT( TeAgnostic::to_string( message ) + \
- " - " + TeAgnostic::to_string( #value ) ); \
- throw TeException( UNKNOWN_ERROR_TYPE, \
- TeAgnostic::to_string( message ), false ); \
- };
-
- /**
- * @brief Variable watching.
- *
- * @param variable Variable to be logged.
- */
- #define TEAGN_WATCH( variable ) \
- { \
- TEAGN_LOGMSG( "WATCH - " + TeAgnostic::to_string( #variable ) + \
- "=" + TeAgnostic::to_string( variable ) ); \
- };
-
- /**
- * @brief Checks if value is true and logs an warning message if not.
- *
- * @param value Value to be checked.
- * @param message Message to be logged.
- */
- #define TEAGN_TRUE_OR_LOG( value , message ) \
- if( value == 0 ) { \
- TEAGN_LOGWARN( TeAgnostic::to_string( message ) + \
- " - " + TeAgnostic::to_string( #value ) ); \
- };
-
- /**
- * @brief Checks if value is true. For false values a warning message will be logged
- * and a return of context with false value will be done.
- *
- * @param value Value to be checked.
- * @param message Message to be logged.
- */
- #define TEAGN_TRUE_OR_RETURN( value , message ) \
- if( value == 0 ) { \
- TEAGN_LOGWARN( TeAgnostic::to_string( message ) + \
- " - " + TeAgnostic::to_string( #value ) ); \
- return false; \
- };
-
- /**
- * @brief Checks if value is false. For true values a warning message
- * will be logged
- * and a return of context with false value will be done.
- *
- * @param value Value to be checked.
- * @param message Message to be logged.
- */
- #define TEAGN_FALSE_OR_RETURN( value , message ) \
- if( value != 0 ) { \
- TEAGN_LOGWARN( TeAgnostic::to_string( message ) + \
- " - " + TeAgnostic::to_string( #value ) ); \
- return false; \
- };
-
- /**
- * @brief Logs a warning message will and return false.
- *
- * @param message Message to be logged.
- */
- #define TEAGN_LOG_AND_RETURN( message ) \
- { \
- TEAGN_LOGWARN( message ); \
- return false; \
- };
-
- /**
- * @brief Checks if value is false and logs an warning message if not.
- *
- * @param value Value to be checked.
- * @param message Message to be logged.
- */
- #define TEAGN_FALSE_OR_LOG( value , message ) \
- if( value != 0 ) { \
- TEAGN_LOGWARN( TeAgnostic::to_string( message ) + \
- " - " + TeAgnostic::to_string( #value ) ); \
- };
-
- /**
- * @brief Checks if two values are equal and throws an exception if not.
- *
- * @param value1 Value to be checked.
- * @param value2 Value to be checked.
- * @param message Message to be logged.
- */
- #define TEAGN_CHECK_EQUAL( value1 , value2 , message ) \
- TEAGN_TRUE_OR_THROW( ( ((double)value1) == ((double)value2) ), \
- std::string( "Values must be equal [" ) + \
- TeAgnostic::to_string( value1 ) + "!=" + \
- TeAgnostic::to_string( value2 ) + "] - " + \
- TeAgnostic::to_string( message ) );
-
- /**
- * @brief Checks if two values are diferent and throws an exception if not.
- *
- * @param value1 Value to be checked.
- * @param value2 Value to be checked.
- * @param message Message to be logged.
- */
- #define TEAGN_CHECK_NOTEQUAL( value1 , value2 , message ) \
- TEAGN_TRUE_OR_THROW( ( ((double)value1) != ((double)value2) ), \
- std::string( "Values can't be equal [" ) + \
- TeAgnostic::to_string( #value1 ) + std::string( "==" ) + \
- TeAgnostic::to_string( #value2 ) + std::string( "==" ) + \
- TeAgnostic::to_string( value1 ) + std::string( "]" ) );
-
- /**
- * @brief Checks if two values are equal ( within an EPS ) and
- * throws an exception if not.
- *
- * @param value1 Value to be checked.
- * @param value2 Value to be checked.
- * @param eps EPS ( threshold )
- * @param message Message to be logged.
- */
- #define TEAGN_CHECK_EPS( value1 , value2 , eps , message ) \
- { \
- TEAGN_TRUE_OR_THROW( ( eps >= 0), "Invalid eps" ); \
- double TEAGN_CHECK_EPS_double_diff = 0; \
- double TEAGN_CHECK_EPS_double_value1 = (double)value1; \
- double TEAGN_CHECK_EPS_double_value2 = (double)value2; \
- double TEAGN_CHECK_EPS_double_eps = (double)eps; \
- if( TEAGN_CHECK_EPS_double_value1 < TEAGN_CHECK_EPS_double_value2 ) { \
- TEAGN_CHECK_EPS_double_diff = ( TEAGN_CHECK_EPS_double_value2 - \
- TEAGN_CHECK_EPS_double_value1 ); \
- } else { \
- TEAGN_CHECK_EPS_double_diff = ( TEAGN_CHECK_EPS_double_value1 - \
- TEAGN_CHECK_EPS_double_value2 ); \
- }; \
- TEAGN_TRUE_OR_THROW( \
- ( TEAGN_CHECK_EPS_double_diff <= TEAGN_CHECK_EPS_double_eps ), \
- std::string( "Values are not equal: " ) + \
- TeAgnostic::to_string( #value1 ) + \
- std::string( "=[") + \
- TeAgnostic::to_string( TEAGN_CHECK_EPS_double_value1 ) + \
- std::string( "] " ) + \
- TeAgnostic::to_string( #value2 ) + \
- std::string( "=[") + \
- TeAgnostic::to_string( TEAGN_CHECK_EPS_double_value2 ) + \
- std::string( "] eps=[") + \
- TeAgnostic::to_string( TEAGN_CHECK_EPS_double_eps ) + \
- std::string( "] diff=[") + \
- TeAgnostic::to_string( TEAGN_CHECK_EPS_double_diff ) + \
- std::string( "] - " ) + \
- TeAgnostic::to_string( message ) \
- ); \
- };
-
- /**
- * @brief Throws an exception for not implemented source.
- */
- #define TEAGN_NOT_IMPLEMENTED \
- TEAGN_LOG_AND_THROW( "Not Implemented." );
-
- /**
- * @brief Checks if Debug mode is enabled and throws an exception if not.
- */
- #define TEAGN_DEBUG_MODE_CHECK \
- TEAGN_TRUE_OR_THROW( TeAgnostic::debugModeCheck() , \
- "Code not compiled with debug" );
-
- /**
- * @brief Checks if value is true and throws an exception if not.
- *
- * @note This macro will be disabled for non debug mode.
- *
- * @param value Value to be checked.
- * @param message Message to be logged.
- */
- #ifdef TEAGN_DEBUG_MODE
- #define TEAGN_DEBUG_CONDITION( value , message ) \
- TEAGN_TRUE_OR_THROW( value , message );
- #else
- #define TEAGN_DEBUG_CONDITION( value , message ) {};
- #endif
-
- /**
- * @brief Checks if value is true. For false values a warning message will be logged
- * and a return of context with false value will be done.
- *
- * @note This macro will be disabled for non debug mode.
- *
- * @param value Value to be checked.
- * @param message Message to be logged.
- */
- #ifdef TEAGN_DEBUG_MODE
- #define TEAGN_DEBUG_RETURN( value , message ) \
- TEAGN_TRUE_OR_RETURN( value , message );
- #else
- #define TEAGN_DEBUG_RETURN( value , message ) {};
- #endif
-
- /**
- * @brief This namespace contains a set of routines and classes to deal with
- * system checking and logging facility.
- * @ingroup Utils
- */
- namespace TeAgnostic{
-
- /**
- * @brief Data conversion to string.
- *
- * @param data Data to be converted.
- * @return The converted string.
- */
- template< class T >
- std::string to_string( const T& data )
- {
- std::stringstream temp_ss;
- temp_ss.setf(std::ios_base::fixed);
- temp_ss << data;
- return temp_ss.str();
- }
-
- /**
- * @brief Checks if the code was compiled with debug mode.
- *
- * @return true if debug mode was used at compilation time. false if not.
- */
- TL_DLL bool debugModeCheck();
-
- };
-
-#endif
diff --git a/src/terralib/kernel/TeAkimaInterpolator.cpp b/src/terralib/kernel/TeAkimaInterpolator.cpp
deleted file mode 100644
index ca41677..0000000
--- a/src/terralib/kernel/TeAkimaInterpolator.cpp
+++ /dev/null
@@ -1,1067 +0,0 @@
-void TeFitLinearSurface (int idv, vector<TeTinVertex>& xyzd, vector<TePolyCoef>& cfl1)
-{
-// Least squares fit of a linear surface (plane) to z(x,y) values
-// Adapted from SUBROUTINE SDLS1P(NDP,XD,YD,ZD,IPC,NCP,CFL1) by
-// Hiroshi Akima, U.S. Department of Commerce, NTIA/ITS
-// Version of 1995/05
-// This subroutine performs the least squares fit of a linear
-// surface (plane) to a data point set consisting of the data
-// point in question and several data points closest to it.
-// The input arguments are
-// IDV = data point number,
-// XYZD = array of dimension NDP containing the x, y coordinates
-// and the z values at the data points,
-// The output argument is
-// CFL1 = two-dimensional array of dimension 2*NDP, where
-// the coefficients (a10, a01) of the least squares
-// fit, first-degree polynomial calculated at the
-// IDPth data point.
- list<int> ipc;
- list<int>::iterator vi;
- TeTin::vertexSecondNeighVertices(idv, ipc);
- vi = ipc.begin();
- if ( ipc.size() == 1 )
- {
- double x2x1 = xyzd[*vi].x() - xyzd[idp].x();
- double y2y1 = xyzd[*vi].y() - xyzd[idp].y();
- double z2z1 = xyzd[*vi].value() - xyzd[idp].value();
- double daux = z2z1/(x2x1*x2x1 + y2y1*y2y1);
- cfl1[idv].a10( x2x1*daux );
- cfl1[idv].a01( y2y1*daux );
- }
- else
- {
- double sx(0.), sy(0.), sxx(0.), sxy(0.), syy(0.), sz(0.), sxz(0.), syz(0.);
- double x, y, z;
- int i, idpi = idv;
- for (i = 0; i < 10; i++)
- {
- if (vi == ipc.end())
- break;
- x = xyzd[idpi];
- y = xyzd[idpi];
- z = xyzd[idpi];
- sx += x;
- sy += y;
- sxx += (x * x);
- sxy += (x * y);
- syy += (y * y);
- sz += z;
- sxz += (x * z);
- syz += (y * z);
- idpi = *vi;
- vi++;
- }
- double an = (double) (i > ipc.size() ? ipc.size() : 10);
- double a11 = (an * sxx) - (sx * sx);
- double a12 = (an * sxy) - (sx * sy);
- double a22 = (an * syy) - (sy * sy);
- double b1 = (an * sxz) - (sx * sz);
- double b2 = (an * syz) - (sy * sz);
- double dlt = (a11 * a22) - (a12 * a12);
- cfl1[idv].a10( ((b1 * a22) - (b2 * a12))/dlt );
- cfl1[idv].a01( ((b2 * a11) - (b1 * a12))/dlt );
- }
-}
-
-bool TeCalcPolynomialCoef (int idv, vector<TeTinVertex>& xyzd, int** ipc,
- vector<TePolyCoef>& cf, vector<int>& ncp, vector<int>& iord )
-{
-// Coefficients of the third-degree polynomial for z(x,y)
-// Adapted from SUBROUTINE SDCF3P(NDP,XD,YD,ZD,IPC,CF,NCP,IORD) by
-// Hiroshi Akima, U.S. Department of Commerce, NTIA/ITS
-// Version of 1995/05
-// This subroutine calculates, for each data point, coefficients
-// of the third-degree polynomial for z(x,y) fitted to the set of
-// 10 data points consisting of the data point in question and
-// nine data points closest to it. When the condition number of
-// the matrix associated with the 10 data point set is too large,
-// this subroutine calculates coefficients of the second-degree
-// polynomial fitted to the set of six data points consisting of
-// the data point in question and five data points closest to it.
-// When the condition number of the matrix associated with the six
-// data point set is too large, this subroutine calculates
-// coefficients of the first-degree polynomial fitted to the set of
-// three data points closest to the data point in question. When
-// the condition number of the matrix associated with the three data
-// point set is too large, this subroutine calculates coefficients
-// of the first-degree polynomial fitted to the set of two data
-// points consisting of the data point in question and one data
-// point closest to it, assuming that the plane represented by the
-// polynomial is horizontal in the direction which is at right
-// angles to the line connecting the two data points.
-// The input arguments are
-// IDV = data point number,
-// XYZD = array containing the x y
-// coordinates and the z values at the data points,
-// The output arguments are
-// CF = coefficients of the polynomial
-// (a10, a20, a30, a01, a11, a21, a02, a12, a03)
-// calculated at the IDPth data point.
-// NCP = integer array of dimension NDP, where the numbers
-// of the closest points used are to be stored.
-// IORD = integer array of dimension NDP containing the
-// degree of the polynomial used to compute PDD.
-// The constant in the first PARAMETER statement below is
-// CNRMX = maximum value of the ratio of the condition
-// number of the matrix associated with the point
-// set to the number of points.
-// The constant value has been selected empirically.
- double cnrmx = 3.5e+7; // PARAMETER (CNRMX=3.5E+07)
- cf[idp].Init(0.0);
- TeMatrix aa;
- aa.Init( 10, 10 );
- double cfi[10], b[10], cn;
- list<int> ipc;
- list<int>::iterator vi;
- TeTin::vertexSecondNeighVertices(idv, ipc);
- int i, idpi = idv;
- if (ipc.size >= 9) // Calculates the coefficients of the set of
- { // linear equations with the 10-point data point set.
- vi = ipc.begin();
- for (i = 0; i < 10; i++)
- {
- x = xyzd[idpi].x();
- y = xyzd[idpi].y();
- aa(i,0) = 1.0;
- aa(i,1) = x;
- aa(i,2) = x * x;
- aa(i,3) = x * x * x;
- aa(i,4) = y;
- aa(i,5) = x * y;
- aa(i,6) = x * x * y;
- aa(i,7) = y * y;
- aa(i,8) = x * y * y;
- aa(i,9) = y * y * y;
- b[i] = xyzd[idpi].value();
- idpi = *vi;
- vi++;
- }
- if ( ! TeSolveLinearEquations (aa, b, cfi, cn);
- {
- if (cn < cnrmx * 10.)
- {
- cf[idp].a10 (cfi[1]);
- cf[idp].a20 (cfi[2]);
- cf[idp].a30 (cfi[3]);
- cf[idp].a01 (cfi[4]);
- cf[idp].a11 (cfi[5]);
- cf[idp].a21 (cfi[6]);
- cf[idp].a02 (cfi[7]);
- cf[idp].a12 (cfi[8]);
- cf[idp].a03 (cfi[9]);
- ncp[idp] = 9;
- iord[idp] = 3;
- }
- }
- }
- else if (ipc.size() >= 6) // Calculates the coefficients of the set of
- { // linear equations with the 6-point data point set.
- aa.Init( 6, 6 );
- idpi = idp;
- vi = ipc.begin();
- for ( i = 0; i < 6; i++)
- {
- x = xyzd[idpi].x();
- y = xyzd[idpi].y();
- aa[i,0] = 1.0;
- aa[i,1] = x;
- aa[i,2] = x * x;
- aa[i,3] = y;
- aa[i,4] = x * y;
- aa[i,5] = y * y;
- b[i] = xyzd[idpi].value();
- idpi = *vi;
- vi++;
- }
- if ( TeSolveLinearEquations (aa, b, cfi, cn) )
- {
- if (cn < cbrmx * 6.)
- {
- cf[idv].a10 (cfi[1]);
- cf[idv].a20 (cfi[2]);
- cf[idv].a01 (cfi[3]);
- cf[idv].a11 (cfi[4]);
- cf[idv].a02 (cfi[5]);
- ncp[idv] = 5;
- iord[idv] = 2;
- }
- }
- }
- else if (ipc.size() >= 3) // Calculates the coefficients of the set of
- { // linear equations/ with the 3-point data point set.
- aa.Init( 3, 3 );
- vi = ipc.begin();
- for (i = 0; i < 3; i++)
- {
- idpi = *vi;
- vi++;
- x = xyzd[idpi].x();
- y = xyzd[idpi].y();
- aa[i,0] = 1.0;
- aa[i,1] = x;
- aa[i,2] = y;
- b[i] = xyzd[idpi].value();
- }
- if ( TeSolveLinearEquations (aa, b, cfi, cn) )
- {
- if (cn < cbrmx * 3.)
- {
- cf[idv].a10 (cfi[1]);
- cf[idv].a01 (cfi[2]);
- ncp[idv] = 3;
- iord[idv] = 1;
- }
- }
- }
- else if (ipc.size() >= 1) // Calculates the coefficients of the set of
- {// linear equations with the 2-point data point set when applicable.
- double x2x1 = xyzd[*vi].x() - xyzd[idp].x();
- double y2y1 = xyzd[*vi].y() - xyzd[idp].y();
- double z2z1 = xyzd[*vi].value() - xyzd[idp].value();
- double daux = z2z1/(x2x1*x2x1 + y2y1*y2y1);
- cf[idv].a10( x2x1*daux );
- cf[idv].a01( y2y1*daux );
- ncp[idp] = 1;
- iord[idp] = 0;
- }
- else
- return false;
- return true;
-} // END
-
-void TeCalcPartialDerivatives (int idv, vector<TeTinVertex>& xyzd, vector<TePartialDeriv>& pdd )
-{
-// Partial derivatives for bivariate interpolation and surface
-// fitting for scattered data
-// Adapted from SUBROUTINE SDPD3P(NDP,XD,YD,ZD,PDD,CF3,CFL1,DSQ,IDSQ,IPC,NCP,IORD)
-// by Hiroshi Akima, U.S. Department of Commerce, NTIA/ITS
-// Version of 1995/05
-// This subroutine estimates partial derivatives of the first and
-// second orders at the data points for bivariate interpolation
-// and surface fitting for scattered data. In most cases, this
-// subroutine has the accuracy of a cubic (third-degree)
-// polynomial.
-//
-// The input arguments are
-// IDV = data point number,
-// XYZD = array containing the x y and the z values
-// at the data points.
-// The output arguments are
-// PDD = estimated zx, zy, zxx, zxy, and zyy values
-// at the IDV data point.
-// The constant in the first PARAMETER statement below is
-// NPEMX = maximum number of primary estimates.
-// The constant value has been selected empirically.
-// PARAMETER (NPEMX=25)
- list<int> ipc;
- list<int>::iterator vi;
- TeTin::vertexSecondNeighVertices(idv, ipc);
- vi = ipc.begin();
- int i, idpi;
- double x = xyzd[idv].x();
- double y = xyzd[idv].y();
- TePartialDeriv pdpe[25];
- for (i = 0; i < 25; i++)
- {
- idpi = *vi;
- pdpe[i].zx ( cf3[idpi].a10() + x*(2.*cf3[idpi].a20() + x*3.*cf3[idpi].a30()) +
- y*(cf3[idpi].a11() + 2.*cf3[idpi].a21()*x + cf3[idpi].a12()*y) );
- pdpe[i].zy ( cf3[idpi].a01() + y*(2.*cf3[idpi].a02() + y*3.*cf3[idpi].a03()) +
- x*(cf3[idpi].a11() + 2.*cf3[idpi].a12()*y + cf3[idpi].a21()*x) );
- pdpe[i].zxx( 2.*cf3[idpi].a20() + 6.*cf3[idpi].a30()*x + 2.*cf3[idpi].a21()*y );
- pdpe[i].zxy( cf3[idpi].a11() + 2.*cf3[idpi].a21()*x + 2.*cf3[idpi].a12()*y );
- pdpe[i].zyy( 2.*cf3[idpi].a02() + 6.*cf3[idpi].a03()*y + 2.*cf3[idpi].a12()*x );
-
- vi++;
- if ( vi == ipc.end() )
- break;
- }
- int npe = i;
- if (npe == 1) // Only one qualified point set
- pdd[idv] = pdpe[0];
- else
- { // Weighted values of partial derivatives.
- TePartialDeriv ampdpe; // Calculates the probability weight.
- for (i = 0; i < npe; i++)
- ampdpe = ampdpe + pdpe[i];
- ampdpe = ampdpe/(double)npe;
-
- TePartialDeriv sspdpe; // Calculates the unbiased estimate of variance
- for (i = 0 ; i < npe; i++)
- sspdpe = sspdpe + (pdpe[i]-ampdpe)*(pdpe[i]-ampdpe);
- sspdpe = sspdpe/(double)(npe-1);
-
- for (i = 0; i < npe; i++)
- {
- double alpwt = 0.;
- if (sspdpe.zx() != 0.)
- alpwt += ((pdpe[i].zx()-ampdpe.zx())^2)/sspdpe.zx();
- if (sspdpe.zy() != 0.)
- alpwt += ((pdpe[i].zy()-ampdpe.zy())^2)/sspdpe.zy();
- if (sspdpe.zxx() != 0.)
- alpwt += ((pdpe[i].zxx()-ampdpe.zxx())^2)/sspdpe.zxx();
- if (sspdpe.zyy() != 0.)
- alpwt += ((pdpe[i].zyy()-ampdpe.zyy())^2)/sspdpe.zyy();
- if (sspdpe.zxy() != 0.)
- alpwt += ((pdpe[i].zxy()-ampdpe.zxy())^2)/sspdpe.zxy();
- pwt[i] = exp(-alpwt/2.);
- }
- // Calculates the reciprocal of the volatility weight.
- vi = ipc.begin();
- for (i = 0; i < npe; i++)
- {
- idpi = *vi;
- zx = cfl1[idpi].a10();
- zy = cfl1[idpi].a01();
- rvwt[i] = ((pdpe[i].zx()-zx)*(pdpe[i].zx()-zx) +
- (pdpe[i].zy()-zy)*(pdpe[i].zy()-zy))*
- (pdpe[i].zxx()*pdpe[i].zxx() +
- 2.*pdpe[i].zxy()*pdpe[i].zxy() +
- pdpe[i].zyy()*pdpe[i].zyy());
- vi++;
- }
- // Calculates the weighted values of partial derivatives.
- TePartialDeriv pddik, pddii;
- double smwtf = 0., smwti = 0. wtf, wti;
- for (i = 0; i < npe; i++)
- {
- if (rvwt[i] > 1e-38)
- {
- wtf = pwt[i]/rvwt[i];
- pddif = pddif + pdpe[i]*wtf;
- smwtf = smwtf + wtf;
- }
- else
- {
- wti = pwt[i];
- pddii = pddii + pdpe[i]*wti;
- smwti = smwti + wti;
- }
- }
- if (smwti < 0.)
- pdd[idv] = pddif/smwtf;
- else
- pdd[idv] = pddii/smwti;
- }
- }
-}
-
-void TeCalcZPolynomial (int ndp, vector<TeTinVertex>& xyzd, vector<TePartialDeriv>& pdd,
- vector<int>& iord )
-{
-// SUBROUTINE SDPLNL(NDP,XD,YD,ZD,NT,IPT,NL,IPL,PDD,NIP,XI,YI,KTLI,
-// + ITLI,ZI)
-//
-// Polynomials
-// (a supporting subroutine of the SDBI3P/SDSF3P subroutine package)
-//
-// Hiroshi Akima
-// U.S. Department of Commerce, NTIA/ITS
-// Version of 1995/05
-//
-// This subroutine determines a polynomial in x and y for each
-// triangle or rectangle in the x-y plane and calculates the z
-// value by evaluating the polynomial for the desired points,
-// for bivariate interpolation and surface fitting for scattered
-// data.
-//
-// The input arguments are
-// NDP = number of data points,
-// XD = array of dimension NDP containing the x
-// coordinates of the data points,
-// YD = array of dimension NDP containing the y
-// coordinates of the data points,
-// ZD = array of dimension NDP containing the z
-// values at the data points,
-// NT = number of triangles,
-// IPT = two-dimensional integer array of dimension 3*NT
-// containing the point numbers of the vertexes of
-// the triangles,
-// NL = number of border line segments,
-// IPL = two-dimensional integer array of dimension 2*NL
-// containing the point numbers of the end points of
-// the border line segments,
-// PDD = two-dimensional array of dimension 5*NDP
-// containing the partial derivatives at the data
-// points,
-// NIP = number of output points at which interpolation is
-// to be performed,
-// XI = array of dimension NIP containing the x
-// coordinates of the output points,
-// YI = array of dimension NIP containing the y
-// coordinates of the output points,
-// KTLI = integer array of dimension NIP, each element
-// containing the code for the type of the piece of
-// the plane in which each output point lies
-// = 1 for a triangle inside the data area
-// = 2 for a rectangle on the right-hand side of a
-// border line segment
-// = 3 for a triangle between two rectangles on the
-// right-hand side of two consecutive border
-// line segments
-// = 4 for the triangle which is an overlap of two
-// rectangles on the right-hand side of two
-// consecutive border line segments,
-// ITLI = integer array of dimension NIP containing the
-// triangle numbers or the (second) border line
-// segment numbers corresponding to the output
-// points.
-//
-// The output argument is
-// ZI = array of dimension NIP, where the calculated z
-// values are to be stored.
-//
-//
-// Specification statements
-// .. Scalar Arguments ..
- INTEGER NDP,NIP,NL,NT
-// ..
-// .. Array Arguments ..
- REAL PDD(5,NDP),XD(NDP),XI(NIP),YD(NDP),YI(NIP),
- + ZD(NDP),ZI(NIP)
- INTEGER IPL(2,NL),IPT(3,NT),ITLI(NIP),KTLI(NIP)
-// ..
-// .. Local Scalars ..
- REAL A,AA,AB,ACT2,AD,ADBC,AP,B,BB,BC,BDT2,BP,C,CC,CD,
- + CP,D,DD,DLT,DP,DX,DY,E1,E2,G1,G2,H1,H2,H3,LUSQ,
- + LVSQ,P0,P00,P01,P02,P03,P04,P05,P1,P10,P11,P12,
- + P13,P14,P2,P20,P21,P22,P23,P3,P30,P31,P32,P4,P40,
- + P41,P5,P50,SPUV,U,V,WT1,WT2,X0,XII,Y0,YII,Z0,ZII,
- + ZII1,ZII2
- INTEGER I,IDP,IIP,ILI,IR,ITLII,ITLIPV,K,KTLII,KTLIPV
-// ..
-// .. Local Arrays ..
- REAL PD(5,3),X(3),Y(3),Z(3),ZU(3),ZUU(3),ZUV(3),ZV(3),
- + ZVV(3)
-// ..
-// .. Intrinsic Functions ..
- INTRINSIC MOD
-// ..
-// Outermost DO-loop with respect to the output point
- for (iip = 0; iip < nip; iip++) // DO 120 IIP = 1,NIP
- {
- ktlii = ktli[iip]; // KTLII = KTLI(IIP)
- itlii = itli[iip]; // ITLII = ITLI(IIP)
- if (iip == 0 ) // IF (IIP.EQ.1) THEN
- {
- ktlipv = 0; // KTLIPV = 0
- itlipv = 0; // ITLIPV = 0
- }
- else // ELSE
- {
- ktlipv = ktli[iip-1]; // KTLIPV = KTLI(IIP-1)
- itlipv = itli[iip-1]; // ITLIPV = ITLI(IIP-1)
- } // END IF
- TeTinPolynomial tinPoly;
-// Part 1. Calculation of ZII by interpolation
- switch (ktlii)
- {
- case 1: // IF (KTLII.EQ.1) THEN
- {
- if ( (ktlii != ktlipv) || (itlii != itlipv))// IF (KTLII.NE.KTLIPV .OR. ITLII.NE.ITLIPV) THEN
- // Calculates the coefficients when necessary.
- TeTin::defineTrianglePolynomial ( itlii, tinPoly );
- xyz[iip].value( tinPoly.Solve( xyzd[iip].location()) );
- } // END IF
- // Part 2. Calculation of ZII by extrapolation in the rectangle
- case 2: // IF (KTLII.EQ.2) THEN
- // Calculates the coefficients when necessary.
- {
- if ( (ktlii != ktlipv) || (itlii != itlipv))// IF (KTLII.NE.KTLIPV .OR. ITLII.NE.ITLIPV) THEN
- TeTin::defineEdgePolynomial ( itlii, tinPoly );
- xyz[iip].value( tinPoly.Solve( xyzd[iip].location()) );
- // Part 3. Calculation of ZII by extrapolation in the triangle
- case 3: // IF (KTLII.EQ.3) THEN
- {
- // Calculates the coefficients when necessary.
- if ( (ktlii != ktlipv) || (itlii != itlipv))// IF (KTLII.NE.KTLIPV .OR. ITLII.NE.ITLIPV) THEN
- // Loads coordinate and partial derivative values at the vertex
- // of the triangle.
- TeTin::defineVertexPolynomial ( itlii, tinPoly );
-
- xyz[iip].value( tinPoly.Solve( xyzd[iip].location()) );
- } // END IF
-
- // Part 4. Calculation of ZII by extrapolation in the triangle
- // which is an overlap of two rectangles.
- case 4: // IF (KTLII.EQ.4) THEN
- {
- int itlim1 = border[(itlii - 1)%nl];
- TeCoord2D pt0 = TeTin::edge(itlii).from();
- TeCoord2D pt1 = TeTin::edge(itlii).to();
- TeCoord2D pt2;
- if ( TeTin::edge(itlim1).from() == pt0 )
- {
- pt2 = TeTin::edge(itlim1).to();
- }
- else if ( TeTin::edge(itlim1).to() == pt0 )
- {
- pt2 = TeTin::edge(itlim1).to();
- }
- else
- {
- pt2 = pt0;
- pt0 = pt1;
- pt1 = pt2;
- if ( TeTin::edge(itlim1).from() == pt0 )
- pt2 = TeTin::edge(itlim1).to();
- else
- pt2 = TeTin::edge(itlim1).from();
- }
- TeTin::defineEdgePolynomial ( border[itlii], tinPoly );
- double z1 = tinPoly.Solve( xyzd[iip].location() );
- double wt1 = ((pt1.x()-pt0.x())*(xyzd[iip].x()-pt0.x())+
- (pt1.y()-pt0.y())*(xyzd[iip].y()-pt0.x()))^2.;
-
- TeTin::defineEdgePolynomial ( border[itlim1], tinPoly );
- double z2 = tinPoly.Solve( xyzd[iip].location() );
- double wt2 = ((pt2.x()-pt0.x())*(xyzd[iip].x()-pt0.x())+
- (pt2.y()-pt0.y())*(xyzd[iip].y()-pt0.x()))^2.;
-
- xyz[iip].value( (wt1*z1 + wt2*z2) / (wt1+wt2) );
- } // END IF
- } // 120 CONTINUE
-} // END
-
-void TeRegressionMatrixSetRow (double xk, double yk, double zk, double xi,
- double yi, double zi, double s1, double s2,
- double s3, double w, double* row)
-{
-// Adapted from SUBROUTINE SETRO3(XK,YK,ZK,XI,YI,ZI,S1,S2,S3,W,ROW)
-// from SRFPACK by Robert J. Renka, Dept. of Computer Science,
-// Univ. of North Texas,(817) 565-2767,01/25/97
-// This subroutine sets up the I-th row of an augmented re-
-// gression matrix for a weighted least squares fit of a
-// cubic function f(x,y) to a set of data values z, where
-// f(XK,YK) = ZK. The first four columns (cubic terms) are
-// scaled by S3, the next three columns (quadratic terms)
-// are scaled by S2, and the eighth and ninth columns (lin-
-// ear terms) are scaled by S1.
-// On input:
-// XK,YK = Coordinates of node K.
-// ZK = Data value at node K to be interpolated by f.
-// XI,YI,ZI = Coordinates and data value at node I.
-// S1,S2,S3 = Scale factors.
-// W = Weight associated with node I.
-// The above parameters are not altered by this routine.
-// ROW = Array of length 10.
-// On output:
-// ROW = Array containing a row of the augmented re-
-// gression matrix.
- double dx = xi - xk; // DX = XI - XK
- double dy = yi - yk; // DY = YI - YK
- double w1 = s1*w; // W1 = S1*W
- double w2 = s2*w; // W2 = S2*W
- double w3 = s3*w; // W3 = S3*W
- row[0] = dx*dx*dx*w3; // ROW(1) = DX*DX*DX*W3
- row[1] = dx*dx*dy*w3; // ROW(2) = DX*DX*DY*W3
- row[2] = dx*dy*dy*w3; // ROW(3) = DX*DY*DY*W3
- row[3] = dy*dy*dy*w3; // ROW(4) = DY*DY*DY*W3
- row[4] = dx*dx*w2; // ROW(5) = DX*DX*W2
- row[5] = dx*dy*w2; // ROW(6) = DX*DY*W2
- row[6] = dy*dy*w2; // ROW(7) = DY*DY*W2
- row[7] = dx*w1; // ROW(8) = DX*W1
- row[8] = dy*w1; // ROW(9) = DY*W1
- row[9] = (zi-zk)*w; // ROW(10) = (ZI-ZK)*W
-} // RETURN
- // END
-
-void TeGivensRotate (int n, double c, double s, vector<double>& x,
- vector<double>& y)
-{
-// Adapted from SUBROUTINE ROTATE(N,C,S,X,Y) from SRFPACK by
-// Robert J. Renka, Dept. of Computer Science, Univ. of North Texas
-// (817) 565-2767 09/01/88
-// This subroutine applies the Givens rotation ( C S) to
-// (-S C)
-// the 2 by N matrix (X(1) ... X(N)) .
-// (Y(1) ... Y(N))
-// On input:
-// N = Number of columns to be rotated.
-// C,S = Elements of the Givens rotation. Refer to
-// subroutine GIVENS.
-// The above parameters are not altered by this routine.
-// X,Y = Arrays of length .GE. N containing the compo-
-// nents of the vectors to be rotated.
-// On output:
-// X,Y = Arrays containing the rotated vectors (not
-// altered if N < 1).
- int i;
- double xi, yi;
- for (i = 0; i < n; i++) // DO 10 I = 1,N
- {
- xi = x[i]; // XI = X(I)
- yi = y[i]; // YI = Y(I)
- x[i] = c*xi + s*yi; // X(I) = C*XI + S*YI
- y[i] = -s*xi + c*yi; // Y(I) = -S*XI + C*YI
- } // 10 CONTINUE
-} // RETURN
- // END
-
-void TeGivensBuild (double& a, double& b, double& c, double& s)
-{
-// Adapted from SUBROUTINE GIVENS(A,B,C,S) from SRFPACK by
-// Robert J. Renka, Dept. of Computer Science, Univ. of North Texas
-// (817) 565-2767 09/01/88
-// This subroutine constructs the Givens plane rotation,
-// G = ( C S) , where C*C + S*S = 1,
-// (-S C)
-// which zeros the second component of the vector (A,B)**T
-// (transposed). Subroutine ROTATE may be called to apply
-// the transformation to a 2 by N matrix.
-// On input:
-// A,B = Components of the vector defining the rota-
-// tion. These are overwritten by values R
-// and Z (described below) which define C and S.
-// On output:
-// A = Signed Euclidean norm R of the input vector:
-// R = +/-SQRT(A*A + B*B)
-// B = Value Z such that:
-// C = SQRT(1-Z*Z) and S=Z if ABS(Z) .LE. 1, and
-// C = 1/Z and S = SQRT(1-C*C) if ABS(Z) > 1.
-// C = +/-(A/R) or 1 if R = 0.
-// S = +/-(B/R) or 0 if R = 0.
- double aa = a; // AA = A
- double bb = b; // BB = B
- if (fabs(aa) > fabs(bb)) // IF (ABS(AA).LE.ABS(BB)) GO TO 10
- { // ABS(A) > ABS(B).
- u = aa + aa; // U = AA + AA
- v = bb/u; // V = BB/U
- r = sqrt(.25+v*v)*u; // R = SQRT(.25+V*V)*U
- c = aa/r; // C = AA/R
- s = v*(c+c); // S = V* (C+C)
-// Note that R has the sign of A, C > 0, and S has
-// SIGN(A)*SIGN(B).
- b = s; // B = S
- a = r; // A = R
- } // RETURN
- else
- { // ABS(A) .LE. ABS(B).
- if (bb != 0.) // 10 IF (BB.EQ.0.) GO TO 20
- {
- u = bb + bb; // U = BB + BB
- v = aa/u; // V = AA/U
-// Store R in A.
- a = sqrt(.25+v*v)*u;// A = SQRT(.25+V*V)*U
- s = bb/a; // S = BB/A
- c = v*(s+s); // C = V* (S+S)
-// Note that R has the sign of B, S > 0, and C has
-// SIGN(A)*SIGN(B).
- b = 1.; // B = 1.
- if (c != 0) // IF (C.NE.0.) B = 1./C
- b = 1./c;
- } // RETURN
- else
- { // A = B = 0.
- c = 1.; // 20 C = 1.
- s = 0.; // S = 0.
- } // RETURN
- }
-} // END
-
-void TeEstimateCubicDerivatives (int k)
-{
-// Adapted from SUBROUTINE GRADC(K,NCC,LCC,N,X,Y,Z,LIST,LPTR,LEND,DX,DY,DXX,DXY,
-// DYY,IER) from SRFPACK by Robert J. Renka, Dept. of Computer Science
-// Univ. of North Texas (817) 565-2816 01/25/97
-// Given a Delaunay triangulation of N points in the plane
-// with associated data values Z, this subroutine estimates
-// first and second partial derivatives at node K. The der-
-// ivatives are taken to be the partials at K of a cubic
-// function which interpolates Z(K) and fits the data values
-// at a set of nearby nodes in a weighted least squares
-// sense. A Marquardt stabilization factor is used if neces-
-// sary to ensure a well-conditioned system. Thus, a unique
-// solution exists if there are at least 10 noncollinear
-// nodes.
-// K = Index of the node at which derivatives are to be
-// estimated.
-// N = Number of nodes in the triangulation.
-// On output:
-// DX,DY = Estimated first partial derivatives at node
-// K unless IER < 0.
-// DXX,DXY,DYY = Estimated second partial derivatives
-// at node K unless IER < 0.
- TeMatrix a;
- a.Init( 10, 10 );
- int lmn = 14, lmx = 30; // PARAMETER (LMN=14,LMX=30)
- int lmin = min(lmn,n); // LMIN = MIN(LMN,N)
- int lmax = min(lmx,n); // LMAX = MIN(LMX,N)
- double rtol = 1.0e-5, dtol = 0.01; // Tolerance for detecting an
- // ill-conditioned system.
- list<int> npts; // Indexes of a sequence of nodes ordered by distance from K.
- TeTin::vertexSecondNeighVertices(k, npts);
- double sum = 0.; //Sum of squared distances between node K and
- // the nodes used in the least squares fit
- double ds = 0; //Squared distance between nodes K and NPTS(LNP)
- double dist2;
- int i, j;
- list<int>::iterator vii;
- vii = npts.begin();
- for (i = 0; i < 29; i++)
- {
- dist2 = TeSquaredDistance ( xyzd[*vii].location() - xyzd[k].location() );
- vii++;
- if (i == 11)
- {
- ds = dist2;
- sum += dist2;
- }
- else if (i > 11)
- {
- if ((dist2-ds)/ds < rtol)
- sum += dist2;
- else
- {
- i++;
- break;
- }
- }
- else
- sum += dist2;
- if ( vii == npts.end() )
- {
- i++;
- break;
- }
- }
- int lnp = i;
- double rs = dist2;
- if (lnp == 29)
- rs = 1.1 * dist2;
-// There are LNP-2 equations corresponding to nodes NPTS(2),
-// ...,NPTS(LNP-1).
- double sfs = (double)(lnp)/sum; // 40 SFS = REAL(LNP-2)/SUM
- double sf = sqrt(sfs); // SF = SQRT(SFS)
- double sfc = sf*sfs; // SFC = SF*SFS
- double rin = 1./(sqrt(rs)); // RIN = 1./SQRT(RS)
- double xk = xyzd[k].x(); // XK = X(KK)
- double yk = xyzd[k].y(); // YK = Y(KK)
- double zk = xyzd[k].value(); // ZK = Z(KK)
- double w;
- vii = npts.begin();
- for (i = 0; i < 9; i++) // DO 60 I = 1,9
- {
- w = 1./( TeSquaredDistance ( xyzd[*vii].location() - xyzd[k].location() ) - rin;
-// W = 1./DIST(I+1) - RIN
- TeRegressionMatrixSetRow (xk, yk, zk, xyzd[*vii].x(), xyzd[*vii].y(),
- xyzd[*vii].value(), sf, sfs, sfc, w, a.Row(i));
- if (i == 0) // IF (I.EQ.1) GO TO 60
- continue;
- for (j = 0; j < i; j++) // DO 50 J = 1,I - 1
- {
- TeGivensBuild (a(j,j), a(j,i), c, s);// CALL GIVENS(A(J,J),A(J,I),C,S)
- TeGivensRotate (10-j, c, s, a(j+1,j), a(j+1,i));
- } // 50 CONTINUE
- } // 60 CONTINUE
-// Add the additional equations to the system using the last column of A.
- i = 10; // I = 11
- while (i < lnp) // I = 11
- {
- i++;
- w = 1./( TeSquaredDistance ( xyzd[*vii].location() - xyzd[k].location() ) - rin;
- TeRegressionMatrixSetRow (xk, yk, zk, xyzd[*vii].x(), xyzd[*vii].y(),
- xyzd[*vii].value(), sf, sfs, sfc, w, a.Row(9));
- for (j = 0; j < 9; j++) // DO 80 J = 1,9
- {
- TeGivensBuild (a(j,j), a(j,9), c, s);
- TeGivensRotate (10-j, c, s, a(j+1,j), a(j+1,9));
- } // 80 CONTINUE
- vii++;
- if (i == lnp-1)
- {
- // Test the system for ill-conditioning.
- dmin = fabs(a(0,0));
- for (j = 0; j < 9; j++)
- dmin = (fabs(a(j,j) < dmin) ? fabs(a(j,j) : dmin;
- if ( (dmin/w < dtol) && (lnp < 30) && (vii != npts.end()) )
- {
- lnp++; // LNP = LNP + 1
- if (lnp < 30) // IF (LNP.LE.LMAX) THEN
- rs = TeSquaredDistance ( xyzd[*vii].location() - xyzd[k].location() ) - rin;
- rin = 1./sqrt(1.1*rs); // RIN = 1./SQRT(1.1*RS)
- }
- }
- }
-// Stabilize the system by damping third partials -- add
-// multiples of the first four unit vectors to the first
-// four equations.
- stf = w; // STF = W
- for (i = 0; i < 4; i++) // DO 110 I = 1,4
- {
- a(i,9) = stf; // A(I,10) = STF
- for (j = i+1; j < 10; j++) // DO 90 J = I + 1,10
- a(j,9) = 0.; // A(J,10) = 0.
- // 90 CONTINUE
- for (j = i; j < 9; j++) // DO 100 J = I,9
- {
- TeGivensBuild (a(j,j), a(j,9), c, s);
- TeGivensRotate (10-j, c, s, a(j=1,j), a(j+1,9));
- } // 100 CONTINUE
- } // 110 CONTINUE
-// Test the damped system for ill-conditioning.
- dmin = fabs(a(4,4));
- for (j = 5; j < 9; j++)
- dmin = (fabs(a(j,j) < dmin) ? fabs(a(j,j) : dmin;
- // DMIN = MIN(ABS(A(5,5)),ABS(A(6,6)),ABS(A(7,7)),ABS(A(8,8)),
- // + ABS(A(9,9)))
- if (dmin/w < dtol) // IF (DMIN/W.LT.DTOL) GO TO 140
- // No unique solution due to collinear nodes.
- return false; // RETURN
-
-// Solve the 9 by 9 triangular system for the last 5
-// components (first and second partial derivatives).
- dy = a(9,8) /a(8,8);
- dx = (a(9,7) -a(8,7)*dy)/a(7,7);
- dyy = (a(9,6) -a(7,6)*dx-a(8,6)*dy)/a(6,6);
- dxy = (a(9,5) -a(6,5)*dyy-a(7,5)*dx-a(8,5)*dy)/a(5,5);
- dxx = (a(9,4)-a(5,4)*dxy-a(6,4)*dyy-a(7,4)*dx-a(8,4)*dy)/a(4,4);
-// Scale the solution components.
- dx = sf*dx; // DX = SF*DX
- dy = sf*dy; // DY = SF*DY
- dxx = 2.*sfs*dxx; // DXX = 2.*SFS*DXX
- dxy = sfs*dxy; // DXY = SFS*DXY
- dyy = 2.*sfs*dyy; // DYY = 2.*SFS*DYY
- return true;
-} // RETURN
- // END
-/*
- zz.Init( aa.Nrow(), aa.Ncol() );
-
-// Calculation of inverse matrix of AA
- for (ij = 0; ij < n; ij++) // DO 110 IJ = 1,N
- {
-// Finds out the element having the maximum absolute value in the
-// IJ th row.
- aamx = fabs (aa(ij,ij)); // AAMX = ABS(AA(IJ,IJ))
- jmx = ij; // JMX = IJ
- for ( j = ij; j < n; j++) // DO 40 J = IJ,N
- {
- if ( fabs (aa(ij,j) > aamx )// IF (ABS(AA(IJ,J)).GT.AAMX) THEN
- {
- aamx = fabs (aa(ij,j)); // AAMX = ABS(AA(IJ,J))
- jmx = j; // JMX = J
- } // END IF
- } //40 CONTINUE
-// Switches two columns in such a way that the element with the
-// maximum value is on the diagonal.
- for (i = 0; i < n; i++) // DO 50 I = 1,N
- {
- aaijmx = aa(i,ij); // AAIJMX = AA(I,IJ)
- aa(i,ij) = aa (i,jmx); // AA(I,IJ) = AA(I,JMX)
- aa(i,jmx) = aaijmx; // AA(I,JMX) = AAIJMX
- } //50 CONTINUE
- kjmx = k[ij]; // KJMX = K(IJ)
- k[ij] = k[jmx]; // K(IJ) = K(JMX)
- k[jmx] = kjmx; // K(JMX) = KJMX
-// Makes the diagonal element to be unity.
- aaijij = aa(ij,ij); // AAIJIJ = AA(IJ,IJ)
-//CHANGED from Valtulina : IF (AAIJIJ.EQ.0.0) GO TO 210
- if (fabs(aaijij) < 1.0e-8) // IF (ABS(AAIJIJ).LT.1.0E-8) GO TO 210
- {
- //GOTO 210
-// Special case where the determinant is zero
- for (i = 0; i < n; i++) //210 DO 220 I = 1,N
- x(i) = 0.0; // X(I) = 0.0
- //220 CONTINUE
- det = 0.0; // DET = 0.0
- return; // RETURN
- }
- for (j = ij; j < n; j++) // DO 60 J = IJ,N
- aa(ij,j) = aa(ij,j)/aaijij; // AA(IJ,J) = AA(IJ,J)/AAIJIJ
- //60 CONTINUE
- for (jj = 0; j < n; j++) // DO 70 JJ = 1,N
- ee(ij,jj) = ee(ij,jj)/aaijij;// EE(IJ,JJ) = EE(IJ,JJ)/AAIJIJ
- //70 CONTINUE
-// Eliminates the lower left elements.
- if (ij < n) // IF (IJ.LT.N) THEN
- {
- ijp1 = ij + 1; // IJP1 = IJ + 1
- for ( i = ijp1; i < n; i++) // DO 100 I = IJP1,N
- {
- aaiij = aa (i,ij); // AAIIJ = AA(I,IJ)
- for ( j = ijp1; j < n; j++) // DO 80 J = IJP1,N
- aa(i,j) = aa(i,j) - aa(ij,j)*aaiij; // AA(I,J) = AA(I,J) - AA(IJ,J)*AAIIJ
- //80 CONTINUE
- for (jj = 0; jj < n; jj++) // DO 90 JJ = 1,N
- ee(i,jj)= ee(i,jj) - ee(ij,jj)*aaij;// EE(I,JJ) = EE(I,JJ) - EE(IJ,JJ)*AAIIJ
- //90 CONTINUE
- } //100 CONTINUE
- } // END IF
-// Calculates the determinant.
- //DELETED from Valtulina
- //DELETED IF (IJ.EQ.1) THEN
- //DELETED DET = 0.0
- //DELETED SGN = 1.0
- //DELETED END IF
- //DELETED SGN = SGN* ((-1)** (IJ+JMX))
- //DELETED DET = DET + LOG(ABS(AAIJIJ))
- } //110 CONTINUE
- //DELETED IF (DET.LT.85.0) THEN
- //DELETED DET = SGN*EXP(DET)
- //DELETED ELSE
- //DELETED DET = SGN*1.0E38
- //DELETED END IF
-
-//ADDED from Valtulina : at this point DET must be not equal 0
- det = 1.0; // DET=1.0
-// Calculates the elements of the inverse matrix.
- for (ijr = 0; ijr < n; ijr++) // DO 140 IJR = 1,N
- {
- ij = n + 1 - ijr; // IJ = N + 1 - IJR
- if (ij < n) // IF (IJ.LT.N) THEN
- {
- ijp1 = ij + 1; // IJP1 = IJ + 1
- for (j=ijp1; j < n; j++) // DO 130 J = IJP1,N
- for (jj = 0; jj < n; jj++ )// DO 120 JJ = 1,N
- ee(ij,jj) = ee(ij,jj) -aa(ij,j)*ee(j,jj)// EE(IJ,JJ) = EE(IJ,JJ) - AA(IJ,J)*EE(J,JJ)
- //120 CONTINUE
- //130 CONTINUE
- } // END IF
- } //140 CONTINUE
- for ( j = 0; j < n; j++ ) // DO 160 J = 1,N
- {
- i = k[j]; // I = K(J)
- for ( jj = 0; jj < n; jj++ )// DO 150 JJ = 1,N
- zz(i,jj) = ee(j,jj); // ZZ(I,JJ) = EE(J,JJ)
- //150 CONTINUE
- } //160 CONTINUE
-*/
-/*
-// Outermost DO-loop with respect to the data point
- for (idp1 = 0; idp1 < ndp; idp1++) // DO 310 IDP1 = 1,NDP
-// Selects data point sets for sets of primary estimates of partial
-// derivatives.
-// - Selects a candidate.
- {
- npe = 0; // NPE = 0
- for (idp2 = 0; idp2 < ndp; idp2++)// DO 80 IDP2 = 1,NDP
- {
- ncp2 = ncp[idp2]; // NCP2 = NCP(IDP2)
- ncp2p1 = ncp2 + 1; // NCP2P1 = NCP2 + 1
- bool equalfound = true;
- if (idp2 != idp1) // IF (IDP2.EQ.IDP1) GO TO 20
- {
- equalfound = false;
- for (j = 0; j < ncp2; j++) // DO 10 J = 1,NCP2
- {
- if (ipc[j,idp2] == idp1)// IF (IPC(J,IDP2).EQ.IDP1) GO TO 20
- {
- equalfound = true; //GOTO 20
- break;
- }
- } // 10 CONTINUE
- }
- if (! equalfound) // GO TO 80
- continue; // 80 CONTINUE
- ipcpe[0,npe+1] = idp2; // 20 IPCPE(1,NPE+1) = IDP2
- for (j = 0; j < ncp2; j++) // DO 30 J = 1,NCP2
- ipcpe[j+1,npe+1] = ipc[j,idp2];// IPCPE(J+1,NPE+1) = IPC(J,IDP2)
- // 30 CONTINUE
- for (j1 = 0; j1 < ncp2; j1++) // DO 50 J1 = 1,NCP2
- {
- jmn = j1; // JMN = J1
- imn = ipcpe[j1,npe+1]; // IMN = IPCPE(JMN,NPE+1)
- for (j2 = j1; j1 < ncp2p1; j2++)// DO 40 J2 = J1,NCP2P1
- {
- if (ipcpe[j2,npe+1] < imn)// IF (IPCPE(J2,NPE+1).LT.IMN) THEN
- {
- jmn = j2; // JMN = J2
- imn = ipcpe[jmn,npe+1];// IMN = IPCPE(JMN,NPE+1)
- } // END IF
- } // 40 CONTINUE
- ipcpe[jmn, npe+1] = ipcpe[j1,npe+1];// IPCPE(JMN,NPE+1) = IPCPE(J1,NPE+1)
- ipcpe[j1,npe+1] = imn; // IPCPE(J1,NPE+1) = IMN
- } // 50 CONTINUE
-// - Checks whether or not the candidate has already been included.
- if (npe > 0) // IF (NPE.GT.0) THEN
- {
- for (ipe1 = 0; ipe1 < npe; ipe1++)// DO 70 IPE1 = 1,NPE
- {
- idppe1 = idppe[ipe1]; // IDPPE1 = IDPPE(IPE1)
- if (ncp2 != ncp[idppe1] // IF (NCP2.NE.NCP(IDPPE1)) GO TO 70
- {
- //GOTO 70
- continue; // 70 CONTINUE
- }
- for (j = 0; j < ncp2p1; j++)// DO 60 J = 1,NCP2P1
- {
- if (ipcpe[j,npe+1] != ipcpe[j,ipe1] )// IF (IPCPE(J,NPE+1).NE.
- // + IPCPE(J,IPE1)) GO TO 70
- {
- //GOTO 70
- break;
- }
- } // 60 CONTINUE
- if (j != ncp2p1) //GOTO 70
- continue; // 70 CONTINUE
- break; // GO TO 80
- } // 70 CONTINUE
- if (ipe1 != npe)
- continue; // GO TO 80
- } // END IF
- npe = npe+1; // NPE = NPE + 1
- idppe[npe] = idp2; // IDPPE(NPE) = IDP2
- if (npe > npemx) // IF (NPE.GE.NPEMX) GO TO 90
- {
- break; //GOTO 90
- }
- } // 80 CONTINUE
- // 90 CONTINUE
-// Adds additional closest data points when necessary.
- if (npe < npeamn) // IF (NPE.LT.NPEAMN) THEN
- {
- for (jj = 0; jj < 9; jj++) // DO 150 JJ = 1,9
- {
- idp2 = ipc[jj,idp1]; // IDP2 = IPC(JJ,IDP1)
- ncp2 = ncp[idp2]; // NCP2 = NCP(IDP2)
- ncp2p1 = ncp2 + 1; // NCP2P1 = NCP2 + 1
- ipcpe[0,npe+1] = idp2; // IPCPE(1,NPE+1) = IDP2
- for (j=0; j < ncp2; j++) // DO 100 J = 1,NCP2
- ipcpe[j+1, npe=1] = ipc[j,idp2];// IPCPE(J+1,NPE+1) = IPC(J,IDP2)
- // 100 CONTINUE
- for (j1=0; j1 < ncp2; j1++) // DO 120 J1 = 1,NCP2
- {
- jmn = j1; // JMN = J1
- imn = ipcpe[jmn,npe+1] // IMN = IPCPE(JMN,NPE+1)
- for (j2=j1 ; j2 < ncp2p1; j2++)// DO 110 J2 = J1,NCP2P1
- {
- if (ipcpe[j2, npe+1] < imn)// IF (IPCPE(J2,NPE+1).LT.IMN) THEN
- {
- jmn = j2; // JMN = J2
- imn = ipcpe[jmn, npe+1]// IMN = IPCPE(JMN,NPE+1)
- } // END IF
- } // 110 CONTINUE
- ipcpe[jmn, npe+1] = ipcpe[j1, npe+1];// IPCPE(JMN,NPE+1) = IPCPE(J1,NPE+1)
- ipcpe[j1,npe+1] = imn; // IPCPE(J1,NPE+1) = IMN
- } // 120 CONTINUE
- if (npe > 0) // IF (NPE.GT.0) THEN
- {
- for (ipe1=0; ipe1 < npe; ipe1++)// DO 140 IPE1 = 1,NPE
- {
- idppe1 = idppe[ipe1];// IDPPE1 = IDPPE(IPE1)
- if (ncp2 != ncp[idppe1])// IF (NCP2.NE.NCP(IDPPE1)) GO TO 140
- continue;//GOTO 140-140 CONTINUE
- for (j=0; j < ncp2p1; j++)// DO 130 J = 1,NCP2P1
- {
- if (ipcpe[j,npe+1] != ipcpe[j,ipe1] )
- // IF (IPCPE(J,NPE+1).NE.
- // + IPCPE(J,IPE1)) GO TO 140
- break; // 140 CONTINUE
- } // 130 CONTINUE
- if (j != ncp2p1)
- continue; // 140 CONTINUE
- break; // GO TO 150
- }
- if (ipe1 != npe)
- continue;
- } // END IF
- npe = npe+1; // NPE = NPE + 1
- idppe[npe] = idp2; // IDPPE(NPE) = IDP2
- if (npe > npeamx) // IF (NPE.GE.NPEAMX) GO TO 160
- break;
- } // 150 CONTINUE
- } // END IF
- // 160 CONTINUE
-*/
\ No newline at end of file
diff --git a/src/terralib/kernel/TeAsciiFile.cpp b/src/terralib/kernel/TeAsciiFile.cpp
deleted file mode 100644
index 0ad63f3..0000000
--- a/src/terralib/kernel/TeAsciiFile.cpp
+++ /dev/null
@@ -1,363 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeAsciiFile.h"
-#include "TeErrorLog.h"
-#include "TeException.h"
-#include "TeAssertions.h"
-#include "TeDefines.h"
-
-#include <cstdlib> //FAMI
-
-TeAsciiFile::TeAsciiFile ( const string& name, const char* mode ):
- TeStdFile ( name, mode )
-{
-}
-
-TeAsciiFile::~TeAsciiFile()
-{
-}
-
-void
-TeAsciiFile::findNewLine ()
-{
- if ( feof ( file_ ) != 0 )
- return;
- char ch = '0';
-
- while ( ch != '\n' )
- {
- fscanf ( file_, "%c", &ch );
- if ( feof ( file_ ) != 0 )
- return;
- }
-}
-
-char
-TeAsciiFile::readQuotedChar()
-{
- require ( feof ( file_ ) == 0 );
-
- char ch = ',', ch2;
-
- while ( ch != '"' )
- {
- fscanf ( file_, "%c", &ch );
- }
- fscanf ( file_, "%c", &ch );
- fscanf ( file_, "%c", &ch2 );
-
- ensure ( ch2 == '"' ); // just to make sure
-return ch;
-}
-
-char
-TeAsciiFile::readChar()
-{
- char ch=' ';
- require ( feof ( file_ ) == 0 );
- while ( ch == ' ' )
- {
- fscanf ( file_, "%c", &ch );
- }
- return ch;
-}
-
-
-string
-TeAsciiFile::readString ()
-{
- if ( feof ( file_ ) != 0 )
- throw TeException ( END_OF_FILE_REACHED, name(), true );
-
- char input [TeNAME_LENGTH];
- input[0]=0;
- fscanf ( file_, "%s", input );
-
-return input;
-}
-
-void
-TeAsciiFile::writeString (const string& s)
-{
- fprintf ( file_, "%s", s.c_str() );
-}
-
-string
-TeAsciiFile::readLine ()
-{
- if ( feof ( file_ ) != 0 )
- throw TeException ( END_OF_FILE_REACHED, name(), true );
-
- char input [TeNAME_LENGTH];
- fgets ( input, TeNAME_LENGTH, file_ );
-
-return input;
-}
-
-string
-TeAsciiFile::readQuotedString()
-{
- require ( feof ( file_ ) == 0 );
-
- char ch = ' ';
-
- string quote;
-
- while ( ch != '"' )
- {
- fscanf ( file_, "%c", &ch );
- }
-
- while ( true )
- {
- fscanf ( file_, "%c", &ch );
- if ( ch == '\n' || ch == '\r')
- {
- ungetc ( ch, file_ );
- break;
- }
- if ( ch == '"' ) break;
-
- quote = quote + ch;
- }
-return quote;
-}
-
-void
-TeAsciiFile::readStringList ( vector<string>& strlist )
-{
- require ( file_ != 0 );
-
- this->readStringListCSV ( strlist, ' ');
-}
-
-void
-TeAsciiFile::readStringListCSV ( vector<string>& strlist, const char sep)
-{
-
- if ( feof ( file_ ) != 0 )
- throw TeException ( END_OF_FILE_REACHED, name(), true );
-
- char ch, lastChr = 0;
- while (fscanf ( file_, "%c", &ch ) != EOF )
- {
- if ( ch == '\n' || ch == '\r')
- {
- if(lastChr==sep)
- strlist.push_back ( "" );
-
- ungetc ( ch, file_ );
- return;
- }
- ungetc ( ch, file_ );
- // there are still more values to be read
- string name = readStringCSV (sep);
- if ( name.size() != 0 || sep != ' ')
- strlist.push_back ( name );
-
- lastChr = ch;
- }
-}
-
-void
-TeAsciiFile::readNStringCSV ( vector<string>& strlist, unsigned int n, const char sep)
-{
-
- if ( feof ( file_ ) != 0 )
- throw TeException ( END_OF_FILE_REACHED, name(), true );
-
- strlist.clear();
- char ch, lastChr = 0;
- while (fscanf ( file_, "%c", &ch ) != EOF )
- {
- if ( ch == '\n' || ch == '\r')
- {
- if(lastChr==sep)
- strlist.push_back ( "" );
-
- ungetc ( ch, file_ );
- return;
- }
- ungetc ( ch, file_ );
- // there are still more values to be read
- string name = readStringCSV (sep);
- if ( name.size() != 0 || sep != ' ')
- strlist.push_back ( name );
- if (strlist.size() == n)
- break;
-
- lastChr = ch;
- }
-}
-
-string
-TeAsciiFile::readStringCSV( const char del, bool skip, const char skip_char )
-{
- require ( file_ != 0 );
-
- if ( feof ( file_ ) != 0 )
- throw TeException ( END_OF_FILE_REACHED, name(), true );
-
- char ch = '0';
- string line;
- bool inQuotes = false;
-
- int ret;
- while ( (ret=fscanf ( file_, "%c", &ch )) != EOF)
- {
- if ( ch == '\n' || ch == '\r')
- {
- ungetc ( ch, file_ );
- break;
- }
- if ( ch == del && !inQuotes ) break;
- if (skip)
- if (ch == skip_char)
- {
- if (skip_char == '"')
- inQuotes = !inQuotes;
- continue;
- }
- line = line + ch;
- }
- return line;
-}
-
-string
-TeAsciiFile::readStringCSVNoSpace( const char del )
-{
- char blank = ' ';
- string line = readStringCSV ( del, true, blank );
-return line;
-}
-
-string
-TeAsciiFile::readStringCSVNoQuote( const char del )
-{
- char quote = '"';
- string line = readStringCSV ( del, true, quote );
-return line;
-}
-
-int
-TeAsciiFile::readInt ()
-{
- require ( file_ != 0 );
-
- if ( feof ( file_ ) != 0 )
- throw TeException ( END_OF_FILE_REACHED, name(), true );
-
- int value;
- fscanf ( file_, "%d", &value );
-
-return value;
-}
-
-int
-TeAsciiFile::readIntCSV ( const char del )
-{
- char blank = ' ';
- string line = readStringCSV ( del, true, blank );
-
-return atoi(line.c_str());
-}
-
-double
-TeAsciiFile::readFloatCSV ( const char del )
-{
- char blank = ' ';
- string line = readStringCSV ( del, true, blank );
-
-return atof(line.c_str());
-}
-
-
-double
-TeAsciiFile::readFloat ()
-{
- require ( file_ != 0 );
-
- if ( feof ( file_ ) != 0 )
- throw TeException ( END_OF_FILE_REACHED, name(), true );
-
- double value;
- fscanf ( file_, "%lf", &value );
-
-return value;
-}
-
-TeCoord2D
-TeAsciiFile::readCoord2D ()
-{
- require ( file_ != 0 );
-
- if ( feof ( file_ ) != 0 )
- throw TeException ( END_OF_FILE_REACHED, name(), true );
-
- double x, y;
- fscanf ( file_, "%lf %lf", &x, &y);
-
-return TeCoord2D( x, y );
-}
-
-TeBox
-TeAsciiFile::readBox()
-{
- require ( file_ != 0 );
-
- if ( feof ( file_ ) != 0 )
- {
- throw TeException ( END_OF_FILE_REACHED, name(), true );
- }
- double x1, y1, x2, y2;
-
-
- fscanf ( file_, "%lf %lf %lf %lf", &x1, &y1, &x2, &y2 );
-
-return TeBox ( x1, y1, x2, y2 );
-
-}
-
-string
-TeAsciiFile::readAll()
-{
- require ( file_ != 0 );
- if ( feof ( file_ ) != 0 )
- throw TeException ( END_OF_FILE_REACHED, name(), true );
-
- char ch = '0';
- string text="";
- int ret;
- while ((ret=fscanf ( file_, "%c", &ch )) != EOF)
- {
- if (ch != '\n')
- text = text + ch;
- }
- return text;
-}
-
diff --git a/src/terralib/kernel/TeAsciiFile.h b/src/terralib/kernel/TeAsciiFile.h
deleted file mode 100644
index e65e92f..0000000
--- a/src/terralib/kernel/TeAsciiFile.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeAsciiFile.h
- \brief This file contains structures and definitions to deal ASCII files
-*/
-#ifndef __TERRALIB_INTERNAL_ASCIIFILE_H
-#define __TERRALIB_INTERNAL_ASCIIFILE_H
-
-#include "TeDefines.h"
-#include "TeStdFile.h"
-#include "TeCoord2D.h"
-#include "TeBox.h"
-
-#include <stdio.h>
-
-#include <vector>
-#include <string>
-using namespace std;
-
-//! A class for handling reading/writing for ASCII files
-/*! Simple wrapper around a stdio file. Clientes are all the
- functions that imports from ASCII files.
-
- \sa
- TeStdFile, TeSPRFile
-*/
-class TL_DLL TeAsciiFile: public TeStdFile {
-
-public:
-
- //! Contructors
- TeAsciiFile(const string& name, const char* mode = "r");
-
- //! Destructor
- virtual ~TeAsciiFile();
-
- //! Writes a carriage return character
- void writeNewLine ()
- { fprintf ( file_, "\n" ); }
-
- //! Goes to a new line
- void findNewLine () ;
-
- //! Reads a string
- string readString();
-
- //! Reads a full line up to carriage return
- string readLine();
-
- //! Writes a generic string to the file
- void writeString (const string& s);
-
- //! Reads a string whithin quotes
- string readQuotedString();
-
- //! Reads a comma-separated string ( with a skip character )
- string readStringCSV( const char sep = ',', bool skip = false,
- const char skip_char = ' ');
-
- //! Reads a character whithin quotes
- char readQuotedChar();
-
- //! Reads a character
- char readChar();
-
- //! Reads a comma-separated string(ignore spaces)
- string readStringCSVNoSpace( const char del = ',');
-
- //! Reads a comma-separated string (ignore quote )
- string readStringCSVNoQuote ( const char del = ',' );
-
- //! Reads an integer
- int readInt();
-
- //! Reads a comma-separated int
- int readIntCSV( const char del = ',');
-
- //! Reads a float
- double readFloat();
-
- //! Reads a comma-separated float
- double readFloatCSV( const char del = ',');
-
- //! Reads a 2D coordinate ( x, y )
- TeCoord2D readCoord2D();
-
- //! Reads a line and put in a stringlist
- void readStringList ( vector<string>& );
-
- //! Reads a comma-separated line string and put in a string list
- void readStringListCSV ( vector<string>&, const char sep = ',');
-
- //! Reads the first n strings from a comma separated line string and put in a string list
- void readNStringCSV ( vector<string>&, unsigned int n, const char sep = ',');
-
- //! Reads a bounding box
- TeBox readBox();
-
- //! Reads the entire content of the file, skipping new line characters only
- string readAll();
-
-private:
-
-// No copy allowed
-
- TeAsciiFile(const TeAsciiFile&);
- TeAsciiFile& operator=(const TeAsciiFile&);
-
-};
-#endif
-
-
diff --git a/src/terralib/kernel/TeAssertions.h b/src/terralib/kernel/TeAssertions.h
deleted file mode 100644
index 6fbc95a..0000000
--- a/src/terralib/kernel/TeAssertions.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeAssertions.h
- \brief This file contains definitions for require and ensure macros
-*/
-
-#ifndef TeAssertions_H
-#define TeAssertions_H
-#include <assert.h>
-
-#define require(statement) assert(statement)
-#define ensure(statement) assert(statement)
-
-#endif
-
diff --git a/src/terralib/kernel/TeAttribute.h b/src/terralib/kernel/TeAttribute.h
deleted file mode 100644
index 15b28cf..0000000
--- a/src/terralib/kernel/TeAttribute.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeAttribute.h
- \brief This file contains structures and definitions about attributes of geographical objects
-*/
-#ifndef __TERRALIB_INTERNAL_ATTRIBUTE_H
-#define __TERRALIB_INTERNAL_ATTRIBUTE_H
-
-#include "TeDefines.h"
-#include "TeDataTypes.h"
-#include "TeTime.h"
-
-/*! \enum TeMeasurementScale
- \brief Sscale of measurement according to Stevens (1949)
- modified by Chrisman (1998) to include CYCLIC and PROBABILITY
- we also include FUZZY (possibility scale)
-*/
-enum TeMeasurementScale
-{ ORDINAL, NOMINAL, RATIO, INTERVAL, CYCLIC, PROBABILITY, FUZZY };
-
-/*! \struct TeAttributeRep
- \brief Attribute physical representation
-*/
-struct TL_DLL TeAttributeRep
-{
- string name_; //!< attribute name
- TeAttrDataType type_; //!< attribute type
- int numChar_; //!< width of an attribute
- int decimals_; //!< number of decimal digits
- bool isPrimaryKey_; //!< flag to indicate that the attribute is part of primary key
- bool isAutoNumber_; //!< flag to indicate that the attribute is auto number
- bool null_; //!< flag to indicate that attribute can be a null value (true) or not (false)
- string defaultValue_; //!< default value (without "'")
-
- //! Empty constructor
- TeAttributeRep():
- name_(""),
- type_(TeSTRING),
- numChar_(0),
- decimals_(0),
- isPrimaryKey_(false),
- isAutoNumber_(false),
- null_(true),
- defaultValue_("")
- {}
-
- //! Constructor
- TeAttributeRep(const string& name):
- name_(name),
- type_(TeSTRING),
- numChar_(0),
- decimals_(0),
- isPrimaryKey_(false),
- isAutoNumber_(false),
- null_(true),
- defaultValue_("")
- {}
-
- //! Operator =
- TeAttributeRep& operator= ( const TeAttributeRep& at )
- {
- if ( this != &at )
- {
- name_ = at.name_;
- type_ = at.type_;
- numChar_ = at.numChar_;
- decimals_ = at.decimals_;
- isPrimaryKey_ = at.isPrimaryKey_;
- isAutoNumber_ = at.isAutoNumber_;
- null_ = at.null_;
- defaultValue_ = at.defaultValue_;
- }
- return *this;
- }
-
- //! Operator ==
- bool operator== ( const TeAttributeRep& at )
- {
- return (name_==at.name_ && type_ == at.type_
- && numChar_ == at.numChar_ && decimals_ == at.decimals_ &&
- isPrimaryKey_ == at.isPrimaryKey_ &&
- isAutoNumber_ == at.isAutoNumber_ &&
- null_ == at.null_ && defaultValue_ == at.defaultValue_);
- }
-
- //! Operator <
- bool operator< (const TeAttributeRep& at) const
- {return (name_ < at.name_);}
-};
-
-/*! \struct TeAttribute
- \brief Attribute description
-*/
-struct TL_DLL TeAttribute
-{
- TeAttributeRep rep_; //!< representation of attribute
- string semantic_; //!< reference in a Ontology database (e.g., entry in WordNet )
- string unit_; //!< measurement unit ( e.g., m ) if applicable
- TeMeasurementScale scale_; //!< scale of measurement
-
- // for RATIO data sets
- string minValue_; //!< minimum value of the attribute
- string maxValue_; //!< maximum value of the attrbute
-
- // for NOMINAL or ORDINAL data sets
- vector<string> validValueList_; //!< list of valid values
-
- // for INTERVAL data sets (??)
- string origin_; //!< origin of the intervals
- string interval_; //!< mesurement interval
-
- string dateTimeFormat_; //!< format for date and time values
- string indicatorAM_; //!< AM indicator for a 12 hour clock
- string indicatorPM_; //!< PM indicator for a 12 hour clock
- string dateSeparator_; //!< date separator
- string timeSeparator_; //!< time separator
- TeChronon dateChronon_; //!< date chronon
-
- //! Empty constructor
- TeAttribute():
- rep_ (TeAttributeRep()),
- dateTimeFormat_ ("DsMsYYYYsHHsmmsSS"),
- indicatorAM_ ("AM"),
- indicatorPM_ ("PM"),
- dateSeparator_ ("/"),
- timeSeparator_ (":"),
- dateChronon_ (TeSECOND)
- {}
-};
-
-/*! \struct TeProperty
- \brief A property of an object
- */
-struct TL_DLL TeProperty
-{
- TeAttribute attr_; //!< attribute description
- string value_; //!< its value stored as an string
-};
-
-//! A vector of TeProperties
-typedef vector<TeProperty> TePropertyVector;
-
-//! A vector of attributes representation
-typedef vector<TeAttributeRep> TeAttributeRepList;
-
-//! A vector of attributes
-typedef vector<TeAttribute> TeAttributeList;
-
-//! A Map of the attribute names to the statistical types
-typedef vector< pair<TeAttributeRep, TeStatisticType> > TeGroupingAttr;
-
-#endif
-
-
diff --git a/src/terralib/kernel/TeBaseSTInstance.h b/src/terralib/kernel/TeBaseSTInstance.h
deleted file mode 100644
index abb17e6..0000000
--- a/src/terralib/kernel/TeBaseSTInstance.h
+++ /dev/null
@@ -1,552 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeBaseSTInstance.h
- \brief This file contains a base class called TeBaseSTInstance that represents
- an instance in time of a geographical object or element.
-*/
-
-#ifndef __TERRALIB_INTERNAL_BASESTINSTANCE_H
-#define __TERRALIB_INTERNAL_BASESTINSTANCE_H
-
-#include "TeCoord2D.h"
-#include "TeGeometryAlgorithms.h"
-#include "TeAttribute.h"
-#include "TeSharedPtr.h"
-
-#include <string>
-#include <map>
-#include <vector>
-
-using namespace std;
-
-class TeTheme;
-
-/*! \class TeBaseSTInstance
- \brief A base class that represents an instance in a time of a spatial object.
-
- A spatio-temporal instance (STInstance) is composite of an attribute set and geometries
- of a spatial element or object that are valid in a specific time. This class implements
- a base generic spatio-temporal instance that can be specialized according to the
- types that represent its geometries and its valid time.
-
-*/
-template<typename GeometryType, typename TimeType>
-class TeBaseSTInstance
-{
-
-protected:
- //! object identification
- string object_id_;
- //! unique identification in each attribute table
- vector<string> unique_id_;
- //! set of properties or attributes values
- vector<string> properties_;
- //! geometries
- GeometryType geometries_;
- //! valid time
- TimeType time_;
- //! the slice or group that contains this instance
- int slice_;
- //! a shared pointer to the descriptions of all attributes
- TeSharedPtr<TeAttributeList> attrList_;
-
-public:
-
- //! Empty constructor
- TeBaseSTInstance() : object_id_(""), slice_(-1), attrList_(0)
- { }
-
- //! Constructor
- TeBaseSTInstance (const string& object_id, const vector<string>& prop, TeAttributeList* attList = 0, const int& s = -1) :
- object_id_(object_id),
- properties_(prop),
- slice_(s),
- attrList_(TeSharedPtr<TeAttributeList>(attList))
- { }
-
- //! Constructor
- TeBaseSTInstance (const string& object_id, const GeometryType& geometries, const TimeType& time,
- const int& s = -1) :
- object_id_(object_id),
- geometries_(geometries),
- time_(time),
- slice_(s),
- attrList_(0)
- { }
-
- //! Constructor
- TeBaseSTInstance (const string& object_id, const vector<string>& prop, TeAttributeList* attList,
- const GeometryType& geometries, const int& slice, const TimeType& time ) :
- object_id_(object_id),
- properties_(prop),
- geometries_(geometries),
- time_(time),
- slice_(slice),
- attrList_(TeSharedPtr<TeAttributeList>(attList))
- { }
-
- //! Destructor
- virtual ~TeBaseSTInstance()
- { }
-
- //! Equal operator
- virtual bool operator== (const TeBaseSTInstance<GeometryType, TimeType>& other);
-
- //! Returns the object identification
- virtual string getObjectId ()
- { return object_id_; }
-
- //! Sets the object identification
- virtual void setObjectId (const string& id)
- { object_id_ = id; }
-
- //! Deprecated: Returns the object identification
- virtual string objectId ()
- { return getObjectId(); }
-
- //! Deprecated: Sets the object identification
- virtual void objectId (const string& id)
- { setObjectId(id); }
-
- //! Returns the unique identification in all attribute tables
- virtual vector<string>& getUniqueId()
- { return unique_id_; }
-
- //! Returns the unique identification of the i-th attribute table
- virtual string getUniqueId(const int& i);
-
- //! Sets the unique identification in all attribute tables
- virtual void setUniqueId (const vector<string>& id)
- { unique_id_ = id; }
-
- //! Adds an unique identification
- virtual void addUniqueId (const string& id)
- { unique_id_.push_back(id); }
-
- //! Deprecated: Returns the instance identification in all attribute tables
- virtual vector<string>& uniqueId ()
- { return getUniqueId(); }
-
- //! Deprecated: Returns the instance identification in the index-th attribute table
- virtual string uniqueId (int index)
- { return getUniqueId(index); }
-
- //! Deprecated: Sets the instance identifications in all attribute tables
- virtual void uniqueId (const vector<string>& ids)
- { setUniqueId(ids); }
-
- //! Returns the valid time
- virtual TimeType getTime()
- { return time_; }
-
- //! Sets the valid time
- virtual void setTime (const TimeType& t)
- { time_ = t; }
-
- //! Sets the property value vector
- virtual void setProperties(const vector<string>& p)
- { properties_ = p; }
-
- //! Deprecated: Sets the property vector to the ST instance
- virtual void setProperties(TePropertyVector& p);
-
- //! Sets the value (as a string) of the i-th property
- virtual bool setPropertyValue (const int& i, const string& val);
-
- //! Sets the value (as a string) of a property named 'name'
- virtual bool setPropertyValue (const string& name, const string& val);
-
- //! Adds a new property value
- virtual void addPropertyValue (const string& val)
- { properties_.push_back (val); }
-
- //! Removes the i-th property value
- virtual bool removePropertyValue (const int& i);
-
- //! Adds a new property or set its value
- /*!
- Verifies if there is this property in the attribute list.
- If not, adds it in the ST instance and in the attribute list.
- Otherwise, set the property value
- */
- virtual bool addProperty(TeProperty& prop);
-
- //! Adds a new attribute in the attribute list
- virtual bool addProperty(TeAttribute& rep);
-
- //! Returns the property value vector
- virtual vector<string>& getProperties()
- { return properties_; }
-
- //! Gets the property vector
- virtual void getPropertyVector(TePropertyVector& propVec);
-
- //! Deprecated: Returns the property vector from the ST instance
- TePropertyVector getPropertyVector();
-
- //! Gets the i-th property
- virtual bool getProperty (TeProperty& prop, unsigned int i = 0);
-
- //! Gets the property named "name"
- virtual bool getProperty (TeProperty& prop, string name);
-
- //! Gets the value (as a string) of the i-th property
- virtual bool getPropertyValue (string& val, const int& i = 0);
-
- //! Gets the the value (as a string) of a property named "name"
- virtual bool getPropertyValue (const string& name, string& val);
-
- //! Returns the value (as a double) of the i-th property
- virtual double operator[](int i);
-
- //! Deprecated: Sets the property vector to the ST instance
- virtual void properties(TePropertyVector& p)
- { setProperties(p); }
-
- //! Returns the geometries
- virtual GeometryType& getGeometries()
- { return geometries_;}
-
- //! Sets the geometries
- virtual void setGeometry(const GeometryType& g)
- { geometries_ = g; }
-
- //! Deprecated: Returns the geometries
- virtual GeometryType& geometries()
- { return getGeometries();}
-
- //! Sets the group or slice that contains this instance
- virtual void setSlice (int s)
- { slice_ = s; }
-
- //! Returns the group or slice that contains this instance
- virtual int getSlice()
- { return slice_; }
-
- //! Deprecated: Sets the group or slice that contains this instance
- virtual void slice (int s)
- { setSlice(s); }
-
- //! Deprecated: Returns the group or slice that contains this instance
- virtual int slice()
- { return getSlice(); }
-
- //! Gets a pointer to attribute desciptions
- const TeAttributeList* getAttrList()
- { return attrList_.nakedPointer(); }
-
- //! Creates a new internal copy of the attribute description
- void setAttrList(const TeAttributeList& attList);
-
- //! Sets a shared pointer to attribute descriptions
- void setAttrList(TeSharedPtr<TeAttributeList>& attrList);
-
- //! Clears the instance, its attributes. It must be implemented by specialized classes to clear its geometries.
- virtual void clear();
-
- //! Returns a centroid associated to the geometries of the instance
- virtual TeCoord2D getCentroid();
-
- //! Returns an area the geometries of the instance
- virtual double getArea();
-
- //! Verifies if the time associated with this instance is valid. It must be implemented by specialized classes.
- virtual bool isTimeValid()
- { return false; }
-
- //! Deprecated: Returns the theme pointer that contains this instance.
- virtual TeTheme* theme()
- { return 0; }
-
- //! Deprecated: Sets the theme that contains this instance.
- virtual void theme(TeTheme*)
- { }
-};
-
-template<typename GeometryType, typename TimeType> bool
-TeBaseSTInstance<GeometryType, TimeType>::operator== (const TeBaseSTInstance<GeometryType, TimeType>& other)
-{
- return ( (object_id_ == other.object_id_) &&
- (time_ == other.time_) &&
- (slice_ == other.slice_));
-}
-
-template<typename GeometryType, typename TimeType> string
-TeBaseSTInstance<GeometryType, TimeType>::getUniqueId(const int& i)
-{
- if(i<(int)unique_id_.size())
- return unique_id_[i];
- return "";
-}
-
-template<typename GeometryType, typename TimeType> void
-TeBaseSTInstance<GeometryType, TimeType>::setAttrList(const TeAttributeList& attList)
-{
- attrList_.reset(new TeAttributeList());
- *attrList_ = attList;
-}
-
-template<typename GeometryType, typename TimeType> void
-TeBaseSTInstance<GeometryType, TimeType>::setAttrList(TeSharedPtr<TeAttributeList>& attList)
-{
- attrList_ = attList;
-}
-
-template<typename GeometryType, typename TimeType> void
-TeBaseSTInstance<GeometryType, TimeType>::setProperties(TePropertyVector& p)
-{
- properties_.clear();
- TePropertyVector::iterator it = p.begin();
- while(it!=p.end())
- {
- addPropertyValue(it->value_);
- ++it;
- }
-}
-
-template<typename GeometryType, typename TimeType> bool
-TeBaseSTInstance<GeometryType, TimeType>::setPropertyValue (const int& i, const string& val)
-{
- if(i<0 || i>=(int)properties_.size())
- return false;
- properties_[i] = val;
- return true;
-}
-
-template<typename GeometryType, typename TimeType> bool
-TeBaseSTInstance<GeometryType, TimeType>::setPropertyValue (const string& name, const string& val)
-{
- if(!attrList_.isActive())
- return false;
-
- string newName = TeConvertToUpperCase(name);
- size_t pos = name.find(".", 0, 1);
- if (pos != string::npos)
- newName = TeConvertToUpperCase((name.substr(pos+1)));
-
- for(unsigned int i=0; i<attrList_->size(); ++i)
- {
- string s = TeConvertToUpperCase((attrList_->operator[](i)).rep_.name_);
- if( (s == TeConvertToUpperCase(name)) || (s == newName))
- {
- if(i>=properties_.size())
- return false;
- properties_[i] = val;
- return true;
- }
- }
- return false;
-}
-
-template<typename GeometryType, typename TimeType> void
-TeBaseSTInstance<GeometryType, TimeType>::getPropertyVector(TePropertyVector& propVec)
-{
- if(!attrList_.isActive())
- return;
- if(properties_.size()!=attrList_->size())
- return;
- propVec.clear();
- for(unsigned int i=0; i<properties_.size(); ++i)
- {
- TeProperty p;
- p.value_ = properties_[i];
- p.attr_ = attrList_->operator[](i);
- propVec.push_back(p);
- }
-}
-
-template<typename GeometryType, typename TimeType> TePropertyVector
-TeBaseSTInstance<GeometryType, TimeType>::getPropertyVector()
-{
- TePropertyVector vec;
- this->getPropertyVector(vec);
- return vec;
-}
-
-template<typename GeometryType, typename TimeType> bool
-TeBaseSTInstance<GeometryType, TimeType>::getProperty (TeProperty& prop, unsigned int i)
-{
- if(!attrList_.isActive())
- return false;
-
- if(i>=properties_.size() || i>=attrList_->size())
- return false;
- prop.value_ = properties_[i];
- prop.attr_ = (*attrList_)[i];
- return true;
-}
-
-template<typename GeometryType, typename TimeType> bool
-TeBaseSTInstance<GeometryType, TimeType>::getProperty (TeProperty& prop, string name)
-{
- if(!attrList_.isActive())
- return false;
- if(properties_.size()!=attrList_->size())
- return false;
-
- string newName = TeConvertToUpperCase(name);
- size_t pos = name.find(".", 0, 1);
- if (pos != string::npos)
- newName = TeConvertToUpperCase(name.substr(pos+1));
-
- for(unsigned int i=0; i<attrList_->size(); ++i)
- {
- string s = TeConvertToUpperCase((attrList_->operator[](i)).rep_.name_);
- if((s == TeConvertToUpperCase(name)) || (s == newName))
- {
- prop.value_ = properties_[i];
- prop.attr_ = attrList_->operator[](i);
- return true;
- }
- }
- return false;
-}
-
-template<typename GeometryType, typename TimeType> bool
-TeBaseSTInstance<GeometryType, TimeType>::getPropertyValue (string& val, const int& i)
-{
- if(i<0 || i>= (int)properties_.size())
- return false;
- val = properties_[i];
- return true;
-}
-
-template<typename GeometryType, typename TimeType> bool
-TeBaseSTInstance<GeometryType, TimeType>::getPropertyValue (const string& name, string& val)
-{
- if(!attrList_.isActive())
- return false;
-
- if(properties_.size()!=attrList_->size())
- return false;
-
- string newName = TeConvertToUpperCase(name);
- size_t pos = name.find(".", 0, 1);
- if (pos != string::npos)
- newName = TeConvertToUpperCase(name.substr(pos+1));
-
- for(unsigned int i=0; i<attrList_->size(); ++i)
- {
- string s = TeConvertToUpperCase((attrList_->operator[](i)).rep_.name_);
- if((s == TeConvertToUpperCase(name)) || (s == newName))
- {
- val = properties_[i];
- return true;
- }
- }
- return false;
-}
-
-template<typename GeometryType, typename TimeType> bool
-TeBaseSTInstance<GeometryType, TimeType>::addProperty(TeProperty& prop)
-{
- if(!attrList_.isActive())
- return false;
-
- string newName = TeConvertToUpperCase(prop.attr_.rep_.name_);
- size_t pos = (prop.attr_.rep_.name_).find(".", 0, 1);
- if (pos != string::npos)
- newName = TeConvertToUpperCase(prop.attr_.rep_.name_.substr(pos+1));
-
- for(unsigned int i=0; i<attrList_->size(); ++i)
- {
- string s = TeConvertToUpperCase((attrList_->operator[](i)).rep_.name_);
- if((s == TeConvertToUpperCase(prop.attr_.rep_.name_)) || (s == newName))
- {
- //the property already exists
- if(i>=properties_.size())
- properties_.push_back (prop.value_);
- else
- properties_[i] = prop.value_;
- return true;
- }
- }
-
- // Adds a new property
- attrList_->push_back(prop.attr_);
- properties_.push_back (prop.value_);
- return true;
-}
-
-template<typename GeometryType, typename TimeType> bool
-TeBaseSTInstance<GeometryType, TimeType>::addProperty(TeAttribute& attr)
-{
- if(!attrList_.isActive())
- return false;
- attrList_->push_back(attr);
- return true;
-}
-
-template<typename GeometryType, typename TimeType> bool
-TeBaseSTInstance<GeometryType, TimeType>::removePropertyValue(const int& i)
-{
- int index = 0;
- vector<string>::iterator it = properties_.begin();
- while(it!=properties_.end())
- {
- if(index==i)
- {
- properties_.erase(it);
- return true;
- }
- ++it;
- ++index;
- }
- return false;
-}
-
-template<typename GeometryType, typename TimeType> double
-TeBaseSTInstance<GeometryType, TimeType>::operator[](int i)
-{
- double val = TeMAXFLOAT;
- if(i<0 || i>=(int)properties_.size() || properties_[i].empty())
- return val;
- val = atof(properties_[i].c_str());
- return val;
-}
-
-template<typename GeometryType, typename TimeType> void
-TeBaseSTInstance<GeometryType, TimeType>::clear()
-{
- object_id_ = "";
- slice_ = -1;
- properties_.clear();
- unique_id_.clear();
- attrList_.reset(0);
-}
-
-
-template<typename GeometryType, typename TimeType> TeCoord2D
-TeBaseSTInstance<GeometryType, TimeType>::getCentroid()
-{
- return TeFindCentroid(this->getGeometries());
-}
-
-template<typename GeometryType, typename TimeType> double
-TeBaseSTInstance<GeometryType, TimeType>::getArea()
-{
- return TeGeometryArea(this->getGeometries());
-}
-
-
-#endif
diff --git a/src/terralib/kernel/TeBaseSTInstanceSet.h b/src/terralib/kernel/TeBaseSTInstanceSet.h
deleted file mode 100644
index 5437df9..0000000
--- a/src/terralib/kernel/TeBaseSTInstanceSet.h
+++ /dev/null
@@ -1,1212 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeBaseSTInstanceSet.h
- \brief This file contains structures to deal with a set of spatio-temporal
- instances. These instances can belong to a specific layer or theme.
-*/
-
-#ifndef __TERRALIB_INTERNAL_STINSTANCESET_H
-#define __TERRALIB_INTERNAL_STINSTANCESET_H
-
-#include "TeBaseSTInstance.h"
-#include "TeRTree.h"
-#include "TeTheme.h"
-#include "TeLayer.h"
-#include "TeQuerierParams.h"
-#include "TeQuerier.h"
-#include "TeSharedPtr.h"
-
-/*! \class TeBaseSTInstanceSet
- \brief A abstract class that represents a set of spatial temporal instances.
-
- This abstract class implements a generic spatio-temporal instance set. It must
- be specialized according to the instance type (its geometry type, its time type
- and its own type).
-
- \sa TeBaseSTInstance TeTheme TeLayer
-
-*/
-template< typename GeometryType, typename TimeType, typename InstanceType >
-class TeBaseSTInstanceSet
-{
-
-protected:
-
- //! Set of spatio temporal instances
- vector<InstanceType> instances_;
-
- //! Minimal time associated to spatial temporal instances
- TimeType minTime_;
- //! Maximal time associated to spatial temporal instances
- TimeType maxTime_;
-
- //! Description of all attributes
- TeSharedPtr<TeAttributeList> attrList_;
-
- //! A pointer to a theme
- TeTheme* theme_;
- //! A pointer to a layer
- TeLayer* layer_;
- //! A bounding box that contains all geometries of the spatial temporal instances
- TeBox box_;
-
- //! A map from object identity to its associated instances in the set
- map<string, vector<int> > objectIdToInstances_;
- //! A map from time to its associated instances in the set
- map<TimeType, vector<int> > timeToInstances_;
- //! A map from slice to its associated instances in the set
- map<int, vector<int> > sliceToInstances_;
- //! A struture to index the geometries: RTree
- TeSAM::TeRTree<int>* rTree_;
-
- //! Builds the set using a given querier and a specific slice
- virtual bool buildImpl(TeQuerier* querier, const int& slide = -1) = 0;
-
-public:
-
- //! An iterator that traverse each instance in the set
- typedef typename vector<InstanceType>::iterator iterator;
-
- //! Constructor. It does not initialize the rTree.
- TeBaseSTInstanceSet();
-
- //! Constructor. It initializes the rTree based on theme box.
- TeBaseSTInstanceSet(TeTheme* theme, const TeAttributeList& attrList = TeAttributeList());
-
- //! Constructor. It initializes the rTree based on layer box.
- TeBaseSTInstanceSet(TeLayer* layer, const TeAttributeList& attrList = TeAttributeList());
-
- //! Constructor. It initializes the rTree based on the given box.
- TeBaseSTInstanceSet(const TeBox& box, const TeAttributeList& attrList = TeAttributeList());
-
- //! Copy constructor
- TeBaseSTInstanceSet (const TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>& other);
-
- //! Destructor
- virtual ~TeBaseSTInstanceSet();
-
- //! Assignment operator
- virtual TeBaseSTInstanceSet& operator= (const TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>& other);
-
- //! Gets minimal time
- virtual TimeType getMinTime()
- { return minTime_; }
-
- //! Sets minimal time
- virtual void setMinTime(TimeType& t)
- { minTime_ = t; }
-
- //! Gets maximal time
- virtual TimeType getMaxTime()
- { return maxTime_; }
-
- //! Sets maximal time
- virtual void setMaxTime(TimeType& t)
- { maxTime_ = t; }
-
- //! Gets the attribute list, that is, the description of all attributes
- virtual TeAttributeList& getAttributeList()
- { return (*attrList_); }
-
- //! Sets the attribute list, that is, the description of all attributes
- virtual void setAttributeList(TeAttributeList& attrs);
-
- //! Returns the index of an attribute named "attrName"
- virtual int getAttributeIndex(const string& attrName);
-
- //! Gets theme pointer
- virtual TeTheme* getTheme()
- { return theme_; }
-
- //! Sets theme pointer
- virtual void setTheme(TeTheme* t)
- { theme_ = t; }
-
- //! Deprecated: Returns a theme pointer
- TeTheme* theme()
- { return getTheme(); }
-
- //! Gets layer pointer
- virtual TeLayer* getLayer()
- { return layer_; }
-
- //! Sets layer pointer
- virtual void setLayer(TeLayer* l)
- { layer_ = l; }
-
- //! Gets a reference to the instance set
- virtual vector<InstanceType>& getSTInstances()
- { return instances_; }
-
- //! Gets a pointer to the index-th ST instance
- virtual InstanceType* getSTInstance(const unsigned int& index);
-
- //! Gets a pointer to a ST instance of an object in a specific slice
- virtual InstanceType* getSTInstance(const string& objectId, const int& slice = -1);
-
- //! Gets a pointer to a ST instance of an object in a specific time and slice
- virtual InstanceType* getSTInstance(const string& objectId, TimeType& time, const int& slice = -1);
-
- //! Gets pointers to all ST instances of a specific object in a specific slice
- virtual void getSTInstances(vector<InstanceType*>& set, const string& objectId, const int& slice = -1);
-
- //! Gets pointers to all ST instances of a specific object in a specific time and slice
- virtual void getSTInstances(vector<InstanceType*>& set, const string& objectId, TimeType& time, const int& slice = -1);
-
- ///! Gets pointers to all ST instances of a specific time
- virtual void getSTInstances(vector<InstanceType*>& set, TimeType& time, const int& slice = -1);
-
- //! Gets pointers to all ST instances of a specific slice
- virtual void getSTInstances(vector<InstanceType*>& set, const int& slice);
-
- //! Inserts a new ST instance in the set
- virtual bool insertSTInstance (InstanceType& object);
-
- //! Returns the number of instances
- virtual int numSTInstance();
-
- //! Returns the number of instances of an object or element
- virtual int numSTInstance(const string& objectId);
-
- //! Returns the number of instances in a specific slice
- virtual int numSTInstance(const int& slice);
-
- //! Returns the number of instances in a specific time
- virtual int numSTInstance(TimeType& time);
-
- //! Returns the number of elements or objects in the set
- virtual int numElements()
- { return objectIdToInstances_.size(); }
-
- //! Sets a geometry of an object in a specific slice
- virtual bool setGeometry(const string& object_id, GeometryType& geom, const int& slice = -1);
-
- //! Sets a geometry of an object in a specific time and slice
- virtual bool setGeometry(const string& object_id, GeometryType& geom, TimeType& time, const int& slice = -1);
-
- //! Gets the geometry of an object in a specific slice
- virtual bool getGeometry(const string& object_id, GeometryType& geom, const int& slice = -1);
-
- //! Gets the geometry of an object in a specific time and slice
- virtual bool getGeometry(const string& object_id, GeometryType& geom, TimeType& time, const int& slice = -1);
-
- //! Gets a vector of attributes or properties of a object that is valid in a slice
- virtual bool getPropertyVector (const string& object_id, TePropertyVector& propVec, const int& slice = -1);
-
- //! Gets a vector of attributes or properties of a object that is valid in a time and slice
- virtual bool getPropertyVector (const string& object_id, TePropertyVector& propVec, TimeType& time, const int& slice = -1);
-
- //! Sets a vector of attribute values of a object that is valid in a slice
- virtual bool setProperties (const string& object_id, const vector<string>& values, const int& slice = -1);
-
- //! Sets a vector of attribute values of a object that is valid in a time and slice
- virtual bool setProperties (const string& object_id, const vector<string>& values, TimeType& time, const int& slice = -1);
-
- //! Gets a vector of attribute values of a object that is valid in a slice
- virtual bool getProperties (const string& object_id, vector<string>& values, const int& slice = -1);
-
- //! Gets a vector of attribute values of a object that is valid in a time and slice
- virtual bool getProperties (const string& object_id, vector<string>& values, TimeType& time, const int& slice = -1);
-
- //! Sets the value of the attribute named "attr_name" of an object that is valid in a slice
- virtual bool setAttributeValue (const string& object_id, const string& attr_name, const string& val, const int& slice = -1);
-
- //! Sets the value of the attribute named "attr_name" of an object that is valid in a time and slice
- virtual bool setAttributeValue (const string& object_id, const string& attr_name, const string& val, TimeType& time, const int& slice = -1);
-
- //! Sets the value of the i-th attribute of an object that is valid in a slice
- virtual bool setAttributeValue (const string& object_id, const int& i, const string& val, const int& slice = -1);
-
- //! Sets the value of the i-th attribute of an object that is valid in a time and slice
- virtual bool setAttributeValue (const string& object_id, const int& i, const string& val, TimeType& time, const int& slice = -1);
-
- //! Get the value of the attribute named "attr_name" of an object that is valid in a slice
- virtual bool getAttributeValue (const string& object_id, const string& attr_name, string& val, const int& slice = -1);
-
- //! Get the value of the attribute named "attr_name" of an object that is valid in a time and slice
- virtual bool getAttributeValue (const string& object_id, const string& attr_name, string& val, TimeType& time, const int& slice = -1);
-
- //! Gets the value of the i-th attribute of an object that is valid in a slice
- virtual bool getAttributeValue (const string& object_id, const int& i, string& val, const int& slice = -1);
-
- //! Gets the value of the i-th attribute of an object that is valid in a time and slice
- virtual bool getAttributeValue (const string& object_id, const int& i, string& val, TimeType& time, const int& slice = -1);
-
- //! Adds a new attribute in the attribute list and adds it in all instances in the set using a default value
- virtual bool addProperty(TeAttributeRep& attr, const string& defaultValue);
-
- //! Adds a new attribute only in the attribute list
- virtual bool addProperty(TeAttribute& attr);
-
- /*!
- \brief Adds the property or sets its value in the object in a valid slice.
-
- If there is already the property in the attribute list, sets the value of the instances of an object
- valid in a specific slice. If there is no this property in the attribute list, adds it in the attribute
- list and in all instances in the set. After that, sets the value of the instances of an object
- valid in a specific slice.
- */
- virtual bool addProperty(const string& object_id, TeProperty& prop, const int& slice=-1);
-
- /*!
- \brief Adds the property or sets its value in the object in a valid time and slice.
-
- If there is already the property in the attribute list, sets the value of the instances of an object
- valid in a specific time and slice. If there is no this property in the attribute list, adds it in the attribute
- list and in all instances in the set. After that, sets the value of the instances of an object
- valid in a specific time and slice.
- */
- virtual bool addProperty(const string& object_id, TeProperty& prop, TimeType& time, const int& slice = -1);
-
- //! Removes an attribute of the attribute list and removes it of all instances in the set
- virtual void removeProperty(TeAttributeRep& attr);
-
- //! Calculates the bounding box of all instances of all objects included in the set
- virtual TeBox& getBox();
-
- //! Sets the bounding box of all instances of all objects included in the set
- virtual void setBox(TeBox& b)
- { box_ = b; }
-
- //! Clears the set
- virtual void clear();
-
- //! Returns an iterator to the first element of the set
- virtual iterator begin()
- { return instances_.begin(); }
-
- //! Returns an iterator to the one past last element of the set
- virtual iterator end()
- { return instances_.end(); }
-
- //! Searchs the instances which bounding boxes intersect a specific bounding box, using the R Tree.
- virtual bool search(const TeBox& b, vector<InstanceType* >& result);
-
- //! Fills the ST instance set from a layer or theme, using the given filled parameters
- virtual bool build(bool loadGeometries=false, bool loadAllAttributes=true, vector<string> attrNames=vector<string>(), int slide=-1);
-
- //! Fills the ST instance set from a layer or theme, using the given filled parameters
- virtual bool build(TeGroupingAttr& groupAttr, bool loadGeometries=false, int slide=-1);
-
-
- /*! \class propertyIterator
- \brief This class implements an iterator concept over the instance set.
-
- A structure that allows the traversal ST element set
- in a similar way as the STL iterators. This iterator passes over each
- ST instance of the ST element set and returns a specific numerical property.
- */
- class propertyIterator
- {
- public:
- //! Constructor
- propertyIterator (TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>* setIt,
- typename std::vector<InstanceType>::iterator it,
- const string& attrName):
- attrName_(attrName), attrIndex_(-1), it_(it), setIt_(setIt)
- {
- attrIndex_ = setIt_->getAttributeIndex(attrName);
- }
-
- //! Constructor
- propertyIterator (TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>* setIt,
- typename std::vector<InstanceType>::iterator it,
- const int& attrIndex):
- attrName_ (""), attrIndex_(attrIndex), it_(it), setIt_(setIt)
- { }
-
- //! Constructor
- propertyIterator (typename vector<InstanceType>::iterator it,
- const int& attrIndex):
- attrName_ (""), attrIndex_(attrIndex), it_(it)
- {}
-
- //! Moves to the next attribute in the set
- propertyIterator& operator++()
- {
- ++it_;
- return (*this);
- }
-
- //! Returns the current attribute as double
- double operator*()
- { return (*it_)[attrIndex_]; }
-
- //! Sets a new value to the attrIndex_-th attribute of the element pointed by the iterator
- void setValue(const double& val)
- { it_->setPropertyValue(attrIndex_, Te2String(val)); }
-
- //! Returns a pointer to the instance set
- TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>* elemSet()
- { return setIt_; }
-
- //! Equal operator
- bool operator==(const propertyIterator& rhs) const
- { return (this->attrIndex_ == rhs.attrIndex_ && this->it_== rhs.it_); }
-
- //! Unequal operator
- bool operator!=(const propertyIterator& rhs) const
- { return (this->attrIndex_ != rhs.attrIndex_ || this->it_!= rhs.it_); }
-
- //! Deprecated: Returns the numerical property of the current instance.
- bool getProperty(TeProperty& prop)
- { return (*it_).getProperty(prop, attrIndex_); }
-
- protected:
- string attrName_; //<! the numerical property name
- int attrIndex_; //<! the numerical property index
- typename vector<InstanceType>::iterator it_;
- TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>* setIt_;
-
- };
-
- //! Returns a property iterator to the attribute named "attName" of the first instance in the set.
- propertyIterator begin(const string& attName)
- {
- return propertyIterator(this, instances_.begin(), attName);
- }
-
- //! Returns a property iterator to the attIndex-th attribute of the first instance in the set.
- propertyIterator begin(const int& attIndex)
- {
- return propertyIterator(this, instances_.begin(), attIndex);
- }
-
- //! Returns a property iterator to the attribute named "attName" of the one past last element of the set
- propertyIterator end(const string& attName)
- {
- return propertyIterator(this, instances_.end(), attName);
- }
-
- //! Returns a property iterator to the attIndex-th attribute of the one past last element of the set
- propertyIterator end(const int& attIndex)
- {
- return propertyIterator(this, instances_.end(), attIndex);
- }
-};
-
-template<typename GeometryType, typename TimeType, typename InstanceType>
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::TeBaseSTInstanceSet() :
- theme_(0), layer_(0), rTree_(0)
-{
- TeAttributeList* att = new TeAttributeList();
- attrList_ = TeSharedPtr<TeAttributeList>(att);
-}
-
-
-template<typename GeometryType, typename TimeType, typename InstanceType>
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::TeBaseSTInstanceSet(TeTheme* theme, const TeAttributeList& attrList)
-{
- layer_ = 0;
- theme_ = 0;
- rTree_ = 0;
- TeAttributeList* att = new TeAttributeList(attrList);
- attrList_ = TeSharedPtr<TeAttributeList>(att);
- if(!theme)
- return;
- theme_ = theme;
- rTree_ = new TeSAM::TeRTree<int>(theme_->box());
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType>
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::TeBaseSTInstanceSet(TeLayer* layer, const TeAttributeList& attrList)
-{
- layer_ = 0;
- theme_ = 0;
- rTree_ = 0;
- TeAttributeList* att = new TeAttributeList(attrList);
- attrList_ = TeSharedPtr<TeAttributeList>(att);
- if(!layer)
- return;
- layer_ = layer;
- rTree_ = new TeSAM::TeRTree<int>(layer_->box());
-}
-
-
-template<typename GeometryType, typename TimeType, typename InstanceType>
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::TeBaseSTInstanceSet(const TeBox& box, const TeAttributeList& attrList)
-{
- layer_ = 0;
- theme_ = 0;
- rTree_ = 0;
- box_ = box;
- TeAttributeList* att = new TeAttributeList(attrList);
- attrList_ = TeSharedPtr< TeAttributeList >(att);
- if(!box_.isValid())
- return;
- rTree_ = new TeSAM::TeRTree<int>(box);
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType>
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::TeBaseSTInstanceSet(const TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>& other)
-{
- instances_ = other.instances_;
- minTime_ = other.minTime_;
- maxTime_ = other.maxTime_;
- attrList_ = other.attrList_;
- theme_ = other.theme_;
- layer_ = other.layer_;
- box_ = other.box_;
- objectIdToInstances_ = other.objectIdToInstances_;
- timeToInstances_ = other.timeToInstances_;
- sliceToInstances_ = other.sliceToInstances_;
- rTree_ = 0;
-
- if(other.rTree_)
- {
- //Operador de copia nao implementado!
- //rTree_ = new TeSAM::TeRTree<int>(other.rTree_->getBox());
- //*rTree_ = *other.rTree_;
- }
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType>
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::~TeBaseSTInstanceSet()
-{
- if(rTree_)
- delete rTree_;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>&
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::operator= (const TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>& other)
-{
- if ( this != &other )
- {
- instances_ = other.instances_;
- minTime_ = other.minTime_;
- maxTime_ = other.maxTime_;
- attrList_ = other.attrList_;
- theme_ = other.theme_;
- layer_ = other.layer_;
- box_ = other.box_;
- objectIdToInstances_ = other.objectIdToInstances_;
- timeToInstances_ = other.timeToInstances_;
- sliceToInstances_ = other.sliceToInstances_;
- if(rTree_)
- delete rTree_;
- rTree_ = 0;
-
- if(other.rTree_)
- {
- //Operador de copia nao implementado!
- //rTree_ = new TeSAM::TeRTree<int>(other.rTree_->getBox());
- //*rTree_ = *other.rTree_;
- }
- }
- return *this;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> void
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::setAttributeList(TeAttributeList& attrs)
-{
- if(!attrList_.isActive())
- return;
-
- attrList_->clear();
- TeAttributeList::iterator it = attrs.begin();
- while(it!=attrs.end())
- {
- attrList_->push_back(*it);
- ++it;
- }
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> int
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getAttributeIndex(const string& attrName)
-{
- string newName = TeConvertToUpperCase(attrName);
- size_t pos = newName.find(".", 0, 1);
- if (pos != string::npos)
- newName = TeConvertToUpperCase(attrName.substr(pos+1));
-
- for(unsigned int i=0; i<attrList_->size(); ++i)
- {
- string s = TeConvertToUpperCase((*attrList_)[i].rep_.name_);
- if((s == TeConvertToUpperCase(attrName)) || (s == newName))
- return i;
- }
- return -1;
-}
-
-
-
-template<typename GeometryType, typename TimeType, typename InstanceType> InstanceType*
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getSTInstance(const unsigned int& index)
-{
- if(index<instances_.size())
- return &(instances_[index]);
-
- return 0;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> InstanceType*
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getSTInstance(const string& objectId, const int& slice)
-{
- map<string, vector<int> >::iterator itObj = objectIdToInstances_.find(objectId);
- if(itObj==objectIdToInstances_.end())
- return 0;
-
- if(slice<0)
- {
- //The slice is not considered
- vector<int>::iterator it = itObj->second.begin();
- if(it==itObj->second.end())
- return 0;
- return getSTInstance(*it);
- }
-
- map<int, vector<int> >::iterator itSlice = sliceToInstances_.find(slice);
- if(itSlice==sliceToInstances_.end())
- return 0;
-
- vector<int>::iterator it = itObj->second.begin();
- while(it != itObj->second.end())
- {
- vector<int>::iterator it2;
- it2 = find(itSlice->second.begin(), itSlice->second.end(), *it);
- if(it2!=itSlice->second.end())
- return getSTInstance(*it2);
- ++it;
- }
- return 0;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> InstanceType*
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getSTInstance(const string& objectId, TimeType& time, const int& slice)
-{
- map<string, vector<int> >::iterator itObj = objectIdToInstances_.find(objectId);
- if(itObj==objectIdToInstances_.end())
- return 0;
-
- typename map<TimeType, vector<int> >::iterator itTime = timeToInstances_.find(time);
- if(itTime==timeToInstances_.end())
- return 0;
-
- if(slice<0)
- {
- //The slice is not considered
- vector<int>::iterator it = itObj->second.begin();
- while(it != itObj->second.end())
- {
- vector<int>::iterator it2;
- it2 = find(itTime->second.begin(), itTime->second.end(), *it);
- if(it2!=itTime->second.end())
- return getSTInstance(*it2);
- ++it;
- }
- return 0;
- }
-
- map<int, vector<int> >::iterator itSlice = sliceToInstances_.find(slice);
- if(itSlice==sliceToInstances_.end())
- return 0;
-
- vector<int>::iterator it = itObj->second.begin();
- while(it != itObj->second.end())
- {
- vector<int>::iterator it2, it3;
- it2 = find(itTime->second.begin(), itTime->second.end(), *it);
- it3 = find(itSlice->second.begin(), itSlice->second.end(), *it);
- if((it2!=itTime->second.end()) && (it3!=itSlice->second.end()))
- return getSTInstance(*it2);
- ++it;
- }
- return 0;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> void
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getSTInstances(vector<InstanceType* >& set, const string& objectId, const int& slice)
-{
- set.clear();
- map<string, vector<int> >::iterator itObj = objectIdToInstances_.find(objectId);
- if(itObj==objectIdToInstances_.end())
- return;
-
- vector<int>::iterator it = itObj->second.begin();
- while(it != itObj->second.end())
- {
- InstanceType* inst = getSTInstance(*it);
- if((slice<0) || (inst->getSlice()==slice))
- set.push_back(inst);
- ++it;
- }
- return;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> void
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getSTInstances(vector<InstanceType* >& set, const string& objectId, TimeType& time, const int& slice)
-{
- set.clear();
- map<string, vector<int> >::iterator itObj = objectIdToInstances_.find(objectId);
- if(itObj==objectIdToInstances_.end())
- return;
-
- vector<int>::iterator it = itObj->second.begin();
- while(it != itObj->second.end())
- {
- InstanceType* inst = getSTInstance(*it);
- if(((slice<0) || (inst->getSlice()==slice)) && (inst->getTime()== time))
- set.push_back(inst);
- ++it;
- }
- return;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> void
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getSTInstances(vector<InstanceType* >& set, TimeType& time, const int& slice)
-{
- set.clear();
- typename map<TimeType, vector<int> >::iterator itTime = timeToInstances_.find(time);
- if(itTime==timeToInstances_.end())
- return;
-
- vector<int>::iterator it = itTime->second.begin();
- while(it != itTime->second.end())
- {
- InstanceType* inst = getSTInstance(*it);
- if((slice<0) || (inst->getSlice()==slice))
- set.push_back(inst);
- ++it;
- }
- return;
-
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> void
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getSTInstances(vector<InstanceType* >& set, const int& slice)
-{
- set.clear();
- map<int, vector<int> >::iterator itSlice = sliceToInstances_.find(slice);
- if(itSlice==sliceToInstances_.end())
- return;
-
- vector<int>::iterator it = itSlice->second.begin();
- while(it != itSlice->second.end())
- {
- set.push_back(getSTInstance(*it));
- ++it;
- }
- return;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::insertSTInstance (InstanceType& inst)
-{
- inst.setAttrList(attrList_);
- instances_.push_back(inst);
- int index = (instances_.size()-1);
- vector<int> aux;
- aux.push_back(index);
-
- //object identity information
- map<string, vector<int> >::iterator itObj = objectIdToInstances_.find(inst.getObjectId());
- if(itObj!=objectIdToInstances_.end())
- itObj->second.push_back(index);
- else
- objectIdToInstances_[inst.getObjectId()] = aux;
-
- //time information
- if(inst.isTimeValid())
- {
- typename map<TimeType, vector<int> >::iterator itTime = timeToInstances_.find(inst.getTime());
- if(itTime!=timeToInstances_.end())
- itTime->second.push_back(index);
- else
- timeToInstances_[inst.getTime()] = aux;
- }
-
- //slice information
- if(inst.getSlice()>=0)
- {
- map<int, vector<int> >::iterator itSlice = sliceToInstances_.find(inst.getSlice());
- if(itSlice!=sliceToInstances_.end())
- itSlice->second.push_back(index);
- else
- sliceToInstances_[inst.getSlice()] = aux;
- }
-
- //insert in the RTree
- TeBox b = inst.getGeometries().box();
- if(b.isValid())
- {
- if(rTree_)
- rTree_->insert(b, index);
- updateBox(box_, b);
- }
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> int
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::numSTInstance()
-{
- return instances_.size();
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> int
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::numSTInstance(const string& objectId)
-{
- map<string, vector<int> >::iterator it = objectIdToInstances_.find(objectId);
- if(it==objectIdToInstances_.end())
- return 0;
- return it->second.size();
-
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> int
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::numSTInstance(const int& slice)
-{
- map<int, vector<int> >::iterator it = sliceToInstances_.find(slice);
- if(it==sliceToInstances_.end())
- return 0;
- return it->second.size();
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> int
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::numSTInstance(TimeType& time)
-{
- typename map<TimeType, vector<int> >::iterator it = timeToInstances_.find(time);
- if(it==timeToInstances_.end())
- return 0;
- return it->second.size();
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::setGeometry(const string& object_id, GeometryType& geom, const int& slice)
-{
- InstanceType* aux = this->getSTInstance(object_id, slice);
- if(!aux)
- return false;
- aux->setGeometry(geom);
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::setGeometry(const string& object_id, GeometryType& geom, TimeType& time, const int& slice)
-{
- InstanceType* aux = this->getSTInstance(object_id, time, slice);
- if(!aux)
- return false;
- aux->setGeometry(geom);
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getGeometry(const string& object_id, GeometryType& geom, const int& slice)
-{
- InstanceType* aux = this->getSTInstance(object_id, slice);
- if(!aux)
- return false;
- geom = aux->getGeometries();
- return true;
-
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getGeometry(const string& object_id, GeometryType& geom, TimeType& time, const int& slice)
-{
- InstanceType* aux = this->getSTInstance(object_id, time, slice);
- if(!aux)
- return false;
- geom = aux->getGeometries();
- return true;
-}
-
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getPropertyVector (const string& object_id, TePropertyVector& propVec, const int& slice)
-{
- propVec.clear();
- InstanceType* aux = this->getSTInstance(object_id, slice);
- if(!aux)
- return false;
-
- for(unsigned int i=0; i<aux->getProperties().size(); ++i)
- {
- TeProperty prop;
- prop.value_ = aux->getProperties()[i];
- if(i<attrList_->size())
- prop.attr_ = (*attrList_)[i];
- propVec.push_back(prop);
- }
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getPropertyVector (const string& object_id,
- TePropertyVector& propVec, TimeType& time, const int& slice)
-{
- propVec.clear();
- InstanceType* aux = this->getSTInstance(object_id, time, slice);
- if(!aux)
- return false;
-
- for(unsigned int i=0; i<aux->getProperties().size(); ++i)
- {
- TeProperty prop;
- prop.value_ = aux->getProperties()[i];
- if(i<attrList_->size())
- prop.attr_ = (*attrList_)[i];
- propVec.push_back(prop);
- }
- return true;
-
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::setProperties (const string& object_id, const vector<string>& values, const int& slice)
-{
- //the number of attributes in each instance must be equal to the number of attibutes
- //in the attribute list.
- if(values.size() != attrList_->size())
- return false;
-
- InstanceType* aux = this->getSTInstance(object_id, slice);
- if(!aux)
- return false;
- aux->setProperties(values);
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::setProperties (const string& object_id, const vector<string>& values, TimeType& time, const int& slice)
-{
- //the number of attributes in each instance must be equal to the number of attibutes
- //in the attribute list.
- if(values.size() != attrList_->size())
- return false;
-
- InstanceType* aux = this->getSTInstance(object_id, time, slice);
- if(!aux)
- return false;
- aux->setProperties(values);
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getProperties (const string& object_id, vector<string>& values, const int& slice)
-{
- values.clear();
- InstanceType* aux = this->getSTInstance(object_id, slice);
- if(!aux)
- return false;
- values = aux->getProperties();
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getProperties (const string& object_id, vector<string>& values, TimeType& time, const int& slice)
-{
- values.clear();
- InstanceType* aux = this->getSTInstance(object_id, time, slice);
- if(!aux)
- return false;
- values = aux->getProperties();
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::setAttributeValue (const string& object_id, const string& attr_name, const string& val, const int& slice)
-{
- int index = this->getAttributeIndex(attr_name);
- return this->setAttributeValue(object_id, index, val, slice);
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::setAttributeValue (const string& object_id, const string& attr_name, const string& val, TimeType& time, const int& slice)
-{
- int index = this->getAttributeIndex(attr_name);
- return this->setAttributeValue(object_id, index, val, time, slice);
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::setAttributeValue (const string& object_id, const int& i, const string& val, const int& slice)
-{
- if(i<0 || i>=(int)attrList_->size()) //if there is not this attribute, return false
- return false;
- InstanceType* aux = this->getSTInstance(object_id, slice);
- if(!aux)
- return false;
- aux->setPropertyValue(i, val);
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::setAttributeValue (const string& object_id, const int& i, const string& val, TimeType& time, const int& slice)
-{
- if(i<0 || i>=(int)attrList_->size()) //if there is not this attribute, return false
- return false;
- InstanceType* aux = this->getSTInstance(object_id, time, slice);
- if(!aux)
- return false;
- aux->setPropertyValue(i, val);
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getAttributeValue (const string& object_id, const string& attr_name, string& val, const int& slice)
-{
- int index = this->getAttributeIndex(attr_name);
- return this->getAttributeValue(object_id, index, val, slice);
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getAttributeValue (const string& object_id, const string& attr_name, string& val, TimeType& time, const int& slice)
-{
- int index = this->getAttributeIndex(attr_name);
- return this->getAttributeValue(object_id, index, val, time, slice);
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getAttributeValue (const string& object_id, const int& i, string& val, const int& slice)
-{
- if(i<0 || i>=(int)attrList_->size())
- return false;
- InstanceType* aux = this->getSTInstance(object_id, slice);
- if(!aux)
- return false;
- val = aux->getProperties()[i];
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getAttributeValue (const string& object_id, const int& i, string& val, TimeType& time, const int& slice)
-{
- if(i<0 || i>=(int)attrList_->size())
- return false;
- InstanceType* aux = this->getSTInstance(object_id, time, slice);
- if(!aux)
- return false;
- val = aux->getProperties()[i];
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::addProperty(TeAttributeRep& attr, const string& defaultValue)
-{
- //verify if there is this attribute
- if(getAttributeIndex(attr.name_)>=0)
- return true;
-
- TeAttribute at;
- at.rep_ = attr;
- attrList_->push_back(at);
- typename vector<InstanceType>::iterator it = instances_.begin();
-
- //the number of attributes in each instance must be equal to the number of attibutes
- //in the attribute list.
- if((attrList_->size()-1) != it->getProperties().size())
- return false;
- while(it!=instances_.end())
- {
- it->addPropertyValue(defaultValue);
- ++it;
- }
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::addProperty(TeAttribute& attr)
-{
- //verify if there is this attribute
- if(getAttributeIndex(attr.rep_.name_)<0)
- attrList_->push_back(attr);
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::addProperty(const string& object_id, TeProperty& prop, const int& slice)
-{
- int index = this->getAttributeIndex(prop.attr_.rep_.name_);
- if(index<0)
- {
- //adds this new attribute in the attr list and in all instances
- attrList_->push_back(prop.attr_);
- typename vector<InstanceType>::iterator it = instances_.begin();
- while(it!=instances_.end())
- {
- if( (object_id == it->getObjectId()) && ((slice<0) || (slice==it->getSlice())))
- it->addPropertyValue(prop.value_);
- else
- it->addPropertyValue(string(""));
- ++it;
- }
- return true;
- }
-
- //Sets this attribute value
- typename vector<InstanceType>::iterator it = instances_.begin();
- while(it!=instances_.end())
- {
- if( (object_id == it->getObjectId()) && ((slice<0) || (slice==it->getSlice())))
- it->setPropertyValue(index, prop.value_);
- ++it;
- }
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::addProperty(const string& object_id, TeProperty& prop, TimeType& time, const int& slice)
-{
- int index = this->getAttributeIndex(prop.attr_.rep_.name_);
- if(index<0)
- {
- //adds this new attribute in the attr list and in all instances
- attrList_->push_back(prop.attr_);
- typename vector<InstanceType>::iterator it = instances_.begin();
- while(it!=instances_.end())
- {
- if( (object_id == it->getObjectId()) &&
- (time == it->getTime()) &&
- ((slice<0) || (slice==it->getSlice())))
- it->addPropertyValue(prop.value_);
- else
- it->addPropertyValue(string(""));
- ++it;
- }
- return true;
- }
-
- //Sets this attribute value
- typename vector<InstanceType>::iterator it = instances_.begin();
- while(it!=instances_.end())
- {
- if( (object_id == it->getObjectId()) &&
- (time == it->getTime()) &&
- ((slice<0) || (slice==it->getSlice())))
- it->setPropertyValue(index, prop.value_);
- ++it;
- }
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> void
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::removeProperty(TeAttributeRep& attr)
-{
- //Remove of the attribute list
- string newName = TeConvertToUpperCase(attr.name_);
- size_t pos = attr.name_.find(".", 0, 1);
- if (pos != string::npos)
- newName = TeConvertToUpperCase(attr.name_.substr(pos+1));
-
- unsigned int index = 0;
- TeAttributeList::iterator it = attrList_->begin();
- while(it!=attrList_->end())
- {
- string s = TeConvertToUpperCase(it->rep_.name_);
- if((s == TeConvertToUpperCase(attr.name_)) || (s == newName))
- {
- attrList_->erase(it);
- break;
- }
- ++it;
- ++index;
- }
-
- //Remove of all instances
- typename vector<InstanceType>::iterator it2 = instances_.begin();
- while(it2!=instances_.end())
- {
- it2->removePropertyValue(index);
- ++it;
- }
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> TeBox&
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::getBox()
-{
- if(box_.isValid())
- return box_;
-
- if (instances_.size() <= 0)
- return box_;
-
- typename TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::iterator it = this->begin();
-
- while (it != this->end())
- {
- updateBox(box_,it->getGeometries().box());
- ++it;
- }
- return box_;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> void
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::clear()
-{
- instances_.clear();
- attrList_->clear();
- objectIdToInstances_.clear();
- timeToInstances_.clear();
- sliceToInstances_.clear();
- if(rTree_)
- rTree_->clear();
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::search(const TeBox& b, vector<InstanceType* >& result)
-{
- if(!rTree_ )
- return false;
-
- vector<int> intResult;
- rTree_->search(b, intResult);
- for(unsigned int i=0; i<intResult.size(); ++i)
- result.push_back(getSTInstance(intResult[i]));
- return true;
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::build(bool loadGeometries, bool loadAllAttributes, vector<string> attrNames, int slide)
-{
- TeQuerierParams param;
- if(theme_)
- param.setParams(theme_);
- else if(layer_)
- param.setParams(layer_);
- else
- return false;
-
- param.setFillParams(loadGeometries, loadAllAttributes, attrNames);
- TeQuerier querier(param);
- return(buildImpl(&querier, slide));
-}
-
-template<typename GeometryType, typename TimeType, typename InstanceType> bool
-TeBaseSTInstanceSet<GeometryType, TimeType, InstanceType>::build(TeGroupingAttr& groupAttr, bool loadGeometries, int slide)
-{
- TeQuerierParams param;
- if(theme_)
- param.setParams(theme_);
- else if(layer_)
- param.setParams(layer_);
- else
- return false;
-
- param.setFillParams(loadGeometries, groupAttr);
- TeQuerier querier(param);
- return(buildImpl(&querier, slide));
-}
-
-
-#endif
-
diff --git a/src/terralib/kernel/TeBlockLoader.cpp b/src/terralib/kernel/TeBlockLoader.cpp
deleted file mode 100644
index a0168cb..0000000
--- a/src/terralib/kernel/TeBlockLoader.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-/*
-** ----------------------------------------------------------------------------
-** Includes:
-*/
-
-#include "TeBlockLoader.h"
-
-/*
-** ----------------------------------------------------------------------------
-** Definitions:
-*/
-
-/*
-** ----------------------------------------------------------------------------
-** Methods Implementation:
-*/
-
-TeBlockLoader::TeBlockLoader(const TeBlockLoaderParams& params)
-{
- params_ = params;
-}
-
-TeBlockLoader::~TeBlockLoader()
-{
-}
-
-bool
-TeBlockLoader::loadBlocks()
-{
- portal_ = params_.db->getPortal();
- portal_->freeResult();
-
- if (!portal_)
- {
- return false; // Error opening portal.
- }
-
- // Set columns to be retrieved.
- std::string cols;
- if (params_.load_all_attrs)
- {
- cols = "*";
- }
- else
- {
- cols = "";
- std::vector<std::string>::iterator it = params_.attrs.begin();
- std::vector<std::string>::iterator end = params_.attrs.end();
- while(it != end)
- {
- cols.append(*(it++));
- if (it != end)
- {
- cols.append(", ");
- }
- }
- }
-
- // Set spatial restrictions.
- std::string rest;
- rest += " NOT( ";
- rest += "lower_x > " + Te2String(params_.selection_box.x2_, 12) + " OR ";
- rest += "upper_x < " + Te2String(params_.selection_box.x1_, 12) + " OR ";
- rest += "lower_y > " + Te2String(params_.selection_box.y2_, 12) + " OR ";
- rest += "upper_y < " + Te2String(params_.selection_box.y1_, 12) + " )";
-
- // Set block id restrictions.
- if (params_.dont_load_ids.size() > 0)
- {
- std::set<int>::iterator it = params_.dont_load_ids.begin();
- std::set<int>::iterator end = params_.dont_load_ids.end();
- while (it != end)
- {
- rest += " AND block_id <> " + Te2String(*(it++));
- }
- }
-
- // Set other restrictions.
- if (params_.attrs_rest.length() > 0)
- {
- rest += " AND (" + params_.attrs_rest + ")";
- }
-
- // Mount SQL query.
- std::string sql = "SELECT " + cols + " FROM " + params_.table_name + " WHERE " + rest;
-
- return portal_->query(sql);
-
-}
-
-bool
-TeBlockLoader::fetchNext()
-{
- return portal_->fetchRow();
-}
-
-int
-TeBlockLoader::getID()
-{
- return portal_->getInt("block_id");
-}
-
-void
-TeBlockLoader::getSpatialData(unsigned char* &data, long& size)
-{
- portal_->getBlob("spatial_data", data, size);
-}
-
-char*
-TeBlockLoader::getData(const std::string& name)
-{
- return portal_->getData(name);
-}
-
-int
-TeBlockLoader::getInt(const std::string& name)
-{
- return portal_->getInt(name);
-}
-
-double
-TeBlockLoader::getDouble(const std::string& name)
-{
- return portal_->getDouble(name);
-}
-
-bool
-TeBlockLoader::getBool(const std::string& name)
-{
- return portal_->getBool(name);
-}
-
-TeTime
-TeBlockLoader::getDate(const std::string& name)
-{
- return portal_->getDate(name);
-}
-
-std::string
-TeBlockLoader::getDateAsString(const std::string& name)
-{
- return portal_->getDateAsString(name);
-}
-
-/*
-** ----------------------------------------------------------------------------
-** End:
-*/
diff --git a/src/terralib/kernel/TeBlockLoader.h b/src/terralib/kernel/TeBlockLoader.h
deleted file mode 100644
index 41b3cc7..0000000
--- a/src/terralib/kernel/TeBlockLoader.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeBlockLoader.h
- \brief This file contains structures and definitions for loading data blocks.
-*/
-#ifndef __TERRALIB_INTERNAL_BLOCKLOADER_H
-#define __TERRALIB_INTERNAL_BLOCKLOADER_H
-
-/*
-** ----------------------------------------------------------------------------
-** Includes:
-*/
-#include "TeDatabase.h"
-#include "TeBox.h"
-#include "TeTime.h"
-#include <string>
-#include <vector>
-
-/*
-** ----------------------------------------------------------------------------
-** Definitions:
-*/
-
-typedef struct
-{
- TeDatabase* db;
-
- std::string table_name;
- TeBox selection_box;
-
- bool load_all_attrs;
- std::vector<std::string> attrs;
- std::string attrs_rest;
-
- std::set<int> dont_load_ids;
-
-} TeBlockLoaderParams;
-
-class TL_DLL TeBlockLoader
-{
-public:
-
- /// Default constructor.
- TeBlockLoader(const TeBlockLoaderParams& params);
-
- /// Virtual destructor.
- virtual ~TeBlockLoader();
-
- bool loadBlocks();
-
- bool fetchNext();
-
- int getID();
- void getSpatialData(unsigned char* &data, long& size);
-
- char* getData(const std::string& name);
- int getInt(const std::string& name);
- double getDouble(const std::string& name);
- bool getBool(const std::string& name);
- TeTime getDate(const std::string& name);
- std::string getDateAsString(const std::string& name);
-
-protected:
-
- TeBlockLoaderParams params_;
- TeDatabasePortal* portal_;
-
-};
-
-#endif // __TERRALIB_INTERNAL_BLOCKLOADER_H
-
-/*
-** ----------------------------------------------------------------------------
-** End:
-*/
\ No newline at end of file
diff --git a/src/terralib/kernel/TeBox.cpp b/src/terralib/kernel/TeBox.cpp
index c583b0d..5f61bc4 100644
--- a/src/terralib/kernel/TeBox.cpp
+++ b/src/terralib/kernel/TeBox.cpp
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#include "TeBox.h"
#include "TeGeometry.h"
diff --git a/src/terralib/kernel/TeBox.h b/src/terralib/kernel/TeBox.h
index 62b782b..bcbc2c9 100644
--- a/src/terralib/kernel/TeBox.h
+++ b/src/terralib/kernel/TeBox.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeBox.h
\brief This file contains structures and definitions to deal with a box
*/
diff --git a/src/terralib/kernel/TeBufferRegion.cpp b/src/terralib/kernel/TeBufferRegion.cpp
deleted file mode 100644
index a20456a..0000000
--- a/src/terralib/kernel/TeBufferRegion.cpp
+++ /dev/null
@@ -1,1073 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-/*
- TODO: 1. tentar otimizar as rotinas auxilixares (elementares) de forma que o sentido do segmento nao seja importante
- e que possamos garantir a orientacao da linha que iremos tracar ao redor de um segmento de reta (acabar dom didswap!)
-*/
-
-#include "TeBufferRegion.h"
-#include "TeOverlay.h"
-#include "TeGeometry.h"
-#include "TeGeometryAlgorithms.h"
-
-#include <map>
-#include <algorithm>
-#include <cmath>
-
-using namespace std;
-
-namespace TeBUFFERREGION
-{
-
-//---------------- Auxiliary Constants ----------------//
-const double bufferPI = 3.14159265358979323846;
-const double doubleBufferPI = 6.28318530717958647692;
-const double halfBufferPI = 1.57079632679489661923;
-
-//---------------- Auxiliary Functions ----------------//
-
-/** Rotina auxiliar que define o angulo inicial utilizado para tracar o buffer ao redor de um segmento de reta (rotina de uso interno - nao deve ser utilizada diretamente).
- \param first primeiro ponto que define o segmento de reta: a rotina pode inverter seu conteudo com o parametro "last"
- \param last segundo ponto que define o segmento de reta: a rotina pode inverter seu conteudo com o parametro "first"
- \param ang angulo que define uma linha perpendicular ao segmento passando pela coordenada first
- \param didswap indica se as coordenadas first e last foram trocadas (se foi realizado o swap delas)
- \note As coordenadas first e last devem ser necessariamente diferentes.
- */
-inline void TeFindInitialAng(TeCoord2D& first, TeCoord2D& last, double& ang, bool& didswap)
-{
- double xLength = 0.0;
- double val_ang = 0.0;
-
- if(first.x_ > last.x_)
- {
- swap(first, last);
- didswap = true;
- }
- else if(first.x_ == last.x_)
- {
- if(first.y_ < last.y_)
- {
- swap(first, last);
- didswap = true;
- }
- }
-
-// cumprimeto do segmento ao longo do eixo "x"
- xLength = last.x_ - first.x_;
-
-// cumprimento do segmento
- double segmentLength = TeDistance(first, last);
-
-// inclinacao do segmento
- val_ang = xLength / segmentLength;
-
- if(val_ang > 1.0) // erros de arredondamento podem definir um valor um "pouco" maior que 1, e nesse caso arredondamos para 1.
- {
- val_ang = 1.0;
- }
- else if(val_ang < -1.0) // erros de arredondamento podem definir um valor um "pouco" menor que -1, e nesse caso arredondamos para 1.
- {
- val_ang = -1.0;
- }
- else if(fabs(val_ang) <= 0.000000000000001) // erros de arredondamento podem definir um valor um "pouco" maior que zero, e nesse caso arredondamos para 0.
- {
- ang = 0.0;
- }
- else
- {
- if(first.y_ == last.y_) // se o segmento for horizontal, o angulo inicial sera: (pi / 2)
- ang = halfBufferPI;
- else
- if(first.y() > last.y())
- ang = asin(val_ang);
- else
- ang = acos(val_ang) + halfBufferPI;
- }
-
- return;
-}
-
-/** Rotina auxiliar que traca um buffer elementar ao redor de um segmento, arredondando apenas um dos cantos do segmento: a linha do buffer tera orientacao horaria.
- \param first primeiro ponto que define o segmento de reta.
- \param last segundo ponto que define o segmento de reta.
- \param bufferDistance distancia utilizada para tracar o buffer.
- \param numPoints numero de pontos utilizado na definicao da semi-circunferencia ao redor dos vertices.
- \param bufferLevels numero de niveis do buffer.
- \param bufferPols linhas no sentido horario que definem a linha de buffer de cada nivel.
- */
-inline void TeElementarBuffer(TeCoord2D first, TeCoord2D last, const double& bufferDistance,
- const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygon>& bufferPols)
-{
- bufferPols.clear();
-
- double ang = 0.0; // angulo que define uma linha perpendicular ao primeiro vertice do segmento
- bool didswap = false; // indica se a rotina TeFindInitialAng fez o swap das coordenadas first e last
-
- TeFindInitialAng(first, last, ang, didswap);
-
- ang += bufferPI; // como vamos tracar as linhas no sentido horario, vamos comecar 180 graus depois e entao vamos decrementando
-
- double deltaAng = bufferPI / (numPoints - 1); // angulo de cada setor que compoem o buffer
- double c = 0.0; // variavel que contera o resultado do cosseno de um angulo
- double s = 0.0; // variavel que contera o resultado do seno de um angulo
- double x = 0.0; // variavel que contera a coordenada x transladada
- double y = 0.0; // variavel que contera a coordenada y transladada
-
-// incializa a linha que delimitara cada nivel de buffer
- vector<TeLine2D> bufferLines;
-
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
- TeLine2D newLine;
- bufferLines.push_back(newLine);
- }
-
-// verifica se o segmento foi ou nao invertido: isso eh importante para podermos manter a orientacao da linha de buffer
-// que estamos criando
- if(didswap)
- {
-// para cada extremo, calcula uma semi-circunferencia
- for(unsigned int i = 1; i < numPoints; ++i)
- {
- c = cos(ang);
- s = sin(ang);
-
-// repete o procedimento para cada nivel do buffer
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- x = first.x() + bufferDistance * (j + 1) * c ;
- y = first.y() + bufferDistance * (j + 1) * s ;
- bufferLines[j].add(TeCoord2D(x, y));
- }
-
- ang -= deltaAng;
- }
-
-// coloca o ultimo ponto do primeiro arco
- c = cos(ang);
- s = sin(ang);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
-// coloca o ultimo ponto do primeiro arco
- x = first.x() + bufferDistance * (j + 1) * c;
- y = first.y() + bufferDistance * (j + 1) * s;
- bufferLines[j].add(TeCoord2D(x, y));
-
-// coloca o primeiro ponto do segundo arco
- x = last.x() + bufferDistance * (j + 1) * c ;
- y = last.y() + bufferDistance * (j + 1) * s;
- bufferLines[j].add(TeCoord2D(x, y));
- }
-
-// coloca o ultimo ponto do segundo arco
- ang -= bufferPI;
-
- c = cos(ang);
- s = sin(ang);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- x = last.x() + bufferDistance * (j + 1) * c;
- y = last.y() + bufferDistance * (j + 1) * s;
- bufferLines[j].add(TeCoord2D(x, y));
-
-// fecha a linha: que jah se encontra no sentido horario
- bufferLines[j].add(bufferLines[j][0]);
-
-// cria o poligono correspondente e coloca no vetor de saida
- TePolygon pol;
- pol.add(TeLinearRing(bufferLines[j]));
- bufferPols.push_back(pol);
- }
- }
- else
- {
-// coloca o primeiro ponto do primeiro arco
- c = cos(ang);
- s = sin(ang);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- x = first.x() + bufferDistance * (j + 1) * c;
- y = first.y() + bufferDistance * (j + 1) * s;
- bufferLines[j].add(TeCoord2D(x, y));
- }
-
-// coloca o ultimo ponto do primeiro arco
- ang -= bufferPI;
-
- c = cos(ang);
- s = sin(ang);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
-// coloca o ultimo ponto do primeiro arco
- x = first.x() + bufferDistance * (j + 1) * c;
- y = first.y() + bufferDistance * (j + 1) * s;
- bufferLines[j].add(TeCoord2D(x, y));
-
-// coloca o primeiro ponto do segundo arco
- x = last.x() + bufferDistance * (j + 1) * c ;
- y = last.y() + bufferDistance * (j + 1) * s ;
- bufferLines[j].add(TeCoord2D(x, y));
- }
-
-// coloca os pontos do ultimo arco
- for(unsigned int i = 1; i < numPoints; ++i)
- {
- ang -= deltaAng;
-
- c = cos(ang);
- s = sin(ang);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- x = last.x() + bufferDistance * (j + 1) * c ;
- y = last.y() + bufferDistance * (j + 1) * s ;
- bufferLines[j].add(TeCoord2D(x, y));
- }
- }
-
-// fecha cada linha, que jah deve estar no sentido horario
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- bufferLines[j].add(bufferLines[j][0]);
-
-// cria o poligono correspondente e coloca no vetor de saida
- TePolygon pol;
- pol.add(TeLinearRing(bufferLines[j]));
- bufferPols.push_back(pol);
- }
- }
-
- return;
-}
-
-/** Rotina auxiliar que traca um buffer elementar ao redor de um segmento, arredondando os dois cantos do segmento: a linha do buffer tera orientacao horaria.
- \param first primeiro ponto que define o segmento de reta.
- \param last segundo ponto que define o segmento de reta.
- \param bufferDistance distancia utilizada para tracar o buffer.
- \param numPoints numero de pontos utilizado na definicao da semi-circunferencia ao redor dos vertices.
- \param bufferLevels numero de niveis do buffer.
- \param bufferPols linhas no sentido horario que definem a linha de buffer de cada nivel.
- */
-inline void TeFullElementarBuffer(TeCoord2D first, TeCoord2D last, const double& bufferDistance,
- const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygon>& bufferPols)
-{
- bufferPols.clear();
-
- double ang = 0.0; // angulo que define uma linha perpendicular ao primeiro vertice do segmento
- bool didswap = false; // indica se a rotina TeFindInitialAng fez o swap das coordenadas first e last
-
- TeFindInitialAng(first, last, ang, didswap);
-
- ang += bufferPI; // como vamos tracar as linhas no sentido horario, vamos comecar 180 graus depois e entao vamos decrementando
-
- double deltaAng = bufferPI / (numPoints - 1); // angulo de cada setor que compoem o buffer
- double c = 0.0; // variavel que contera o resultado do cosseno de um angulo
- double s = 0.0; // variavel que contera o resultado do seno de um angulo
- double x = 0.0; // variavel que contera a coordenada x transladada
- double y = 0.0; // variavel que contera a coordenada y transladada
-
-// incializa a linha que delimitara cada nivel de buffer
- vector<TeLine2D> bufferLines;
-
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
- TeLine2D newLine;
- bufferLines.push_back(newLine);
- }
-
-// para cada extremo, calcula uma semi-circunferencia
- for(unsigned int i = 1; i < numPoints; ++i)
- {
- c = cos(ang);
- s = sin(ang);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- x = first.x() + bufferDistance * (j + 1) * c;
- y = first.y() + bufferDistance * (j + 1) * s;
- bufferLines[j].add(TeCoord2D(x, y));
- }
-
- ang -= deltaAng;
- }
-
- c = cos(ang);
- s = sin(ang);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
-// coloca o ultimo ponto da primeira semi-circunferencia
- x = first.x() + bufferDistance * (j + 1) * c;
- y = first.y() + bufferDistance * (j + 1) * s;
- bufferLines[j].add(TeCoord2D(x, y));
-
-// coloca o primeiro ponto da segunda semi-circunferencia
- x = last.x() + bufferDistance * (j + 1) * c;
- y = last.y() + bufferDistance * (j + 1) * s;
- bufferLines[j].add(TeCoord2D(x, y));
- }
-
-// coloca os demais pontos da segunda semi-circunferencia
- for(unsigned int i = 1; i < numPoints; ++i)
- {
- ang -= deltaAng;
-
- c = cos(ang);
- s = sin(ang);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- x = last.x() + bufferDistance * (j + 1) * c;
- y = last.y() + bufferDistance * (j + 1) * s;
- bufferLines[j].add(TeCoord2D(x, y));
- }
- }
-
-// fecha cada linha, que jah deve estar no sentido horario
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- bufferLines[j].add(bufferLines[j][0]);
-
-// cria o poligono correspondente e coloca no vetor de saida
- TePolygon pol;
- pol.add(TeLinearRing(bufferLines[j]));
- bufferPols.push_back(pol);
- }
-
- return;
-}
-
-/** Rotina auxiliar que traca um buffer ao redor de uma linha, tracando varios niveis independentemente um do outro: para cada nivel de buffer, o anel externo do poligono estara no sentido horario e os buracos estarao no sentido anti-horario.
- \param line linha para a qual os buffers serao tracados.
- \param bufferDistance distancia utilizada para tracar o buffer.
- \param numPoints numero de pontos utilizados para construcao dos semi-circulos de cada segmento.
- \param bufferLevels numero de niveis do buffer.
- \param polVec vetor de saida com os poligonos de buffer de cada nivel: nao aninhados, isto e, possivelmente estao sobrepostos, sendo o ratamento dado em outras rotinas de mais alto nivel (que utilizam esta como suporte).
- */
-inline bool TeLineBuffer(const TeLine2D& line, const double& bufferDistance, const unsigned int& numPoints,
- const unsigned int& bufferLevels, vector<TePolygon>& polVec)
-{
- polVec.clear();
-
- unsigned int nStep = line.size();
-
- if(nStep < 2)
- return false;
-
-// vetor auxiliar que contera em cada posicao um polygonset
-// com todos os poligonos elementares de um determinado nivel de buffer
- vector<TePolygonSet> psAux;
-
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
- TePolygonSet pset;
- psAux.push_back(pset);
- }
-
-// para linhas fechadas poderemos tracar somente buffer elementares com metade dos arcos
-// enquanto que para linhas abertas, o buffer do primeiro segmento sera feito com um buffer elementar completo (os dois semi-circulos serao tracados).
-// a seguir, computaremos os buffers elementares de cada nivel.
- if(line.isRing())
- {
- for(unsigned int i = 1; i < nStep; ++i)
- {
-// gera os poliginos elementares a partir dos segmentos definidos por cada par de vertice
- vector<TePolygon> pols;
- TeElementarBuffer(line[i - 1], line[i], bufferDistance, numPoints, bufferLevels, pols);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- psAux[j].add(pols[j]);
- }
- }
- else
- {
-// para linhas abertas, o primeiro segmento tem um tratamento diferenciado enquanto os demais nao terao
- vector<TePolygon> pols;
- TeFullElementarBuffer(line[0], line[1], bufferDistance, numPoints, bufferLevels, pols);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- psAux[j].add(pols[j]);
-
- for(unsigned int i = 2; i < nStep; ++i)
- {
-// gera os poliginos elementares a partir dos segmentos definidos por cada par de vertice
- TeElementarBuffer(line[i - 1], line[i], bufferDistance, numPoints, bufferLevels, pols);
-
- for(unsigned int j = 0; j < bufferLevels; ++j)
- psAux[j].add(pols[j]);
- }
- }
-
-// agora, com os buffers elementares de cada nivel jah computados, vamos fazer
-// a uniao dos buffers elementares de cada nivel individualmente
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- TePolygonSet polSetOut;
-
-// caso a uniao falhe, interrompe a execucao sinalizando o problema!
- if(TeOVERLAY::TePairUnion(psAux[j], polSetOut) == false)
- return false;
-
-// teoricamente o buffer de cada nivel sera formado por um unico poligono com ou sem buracos.
- if(polSetOut.size() != 1)
- return false;
-
- polVec.push_back(polSetOut[0]);
- }
-
- return true;
-}
-
-/** Rotina auxiliar que traca um buffer interno (negativo) no interior de um poligono, tracando varios niveis independentemente um do outro: para cada nivel de buffer, o anel externo do poligono estara no sentido horario e os buracos estarao no sentido anti-horario.
- \param pol poligono para a qual os buffers serao tracados.
- \param bufferDistance distancia utilizada para tracar o buffer.
- \param numPoints numero de pontos utilizados para construcao dos semi-circulos de cada segmento.
- \param bufferLevels numero de niveis do buffer.
- \param polsVec vetor de saida com os poligonos de buffer de cada nivel: jah aninhados, isto e, os poligonos do nivel "n" jah consideram os do nivel "n-1".
- */
-inline bool TeInsideBufferRegion(const TePolygon& pol, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygonSet>& polsVec)
-{
- polsVec.clear();
-
- unsigned int nRings = pol.size();
-
- //vetor de polygonset, onde cada poligonset est� associado a um nivel
- //cada nivel contem os buffers internos do pai
- vector<TePolygonSet> internalBuffers;
-
- //vetor de polygonset, onde cada poligonset est� associado a um nivel
- //cada nivel contem os buffers externos dos buracos
- vector<TePolygonSet> externalBuffers;
-
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
- TePolygonSet pset;
- polsVec.push_back(pset);
- TePolygonSet pset2;
- internalBuffers.push_back(pset2);
- TePolygonSet pset3;
- externalBuffers.push_back(pset3);
- }
-
- // para cada anel vamos tracar o buffer e armazenar somente a parte de interesse:
- // no caso de aneis externos vamos
- // ficar com o buffer interno e no caso de buracos vamos ficar com os buffer externos
- for(unsigned int i = 0; i < nRings; ++i)
- {
- vector<TePolygon> buffVec;
-
- if(TeLineBuffer(pol[i], bufferDistance, numPoints, bufferLevels, buffVec) == false)
- return false;
-
- if(i == 0)
- {
-// para o anel externo ficamos com os aneis internos do buffer
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- unsigned int rsize = buffVec[j].size();
- for(unsigned int k = 1; k < rsize; ++k)
- {
- TePolygon paux; paux.add(buffVec[j][k]); //comeca em 1 ate k
- internalBuffers[j].add(paux);
- }
- }
- }
- else
- {
-// para um anel interno ficamos com os aneis externos do buffer
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- TePolygon paux; paux.add(buffVec[j][0]);
- externalBuffers[j].add(paux);
- }
- }
- }
- //para cada nivel, calcular o buraco do resultado que ser�
- //a diferenca entre os buffers internos e
- //a uniao dos buffers externos
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
- TePolygonSet holes;
-
- if(externalBuffers[i].size()>0)
- {
- TePolygonSet externalBuffersUnion;
- //uniao dos buffers externos
- if(TeOVERLAY::TePairUnion(externalBuffers[i], externalBuffersUnion) == false)
- return false;
-
- // o buffer interno ao pai pode nao existir se a distancia for muito grande
- if(internalBuffers[i].size()>0)
- {
- //diferenca
- if(TeOVERLAY::TeDifference(internalBuffers[i], externalBuffersUnion, holes) == false)
- return false;
- }
-
- //se o resultado da diferenca der vazio, significa que os buffers internos entao
- //contidos nos buffer externos
- //assim temos que adicionar como buracos, os buracos originais
- if(holes.size()==0)
- {
- TePolygon h;
- for(unsigned j=1; j<pol.size(); ++j) // buracos originais
- {
- h.add(pol[j]);
- holes.add(h);
- }
- }
- }
- else
- {
- //o unico buraco e o internal buffer do pai
- holes = internalBuffers[i];
- }
-
- //montar o buffer final
- TePolygon result;
- result.add(pol[0]); // pai do original
- for(unsigned j=0; j<holes.size(); ++j) // buracos calculados
- result.add(holes[j][0]);
-
- polsVec[i].add(result);
- }
-
- return true;
-}
-
-/** Rotina auxiliar que traca um buffer externo (positivo) ao redor de um poligono, tracando varios niveis independentemente um do outro: para cada nivel de buffer, o anel externo do poligono estara no sentido horario e os buracos estarao no sentido anti-horario.
- \param pol poligono para a qual os buffers serao tracados.
- \param bufferDistance distancia utilizada para tracar o buffer.
- \param numPoints numero de pontos utilizados para construcao dos semi-circulos de cada segmento.
- \param bufferLevels numero de niveis do buffer.
- \param polsVec vetor de saida com os poligonos de buffer de cada nivel: jah aninhados, isto e, os poligonos do nivel "n" jah consideram os do nivel "n-1".
- */
-inline bool TeOutsideBufferRegion(const TePolygon& pol, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygonSet>& polsVec)
-{
- polsVec.clear();
-
- unsigned int nRings = pol.size();
-
-// jah coloca um objeto polygonset correspondente a cada nivel
- vector<TePolygonSet> outPutPolsVec;
-
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
- TePolygonSet pset;
- outPutPolsVec.push_back(pset);
- TePolygonSet pset2;
- polsVec.push_back(pset2);
- }
-
-// para cada anel vamos tracar o buffer e armazenar somente a parte de interesse: no caso de aneis externos vamos
-// ficar com o buffer externo e no caso de buracos vamos ficar com os buffer internos
- for(unsigned int i = 0; i < nRings; ++i)
- {
- vector<TePolygon> buffVec;
-
- if(TeLineBuffer(pol[i], bufferDistance, numPoints, bufferLevels, buffVec) == false)
- return false;
-
- if(i == 0)
- {
-// para o anel externo ficamos com o anel externo do buffer
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- TePolygon paux; paux.add(buffVec[j][0]);
- outPutPolsVec[j].add(paux);
- }
- }
- else
- {
-// para um anel interno ficamos com os aneis internos do buffer
- for(unsigned int j = 0; j < bufferLevels; ++j)
- {
- unsigned int rsize = buffVec[j].size();
-
- for(unsigned int k = 1; k < rsize; ++k)
- {
- TePolygon paux; paux.add(buffVec[j][k]);
- outPutPolsVec[j].add(paux);
- }
- }
- }
- }
-
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
-// no caso de buffers positivos (para fora) pelo menos o buffer do anel externo devera aparecer em cada nivel
- if(outPutPolsVec[i].size() == 0)
- return false;
-
- TePolygonSet psetOut = outPutPolsVec[i];
-
-// LOGICA PARA O ANEL EXTERNO
- if(i == 0)
- {
-// o primeiro buffer pegara como buraco o anel externo original
- psetOut[0].add(pol[0]);
- polsVec[i].add(psetOut[0]);
- }
- else
- {
- TeLine2D laux;
- laux.copyElements(outPutPolsVec[i - 1][0][0]);
- psetOut[0].add(TeLinearRing(laux));
- polsVec[i].add(psetOut[0]);
- }
-
-// se nao temos buracos no corrente, entao nao precisamos nos preocupar com diferencas e etc...
- if(psetOut.size() == 1)
- continue;
-
-
-// LOGICA PARA OS ANEIS INTERNOS
- if(i == 0)
- {
-// vamos montar um polygonset com os buracos do poligono original
- TePolygonSet psetOriginalInnerRings;
-
- for(unsigned int j = 1; j < nRings; ++j)
- {
- TePolygon paux; paux.add(pol[j]);
- psetOriginalInnerRings.add(paux);
- }
-
-// agora vamos montar um polygonset com os buracos (que jah estao como poligonos) do primeiro nivel
- TePolygonSet currentPset;
-
- for(unsigned int j = 1; j < psetOut.size(); ++j)
- {
- currentPset.add(psetOut[j]);
- }
-
-// agora fazemos a diferena dos originais com o do primeiro nivel
- TePolygonSet resultPset;
-
- if(TeOVERLAY::TeDifference(psetOriginalInnerRings, currentPset, resultPset) == false)
- return false;
-
- for(unsigned int j = 0; j < resultPset.size(); ++j)
- {
- polsVec[i].add(resultPset[j]);
- }
- }
- else
- {
-// vamos montar um polygonset com os buracos do "n-1" e um com o corrente ("n")
- TePolygonSet previousPset;
-
- for(unsigned int j = 1; j < outPutPolsVec[i - 1].size(); ++j)
- {
- previousPset.add(outPutPolsVec[i - 1][j]);
- }
-
- TePolygonSet currentPset;
-
- for(unsigned int j = 1; j < psetOut.size(); ++j)
- {
- currentPset.add(psetOut[j]);
- }
-
-// agora fazemos a diferena do nivel anterior com o do nivel corrente
- TePolygonSet resultPset;
-
- if(TeOVERLAY::TeDifference(previousPset, currentPset, resultPset) == false)
- return false;
-
- for(unsigned int j = 0; j < resultPset.size(); ++j)
- {
- polsVec[i].add(resultPset[j]);
- }
- }
- }
-
- return true;
-}
-
-inline bool TeInOutBufferRegion(const TePolygon& pol, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygonSet>& polsVec)
-{
- polsVec.clear();
-
- unsigned int nRings = pol.size();
-
- //vetor de polygonset, onde cada polygonset est� associado a um nivel
- //cada nivel contem os buffers internos e externos
- // de cada anel do poligono
- vector<TePolygonSet> polVecBuffers;
-
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
- TePolygonSet pset;
- polsVec.push_back(pset);
- TePolygonSet pset2;
- polVecBuffers.push_back(pset2);
- }
-
- // para cada anel vamos tracar o buffer e armazenar o poligono gerado (com aneis externo e internos)
- for(unsigned int i = 0; i < nRings; ++i)
- {
- vector<TePolygon> buffVec;
-
- if(TeLineBuffer(pol[i], bufferDistance, numPoints, bufferLevels, buffVec) == false)
- return false;
-
- //adicona o buffer gerado em cada polygonset
- for(unsigned int j=0; j<buffVec.size(); ++j)
- polVecBuffers[j].add(buffVec[j]);
-
- }
-
-
- //para cada nivel, fazer a uniao de todos os buffers gerados
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
- //uniao dos buffers
- if(TeOVERLAY::TePairUnion(polVecBuffers[i], polsVec[i]) == false)
- return false;
- }
-
- return true;
-}
-
-} // end namespace TeBUFFERREGION
-
-//---------------- Buffer Algorithm ----------------//
-
-bool TeBUFFERREGION::TeBufferRegion(const TeCoord2D& coord, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygon>& bufferPols)
-{
-// limpa o vetor de poligonos de saida
- bufferPols.clear();
-
-// cria um vetor de linhas que contera a linha de buffer a cada nivel
- vector<TeLine2D> contourLines;
-
-// cria a linha de cada nivel e jah acrescenta a coordenada inicial do canto esquerdo
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
-// linha de buffer do i-th nivel
- TeLine2D newLine;
- newLine.add(TeCoord2D((coord.x() - (bufferDistance * (i + 1))), (coord.y())));
-
- contourLines.push_back(newLine);
- }
-
- double initialAng = bufferPI; // angulo inicial
- const double deltaAng = doubleBufferPI / numPoints; // angulo de cada setor que compoem o buffer
-
- double x = 0.0; // variavel que contera a coordenada x transladada
- double y = 0.0; // variavel que contera a coordenada y transladada
- double c = 0.0; // variavel que contera o resultado do cosseno de um angulo
- double s = 0.0; // variavel que contera o resultado do seno de um angulo
-
-
-// calcula as coordenadas que formarao a linha de buffer de cada nivel
- for(unsigned int i = 1; i < numPoints; ++i)
- {
- initialAng -= deltaAng;
-
- c = cos(initialAng);
- s = sin(initialAng);
-
-// gera o ponto equivalente para cada nivel de buffer
- for(unsigned int k = 0; k < bufferLevels; ++k)
- {
- x = coord.x_ + bufferDistance * (k + 1) * c;
- y = coord.y_ + bufferDistance * (k + 1) * s;
-
- contourLines[k].add(TeCoord2D(x, y));
- }
- }
-
-// fecha cada uma das linhas de buffer,
-// repetindo o primeiro ponto e cria os poligonos de buffer de cada nivel formado pela respectiva
-// linha de buffer
- for(unsigned int i = 0; i < bufferLevels; ++i)
- {
- contourLines[i].add(contourLines[i][0]);
-
- TePolygon pol;
- pol.add(TeLinearRing(contourLines[i]));
- bufferPols.push_back(pol);
- }
-
-// coloca o anel externo do nivel "n-1" como anel interno do nivel "n"
- for(unsigned int i = 1; i < bufferLevels; ++i)
- {
-// clona a linha externa do nivel "n-1"
- TeLine2D laux;
- laux.copyElements(bufferPols[i - 1][0]);
-
-// deixa no sentido anti-horario a linha que servira de buraco para o buffer do nivel "n"
- reverse(laux.begin(), laux.end());
-
-// e, finalmente, coloca a linha do nivel "n-1" como buraco do nivel "n"
- bufferPols[i].add(TeLinearRing(laux));
- }
-
- return true;
-}
-
-bool TeBUFFERREGION::TeBufferRegion(const TeCoord2D& coord, const double& bufferDistance, const unsigned int& numPoints, TePolygon& pol)
-{
- pol.clear();
-
-// define um vetor temporario para chamar a rotina acima, que realmente implementa o buffer de um ponto
- vector<TePolygon> bufferPols;
-
-// solicita o buffer de um unico nivel ao redor do ponto
- TeBufferRegion(coord, bufferDistance, numPoints, 1, bufferPols);
-
- if(bufferPols.empty())
- return false;
-
- pol = bufferPols[0];
-
- return true;
-}
-
-bool TeBUFFERREGION::TeBufferRegion(const TeLine2D& line, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygonSet>& polVec)
-{
- polVec.clear();
-
- for(unsigned int level=0; level<bufferLevels; ++level)
- {
- TePolygonSet aux;
- polVec.push_back(aux);
- }
-
-// para tracar o semi-circulo ao redor do canto do segmento precisamos de pelo menos tres pontos
- unsigned int cornerPts = numPoints;
-
- if(numPoints < 3)
- cornerPts = 3;
-
-// traca os buffers de cada nivel ao redor da linha: cada posicao do vetor "outPutPolVec" contera o poligono de cada nivel
- vector<TePolygon> outPutPolVec;
-
- if(TeLineBuffer(line, bufferDistance, cornerPts, bufferLevels, outPutPolVec) == false)
- return false;
-
-// se o numero de poligonos da saida for diferente do numero de niveis desejado, algum erro ocorreu
- if(outPutPolVec.size() != bufferLevels)
- return false;
-
-// para cada nivel de buffer precisamos acomodar os aneis do nivel anterior:
-// no caso do buffer de linhas, o buffer do nivel "n" eh exatamente a diferenca do resultado que temos ate aqui menos o resultado
-// do buffer do nivel "n-1"
- polVec[0].add(outPutPolVec[0]);
-
- for(unsigned int i = 1; i < bufferLevels; ++i)
- {
- TePolygonSet currentPSet; currentPSet.add(outPutPolVec[i]);
- TePolygonSet previousPSet; previousPSet.add(outPutPolVec[i - 1]);
-
- TePolygonSet polSetOut;
-
- if(TeOVERLAY::TeDifference(currentPSet, previousPSet, polSetOut) == false)
- return false;
-
-// esperamos que o resultado da diferenca seja sempre um poligono (com zero ou mais buracos)
- //if(polSetOut.size() != 1)
- // return false;
- //polVec.push_back(polSetOut[0]);
-
- for(unsigned int j=0; j<polSetOut.size(); ++j)
- polVec[i].add(polSetOut[j]);
- }
-
- return true;
-}
-
-bool TeBUFFERREGION::TeBufferRegion(const TeLine2D& line, const double& bufferDistance, const unsigned int& numPoints, TePolygonSet& ps)
-{
- ps.clear();
-
- vector<TePolygonSet> polVec;
-
- if(TeBufferRegion(line, bufferDistance, numPoints, 1, polVec) == false)
- return false;
-
- ps.copyElements(polVec[0]);
-
- return true;
-}
-
-bool TeBUFFERREGION::TeBufferRegion(const TePolygon& pol, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, const TeBufferType& buffType, vector<TePolygonSet>& polsVec)
-{
- if(buffType == TeINSIDEBUFFER)
- {
- return TeInsideBufferRegion(pol, bufferDistance, numPoints, bufferLevels, polsVec);
- }
- else if(buffType == TeOUTSIDEBUFFER)
- {
- return TeOutsideBufferRegion(pol, bufferDistance, numPoints, bufferLevels, polsVec);
- }
- else
- {
- return TeInOutBufferRegion(pol, bufferDistance, numPoints, bufferLevels, polsVec);
- }
-}
-
-bool TeBUFFERREGION::TeBufferRegion(const TePolygon& pol, const double& bufferDistance, const unsigned int& numPoints, TePolygonSet& ps)
-{
- ps.clear();
-
- vector<TePolygonSet> pols;
-
- if(!TeBufferRegion(pol, bufferDistance, numPoints, 1, TeOUTSIDEBUFFER, pols))
- return false;
-
- ps = pols[0];
-
- return true;
-}
-
-bool TeBUFFERREGION::TeBufferRegion(const TePolygonSet& polSetIn, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, const TeBufferType& bufferType, vector<TePolygonSet>& polyVecOut)
-{
- polyVecOut.clear();
-
- for(unsigned int j=0; j<polSetIn.size(); ++j)
- {
- vector<TePolygonSet> auxPolVec;
- if(!TeBUFFERREGION::TeBufferRegion(polSetIn[j], bufferDistance, numPoints, bufferLevels, bufferType, auxPolVec))
- return false;
-
- if(j==0)
- {
- for(unsigned int i=0; i<auxPolVec.size(); ++i)
- polyVecOut.push_back(auxPolVec[i]);
- }
- else
- {
- for(unsigned int i=0; i<auxPolVec.size(); ++i)
- {
- TePolygonSet polUnion;
- if(!TeOVERLAY::TeUnion(polyVecOut[i], auxPolVec[i], polUnion))
- return false;
- polyVecOut[i]=polUnion;
- }
- }
- }
- return true;
-}
-
-
-bool TeBUFFERREGION::TeBufferRegion(const TeLineSet& lineSetIn, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygonSet>& polyVecOut)
-{
- polyVecOut.clear();
-
- for(unsigned int j=0; j<lineSetIn.size(); ++j)
- {
- vector<TePolygonSet> currentPolVec;
- if(!TeBUFFERREGION::TeBufferRegion(lineSetIn[j], bufferDistance, numPoints, bufferLevels, currentPolVec))
- return false;
-
- if(j==0)
- {
- for(unsigned int i=0; i<currentPolVec.size(); ++i)
- polyVecOut.push_back(currentPolVec[i]);
- }
- else
- {
- for(unsigned int i=0; i<currentPolVec.size(); ++i)
- {
- TePolygonSet polUnion;
- if(!TeOVERLAY::TeUnion(polyVecOut[i], currentPolVec[i], polUnion))
- return false;
- polyVecOut[i]=polUnion;
- }
- }
- }
- return true;
-}
-
-
-bool TeBUFFERREGION::TeBufferRegion(const TePointSet& pointSetIn, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygonSet>& polyVecOut)
-{
- polyVecOut.clear();
-
- for(unsigned int j=0; j<pointSetIn.size(); ++j)
- {
- vector<TePolygon> currentPolVec;
- if(!TeBUFFERREGION::TeBufferRegion(pointSetIn[j].location(), bufferDistance, numPoints, bufferLevels, currentPolVec))
- return false;
-
- if(j==0)
- {
- for(unsigned int i=0; i<currentPolVec.size(); ++i)
- {
- TePolygonSet currentPolSet; currentPolSet.add(currentPolVec[i]);
- polyVecOut.push_back(currentPolSet);
- }
- }
- else
- {
- for(unsigned int i=0; i<currentPolVec.size(); ++i)
- {
- TePolygonSet polUnion, currentPolSet;
- currentPolSet.add(currentPolVec[i]);
- if(!TeOVERLAY::TeUnion(polyVecOut[i], currentPolSet, polUnion))
- return false;
- polyVecOut[i]=polUnion;
- }
- }
- }
- return true;
-}
-
-
-bool TeBUFFERREGION::TeBufferRegion(const TeCellSet& cellSetIn, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, const TeBufferType& bufferType, vector<TePolygonSet>& polyVecOut)
-{
- polyVecOut.clear();
-
- for(unsigned int j=0; j<cellSetIn.size(); ++j)
- {
- vector<TePolygonSet> auxPolVec;
- if(!TeBUFFERREGION::TeBufferRegion(TeMakePolygon(cellSetIn[j].box()), bufferDistance, numPoints, bufferLevels, bufferType, auxPolVec))
- return false;
-
- if(j==0)
- {
- for(unsigned int i=0; i<auxPolVec.size(); ++i)
- polyVecOut.push_back(auxPolVec[i]);
- }
- else
- {
- for(unsigned int i=0; i<auxPolVec.size(); ++i)
- {
- TePolygonSet polUnion;
- if(!TeOVERLAY::TeUnion(polyVecOut[i], auxPolVec[i], polUnion))
- return false;
- polyVecOut[i]=polUnion;
- }
- }
- }
- return true;
-}
-
diff --git a/src/terralib/kernel/TeBufferRegion.h b/src/terralib/kernel/TeBufferRegion.h
deleted file mode 100644
index 855bf74..0000000
--- a/src/terralib/kernel/TeBufferRegion.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeBufferRegion.h
- \brief This file contains structures and definitions for buffer region (map distance) operation on objects.
- \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
- */
-
-#ifndef __TERRALIB_INTERNAL_BUFFER_H
-#define __TERRALIB_INTERNAL_BUFFER_H
-
-#include "TeCoord2D.h"
-
-class TeLine2D;
-class TePolygon;
-class TePolygonSet;
-class TeLineSet;
-class TePointSet;
-class TeCellSet;
-
-/*! \brief Contains structures and definitions needed to execute Buffer Region operation
-*/
-namespace TeBUFFERREGION
-{
- //! Buffer type.
- /*!
- - TeINSIDEBUFFER used to make only inside buffer lines
- - TeOUTSIDEBUFFER used to make only outside buffer lines
- - TeINSIDEOUTSIDEBUFFER used to make inside and outside buffer lines
- */
- enum TeBufferType { TeINSIDEBUFFER, TeOUTSIDEBUFFER, TeINSIDEOUTSIDEBUFFER };
-
- /** \brief Calculates a buffer region around a point (DEPRECATED: use TeBufferRegion with buffer levels instead).
- \param coord the location of the point
- \param bufferDistance the desired distance in the same unit as coord
- \param numPoints the number of points that should be used to describe the buffer zone (a circle in this case)
- \param pol to return the buffer zone: a circle polygon in clockwise order
- \return Returns true if operation succeed otherwise returns false.
- */
- TL_DLL bool TeBufferRegion(const TeCoord2D& coord, const double& bufferDistance, const unsigned int& numPoints, TePolygon& pol);
-
- /** \brief Calculates a buffer region around a point.
- \param coord the location of the point
- \param bufferDistance the desired distance in the same unit as coord
- \param numPoints the number of points that should be used to describe the buffer zone (a circle in this case)
- \param bufferLevels the number of buffer intervals
- \param bufferPols to return the buffer intervals: a circle polygon in clockwise order with holes in counterclockwise order
- \return Returns true if operation succeed otherwise returns false.
- */
- TL_DLL bool TeBufferRegion(const TeCoord2D& coord, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygon>& bufferPols);
-
- /** \brief Calculates a buffer region around a line (DEPRECATED: use TeBufferRegion with buffer levels instead).
- \param line the line
- \param bufferDistance the desired distance in the same unit as line coordinates
- \param numPoints the number of points that should be used to describe the curved corners of the buffer zone
- \param ps to return the buffer zone: a set of polygons
- \return Returns true if operation succeed otherwise returns false.
- */
- TL_DLL bool TeBufferRegion(const TeLine2D& line, const double& bufferDistance, const unsigned int& numPoints, TePolygonSet& ps);
-
- /** \brief Calculates a buffer region around a line.
- \param line the line
- \param bufferDistance the desired distance in the same unit as line coordinates
- \param numPoints the number of points that should be used to describe the curved corners of the buffer zone
- \param bufferLevels the number of buffer intervals
- \param polVec to return the buffer zone: a vector of polygons
- \return Returns true if operation succeed otherwise returns false.
- */
- TL_DLL bool TeBufferRegion(const TeLine2D& line, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygonSet>& polVec);
-
-
- /** \brief Calculates a buffer region around a polygon (DEPRECATED: use TeBufferRegion with buffer levels instead).
- \param pol the polygon
- \param bufferDistance the desired distance in the same unit as polygon rings coordinates
- \param numPoints the number of points that should be used to describe the curved corners of the buffer zone
- \param ps to return the buffer zone: a set of polygons
- \return Returns true if operation succeed otherwise returns false.
- */
- TL_DLL bool TeBufferRegion(const TePolygon& pol, const double& bufferDistance, const unsigned int& numPoints, TePolygonSet& ps);
-
- /** \brief Calculates a buffer region around a polygon (DEPRECATED: use TeBufferRegion with buffer levels instead).
- \param pol the polygon
- \param bufferDistance the desired distance in the same unit as polygon rings coordinates
- \param numPoints the number of points that should be used to describe the curved corners of the buffer zone
- \param bufferLevels the number of buffer intervals
- \param buffType the buffer type: inside/outside/inside+outside
- \param polsVec to return the buffer zone: a vector of polygon set
- \return Returns true if operation succeed otherwise returns false.
- */
- TL_DLL bool TeBufferRegion(const TePolygon& pol, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, const TeBufferType& buffType, vector<TePolygonSet>& polsVec);
-
- /** \brief Calculates a buffer region around an object polygon set.
- \param polSetIn the object polygon set
- \param bufferDistance the desired distance in the same unit as polygon rings coordinates
- \param numPoints the number of points that should be used to describe the curved corners of the buffer zone
- \param bufferLevels the number of buffer intervals
- \param bufferType the buffer type: inside/outside/inside+outside
- \param polyVecOut to return the buffers of the object, each level in a position of the vector
- \return Returns true if operation succeed otherwise returns false.
- */
- TL_DLL bool TeBufferRegion(const TePolygonSet& polSetIn, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, const TeBufferType& bufferType, vector<TePolygonSet>& polyVecOut);
-
- /** \brief Calculates a buffer region around an object line set.
- \param lineSetIn the object line set
- \param bufferDistance the desired distance in the same unit as lines coordinates
- \param numPoints the number of points that should be used to describe the curved corners of the buffer zone
- \param bufferLevels the number of buffer intervals
- \param polyVecOut to return the buffers of the object, each level in a position of the vector
- \return Returns true if operation succeed otherwise returns false.
- */
- TL_DLL bool TeBufferRegion(const TeLineSet& lineSetIn, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygonSet>& polyVecOut);
-
- /** \brief Calculates a buffer region around an object point set.
- \param pointSetIn the object point set
- \param bufferDistance the desired distance in the same unit as points coordinates
- \param numPoints the number of points that should be used to describe the curved corners of the buffer zone
- \param bufferLevels the number of buffer intervals
- \param polyVecOut to return the buffers of the object, each level in a position of the vector
- \return Returns true if operation succeed otherwise returns false.
- */
- TL_DLL bool TeBufferRegion(const TePointSet& pointSetIn, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, vector<TePolygonSet>& polyVecOut);
-
- /** \brief Calculates a buffer region around an object cell set.
- \param cellSetIn the object cell set
- \param bufferDistance the desired distance in the same unit as cells coordinates
- \param numPoints the number of points that should be used to describe the curved corners of the buffer zone
- \param bufferLevels the number of buffer intervals
- \param bufferType the buffer type: inside/outside/inside+outside
- \param polyVecOut to return the buffers of the object, each level in a position of the vector
- \return Returns true if operation succeed otherwise returns false.
- */
- TL_DLL bool TeBufferRegion(const TeCellSet& cellSetIn, const double& bufferDistance, const unsigned int& numPoints, const unsigned int& bufferLevels, const TeBufferType& bufferType, vector<TePolygonSet>& polyVecOut);
-
-} // end namespace TeBUFFER
-
-#endif //__TERRALIB_INTERNAL_BUFFER_H
-
diff --git a/src/terralib/kernel/TeCentroid.cpp b/src/terralib/kernel/TeCentroid.cpp
deleted file mode 100644
index ecfe405..0000000
--- a/src/terralib/kernel/TeCentroid.cpp
+++ /dev/null
@@ -1,416 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include <vector>
-#include <functional>
-#include <algorithm>
-
-#include "TeAssertions.h"
-#include "TeException.h"
-#include "TeGeometryAlgorithms.h"
-
-using namespace std;
-
-
-// Prototypes for internal routines - NOT seen from the outside
-
-TeCoord2D TeFindBaricenter (const TeLinearRing& ring ); // general method ( solves most cases)
-TeCoord2D TeFindCentroidConcavePolygon (const TePolygon& poly ); // brute-force approach (use if above fails)
-
-TeCoord2D
-TeFindCentroid(TeMultiGeometry& mGeom )
-{
- TeBox bb;
- TeCoord2D ct;
- if(mGeom.hasPolygons())
- {
- ct = TeFindCentroid(mGeom.getPolygons());
- updateBox(bb,ct);
- }
- if(mGeom.hasCells())
- {
- ct = TeFindCentroid(mGeom.getCells());
- updateBox(bb,ct);
- }
- if(mGeom.hasLines())
- {
- ct = TeFindCentroid(mGeom.getLines());
- updateBox(bb,ct);
- }
- else if(mGeom.hasPoints())
- {
- ct = TeFindCentroid(mGeom.getPoints());
- updateBox(bb,ct);
- }
- return bb.center();
-}
-
-TeCoord2D
-TeFindCentroid(const TePolygon& poly )
-{
- // This is a two-step algorithm
-
- // First, try a simple geometric solution
- // that works for convex polygons and some concave ones
-
- TeCoord2D pt = TeFindBaricenter( poly[0] );
-
- if ( TeWithin ( TePoint(pt), poly) )
- return pt;
-
- // No, try a more general approach
-
- pt = TeFindCentroidConcavePolygon( poly );
-
-return pt;
-}
-
-TeCoord2D
-TeFindCentroid (const TeLine2D& line )
-{
- int midpoint = (line.size()/2) - 1 ;
- TeCoord2D middle;
-
- TeGetMiddlePoint(line[midpoint], line[midpoint+1], middle);
- return middle;
-}
-
-TeCoord2D
-TeFindCentroid(const TeCell& c)
-{
- return c.box().center();
-}
-
-TeCoord2D
-TeFindCentroid(const TePoint& p)
-{
- return p.location();
-}
-
-TeCoord2D
-TeFindCentroid(const TeText& t)
-{
- return t.location();
-}
-
-TeCoord2D
-TeFindCentroid(const TePolygonSet& s)
-{
- TeCoord2D p;
- if (s.empty())
- return p;
- double sx = 0.0;
- double sy = 0.0;
- unsigned int n = 0;
-
- TeBox bb = s.box();
- TePolygonSet::iterator it1 = s.begin();
- while (it1 != s.end())
- {
- TeCoord2D p1 = TeFindCentroid (*it1);
- sx += p1.x();
- sy += p1.y();
- ++n;
- ++it1;
- }
- double ssx = sx/n;
- double ssy = sy/n;
- p.setXY(ssx,ssy);
- return p;
-}
-
-
-TeCoord2D
-TeFindCentroid(const TeLineSet& s)
-{
- TeCoord2D p;
- if (s.empty())
- return p;
- double sx = 0.0;
- double sy = 0.0;
- unsigned int n = 0;
- TeLineSet::iterator it1 = s.begin();
- while (it1 != s.end())
- {
- TeCoord2D p1 = TeFindCentroid (*it1);
- sx += p1.x();
- sy += p1.y();
- ++n;
- it1++;
- }
- sx = sx/n;
- sy = sy/n;
- p.setXY(sx,sy);
- return p;
-}
-
-
-TeCoord2D
-TeFindCentroid(const TeCellSet& s)
-{
- TeCoord2D p;
- if (s.empty())
- return p;
- double sx = 0.0;
- double sy = 0.0;
- unsigned int n = 0;
- TeCellSet::iterator it1 = s.begin();
- while (it1 != s.end())
- {
- TeCoord2D p1 = TeFindCentroid (*it1);
- sx += p1.x();
- sy += p1.y();
- ++n;
- it1++;
- }
- sx = sx/n;
- sy = sy/n;
- p.setXY(sx,sy);
- return p;
-}
-
-TeCoord2D
-TeFindCentroid(TePointSet& points)
-{
- TeCoord2D p;
- if (points.empty())
- return p;
- if (points.size() == 1)
- p = (points[0]).location();
- else
- p = points.box().center();
- return p;
-}
-
-TeCoord2D
-TeFindCentroid(TeTextSet& texts)
-{
- return texts.box().center();
-}
-/*
- * ANSI C++ code from the article
- * "Centroid of a Polygon"
- * by Gerard Bashein and Paul R. Detmer,
- * in "Graphics Gems IV", Academic Press, 1994
- */
-
-/*********************************************************************
-Centroid: Calculates the centroid (xCentroid, yCentroid)
-of a polygon, given its vertices (x[0], y[0]) ... (x[n-1], y[n-1]). It
-is assumed that the contour is closed, i.e., that the vertex following
-(x[n-1], y[n-1]) is (x[0], y[0]).
-
-**********************************************************************/
-
-TeCoord2D
-TeFindBaricenter ( const TeLinearRing& ring )
-{
-
- double ai, atmp = 0, xtmp = 0, ytmp = 0;
-
- int n = ring.size() - 1; // our polygons wrap around
- int i, j;
-
- if (n < 3) return TeCoord2D (0., 0.);
-
- for ( i = n-1, j = 0; j < n; i = j, j++)
- {
- ai = ring[i].x() * ring[j].y() - ring[j].x() * ring[i].y();
- atmp += ai;
- xtmp += (ring[j].x() + ring[i].x()) * ai;
- ytmp += (ring[j].y() + ring[i].y()) * ai;
- }
-
- if (atmp != 0)
- {
- return TeCoord2D ( (xtmp / (3. * atmp)), ( ytmp / (3. * atmp)));
- }
- return TeCoord2D ( 0., 0. );
-}
-
-
-
-//
-// TeFindCentroidConcavePolygon
-//
-// This algorithm is based on the idea of a plane-sweep
-//
-// 1. Divide the box into horizontal slices
-//
-// 2. Sweep the plane, starting from the bottom
-//
-// 3. For each y-slice, find the horizontal intersections in the
-// forward direction (if it exists)
-//
-// 4. Sort these intersections
-//
-// 5. Order the intersections
-//
-// 6. For all possible "intersections", select a mid-point and
-// test if this point is inside the polygon
-//
-// 7. If a centroid has not been found, cut the box into
-// "smaller" slices and repeat steps 2-6
-
-
-
-// Defines a function object for sorting coordinates in ascending x-order
-
-struct x_order : public binary_function<TeCoord2D, TeCoord2D, bool>
-{
- bool operator()(TeCoord2D& pt1, TeCoord2D& pt2) { return pt1.x() < pt2.x(); }
-};
-
-// Defines a distance measure between two Coordinate pairs (used for sorting)
-
-struct x_dist : public binary_function<TeCoordPair, TeCoordPair, bool>
-{
- bool operator()(TeCoordPair c1, TeCoordPair c2)
- {
- return ( ( c1.pt2.x() - c1.pt1.x() ) > ( c2.pt2.x() - c2.pt1.x() ) );
- }
-};
-
-
-typedef vector<double> doubleVect;
-
-TeCoord2D
-TeFindCentroidConcavePolygon ( const TePolygon& poly )
-{
-
- TeLinearRing coords = poly[0];
-
- TeBox box = coords.box();
-
- int NSLICES = 10;
-
- int NMAXSLICES = 400;
-
- double yinit = box.lowerLeft().y();
-
- while ( true )
- {
- int nparts = NSLICES + 2; // divide the box into slices
-
- double increm = ( box.upperRight().y() - box.lowerLeft().y() ) / nparts; // y-increment
-
- double yslice = yinit; // start at the bottom
-
- TeCoordPairVect intersecList; //vector of horizontal intersections
-
- doubleVect crossList; //vector of x-crossings
-
- for ( int i = 0; i < NSLICES; i++ )
- {
- yslice += increm; //next slice
-
- for (unsigned int x = 0; x < ( coords.size() - 1 ); x++ )
- TeCoord2D cd= coords[x];
-
- for (unsigned int j = 0; j < ( coords.size() - 1 ); j++ )
- {
-
- TeCoord2D vtx0 = coords[j];
- TeCoord2D vtx1 = coords[j+1];
-
- bool yflag0 = ( vtx0.y() >= yslice );
- bool yflag1 = ( vtx1.y() >= yslice ) ;
- /* check if endpoints straddle (are on opposite sides) of X axis
- * (i.e. the Y's differ); if so, +X ray could intersect this edge.
- */
-
- if ( yflag0 != yflag1 )
- {
- // line crosses ring horizontally
-
- double slope = ( vtx1.x() - vtx0.x() ) / ( vtx1.y() - vtx0.y());
- double xcross = ( yslice - vtx0.y() )* slope + vtx0.x();
-
- crossList.push_back ( xcross );
- }
-
- }
-
- // Sort the x-intersections
-
- sort ( crossList.begin(), crossList.end() );
-
- doubleVect::iterator it = crossList.begin();
-
- // Create a list of intersection points
-
- while ( it != crossList.end() )
- {
- TeCoordPair cp;
-
- cp.pt1 = TeCoord2D ( (*it), yslice );
- ++it;
- if ( it == crossList.end() ) break;
-
- cp.pt2 = TeCoord2D ( (*it), yslice );
- ++it;
-
- intersecList.push_back ( cp );
- }
-
- } // for all slices
-
- // Now sort all the intersections
-
- sort ( intersecList.begin(), intersecList.end(), x_dist() );
-
- // Go through the intersection list
- // Find the mid-point
-
- TeCoordPairVect::iterator it = intersecList.begin();
-
- while ( it != intersecList.end() )
- {
- double xmid = (*it).pt1.x() + ( (*it).pt2.x() - (*it).pt1.x() ) / 2;
-
- TeCoord2D pt ( xmid, (*it).pt2.y() );
-
-
- if ( TeWithin (TePoint(pt), poly) ) // have we found it ???
- return pt;
-
- ++it; // try the next largest x-intersection
- }
-
- NSLICES *= 2; // double the number of slices
-
- // iterate until a maximum number of slices
- // if not able to find a centroid, log an error, but don't stop
- if ( NSLICES > NMAXSLICES )
- {
- string userText = "Polygon number " + Te2String(poly.geomId());
-
- TeErrorLog::instance().insert ( CENTROID_NOT_FOUND, userText );
-
- return TeCoord2D ( TeMAXFLOAT, TeMAXFLOAT );
- }
- }
-
-}
-
-
diff --git a/src/terralib/kernel/TeCommunicator.h b/src/terralib/kernel/TeCommunicator.h
deleted file mode 100644
index 4bf0719..0000000
--- a/src/terralib/kernel/TeCommunicator.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeCommunicator.h
- \brief This file contains class to deal with inter-class communication.
- \author Emiliano F. Castejon <castejon at dpi.inpe.br>
-*/
-
-#ifndef TECOMMUNICATOR_H
- #define TECOMMUNICATOR_H
-
- #include "TeMutex.h"
- #include "TeAgnostic.h"
-
- #include <list>
- #include <algorithm>
-
- /**
- * @brief A macro for use when declaring class wrapper functions that will
- * be connected to a TeCommunicator instance.
- *
- * @param function_name The function name.
- * @param param_type The function pamrameter data type.
- * @param class_name The function's host class name.
- * @note The function body must be implemented.
- */
- #define TECOMMWRAPPER( function_name, param_type, class_name ) \
- protected : void function_name( const param_type& x ); \
- public : static void function_name( const param_type& x, void* objptr ) \
- { \
- class_name * casted_ptr = ( class_name * ) objptr; \
- casted_ptr->function_name( x ); \
- };
-
- /**
- * @brief This is the template class to deal with inter-class communication.
- * @note This is a thread-safe class.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup Utils
- */
- template< typename DataType >
- class TeCommunicator
- {
- public :
-
- /**
- * @brief The objects wrapper function pointer.
- *
- * @param DataType The data type.
- * @param void A cast pointer to the active object instance.
- */
- typedef void (*WrapperFuncPtrT)( const DataType&, void* );
-
- /**
- * @brief Default Constructor.
- *
- * @param host_obj_ptr A pointer to the active class instance.
- * @param wrapper_func_ptr A pointer to the class wrapper static
- * function.
- * @param enabled_flag The emission/reception enabling/disabling flag.
- */
- TeCommunicator( void* host_obj_ptr = 0,
- WrapperFuncPtrT wrapper_func_ptr = 0,
- bool enabled_flag = true );
-
- /**
- * @brief Default Destructor
- */
- ~TeCommunicator();
-
- /**
- * @brief Connects the current instance to a class wrapper function.
- *
- * @param host_obj_ptr A pointer to the active class instance.
- * @param wrapper_func_ptr A pointer to the class wrapper static
- * function.
- */
- void setHostObj( void* host_obj_ptr = 0,
- WrapperFuncPtrT wrapper_func_ptr = 0 );
-
- /**
- * @brief Connects the current instance to another active instance.
- *
- * @param external The external active instance reference.
- * @return true if OK, false on errors.
- */
- bool connect( TeCommunicator< DataType>& external );
-
- /**
- * @brief Disconnects the current instance from all connected instances.
- */
- void disconnect();
-
- /**
- * @brief Disconnects the current instance from another instance.
- *
- * @param external The external active instance reference.
- */
- void disconnect( TeCommunicator< DataType>& external );
-
- /**
- * @brief Send data to all connected instances.
- *
- * @param data The data to be sent.
- */
- void send( const DataType& data ) const;
-
- /**
- * @brief Enables/disables the data emission and rececption.
- *
- * @param enabled_flag The emission/reception enabling/disabling flag.
- */
- void toggle( bool enabled_flag );
-
- /**
- * @brief Check if this instance emission/reception is enabled.
- * @return true if enabled, false if disabled.
- */
- bool isEnabled();
-
- protected :
-
- /** @typedef TeCommunicator< DataType >* ComPtrT
- * Communicator pointer type definition.
- */
- typedef TeCommunicator< DataType >* ComPtrT;
-
- /** @typedef std::list< ComPtrT > ContainerT
- * Connected communicators pointers container type definition.
- */
- typedef std::list< ComPtrT > ContainerT;
-
- /** @typedef typename ContainerT::iterator ContItT
- * Connected communicators pointers container iterator type definition.
- */
- typedef typename ContainerT::iterator ContItT;
-
- /**
- * @brief Used when another active instance requests to be connected to this
- * instance.
- *
- * @param my_pointer The pointer of the active instance.
- */
- void ConnectMe( ComPtrT my_pointer );
-
- /**
- * @brief Used when another active instance requests to be disconnected from
- * this instance.
- *
- * @param my_pointer The pointer of the active instance.
- */
- void DisconnectMe( ComPtrT my_pointer );
-
- /**
- * @brief Used when another active instance sends data to this instance.
- *
- * @param data The sent data.
- */
- inline void Receive( const DataType& data ) const;
-
- private :
-
- /**
- * @brief A flag indication for enabled/disabled.
- */
- bool emission_reception_enabled_;
-
- /**
- * @brief A pointer to the host object wrapper function.
- */
- WrapperFuncPtrT wrapper_func_ptr_;
-
- /**
- * @brief A pointer to the host object active instance.
- */
- void* host_obj_ptr_;
-
- /**
- * @brief A list of pointers to the connected active instances.
- */
- mutable ContainerT connections_;
-
- /** @brief Thread lock instance. */
- mutable TeMutex lock_instance_;
-
- /**
- * @brief Copy constructor not allowed.
- */
- TeCommunicator( const TeCommunicator< DataType >& ) {};
-
- /**
- * @brief Copy operation not allowed.
- */
- const TeCommunicator< DataType >& operator=(
- const TeCommunicator< DataType >& ) {};
-
- };
-
-
- template< typename DataType >
- TeCommunicator< DataType >::TeCommunicator( void* host_obj_ptr,
- WrapperFuncPtrT wrapper_func_ptr, bool enabled_flag )
- {
- wrapper_func_ptr_ = 0;
- host_obj_ptr_ = 0;
- emission_reception_enabled_ = enabled_flag;
-
- setHostObj( host_obj_ptr, wrapper_func_ptr );
- }
-
-
- template< typename DataType >
- TeCommunicator< DataType >::~TeCommunicator()
- {
- disconnect();
- }
-
-
- template< typename DataType >
- void TeCommunicator< DataType >::setHostObj( void* host_obj_ptr,
- WrapperFuncPtrT wrapper_func_ptr )
- {
- lock_instance_.lock();
-
-// TEAGN_TRUE_OR_THROW( (wrapper_func_ptr != 0),
-// ( ( wrapper_func_ptr == 0 ) && ( host_obj_ptr == 0 ) ) ||
-// ( ( wrapper_func_ptr != 0 ) && ( host_obj_ptr != 0 ) ) ),
-// "Invalid receiver_func_ptr/host_obj_ptr parameters" );
-
- wrapper_func_ptr_ = wrapper_func_ptr;
- host_obj_ptr_ = host_obj_ptr;
-
- lock_instance_.unLock();
- }
-
-
- template< typename DataType >
- bool TeCommunicator< DataType >::connect(
- TeCommunicator< DataType>& external )
- {
- lock_instance_.lock();
-
-// if( ( wrapper_func_ptr_ == 0 ) || ( host_obj_ptr_ == 0 ) ) {
- if( wrapper_func_ptr_ == 0 ) {
- lock_instance_.unLock();
-
- TEAGN_LOGERR( "Connecting a inactive communicator instance" );
-
- return false;
- }
-
- ContItT it = find( connections_.begin(), connections_.end(),
- &external );
-
- if( it == connections_.end() ) {
- connections_.push_back( &external );
- external.ConnectMe( this );
- }
-
- lock_instance_.unLock();
-
- return true;
- }
-
-
- template< typename DataType >
- void TeCommunicator< DataType >::disconnect()
- {
- lock_instance_.lock();
-
- ContItT it = connections_.begin();
- ContItT it_end = connections_.end();
-
- while( it != it_end ) {
- (*it)->DisconnectMe( this );
-
- ++it;
- }
-
- connections_.clear();
-
- lock_instance_.unLock();
- }
-
-
- template< typename DataType >
- void TeCommunicator< DataType >::disconnect(
- TeCommunicator< DataType>& external )
- {
- lock_instance_.lock();
-
- ContItT it = find( connections_.begin(), connections_.end(),
- &external );
-
- if( it != connections_.end() ) {
- (*it)->DisconnectMe( this );
- connections_.erase( it );
- }
-
- lock_instance_.unLock();
- }
-
-
- template< typename DataType >
- void TeCommunicator< DataType >::ConnectMe(
- ComPtrT my_pointer )
- {
- lock_instance_.lock();
-
- ContItT it = find( connections_.begin(), connections_.end(),
- my_pointer );
-
- if( it == connections_.end() ) {
- connections_.push_back( my_pointer );
- }
-
- lock_instance_.unLock();
- }
-
-
- template< typename DataType >
- void TeCommunicator< DataType >::DisconnectMe(
- ComPtrT my_pointer )
- {
- lock_instance_.lock();
-
- ContItT it = find( connections_.begin(), connections_.end(),
- my_pointer );
-
- if( it != connections_.end() ) {
- connections_.erase( it );
- }
-
- lock_instance_.unLock();
- }
-
-
- template< typename DataType >
- void TeCommunicator< DataType >::send( const DataType& data ) const
- {
- lock_instance_.lock();
-
- if( emission_reception_enabled_ ) {
- ContItT it = connections_.begin();
- ContItT it_end = connections_.end();
-
- while( it != it_end ) {
- (*it)->Receive( data );
-
- ++it;
- }
- }
-
- lock_instance_.unLock();
- }
-
-
- template< typename DataType >
- void TeCommunicator< DataType >::toggle( bool enabled_flag )
- {
- lock_instance_.lock();
-
- emission_reception_enabled_ = enabled_flag;
-
- lock_instance_.unLock();
- }
-
-
- template< typename DataType >
- bool TeCommunicator< DataType >::isEnabled()
- {
- return emission_reception_enabled_;
- }
-
-
- template< typename DataType >
- inline void TeCommunicator< DataType >::Receive(
- const DataType& data ) const
- {
- lock_instance_.lock();
-
- if( emission_reception_enabled_ && ( wrapper_func_ptr_ != 0 ) ) {
- wrapper_func_ptr_( data, host_obj_ptr_ );
- }
-
- lock_instance_.unLock();
- }
-
-/** @example TeCommunicator_test.cpp
- * Shows how to use this class.
- */
-
-#endif
-
diff --git a/src/terralib/kernel/TeComposite.h b/src/terralib/kernel/TeComposite.h
index 03d5b6e..7589c99 100644
--- a/src/terralib/kernel/TeComposite.h
+++ b/src/terralib/kernel/TeComposite.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeComposite.h
\brief This file contains definition of composite structures in TerraLib
*/
diff --git a/src/terralib/kernel/TeConsoleErrorMessage.cpp b/src/terralib/kernel/TeConsoleErrorMessage.cpp
deleted file mode 100644
index a10f646..0000000
--- a/src/terralib/kernel/TeConsoleErrorMessage.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <iostream>
-#include "TeErrorMessage.h"
-
-using namespace std;
-
-class TeConsoleErrorMessage: public TeErrorMessage
-{
-public:
-
- TeConsoleErrorMessage(){}
- ~TeConsoleErrorMessage(){}
- virtual TeMessageReturn apply (
- const string& appName,
- const string & msgText,
- TeMessageType /* msgType */,
- TeMessageIcon /* iconType */ )
- { cout << appName << msgText; return Te_IDOK; }
-
-
-
-};
-
-
-class TeConsoleErrorMessagePrototype: public TeErrorMessagePrototype
-{
- virtual TeErrorMessage* build()
- { return new TeConsoleErrorMessage(); }
-
-}consoleInstance;
diff --git a/src/terralib/kernel/TeConsoleErrorMessage.h b/src/terralib/kernel/TeConsoleErrorMessage.h
deleted file mode 100644
index b96995e..0000000
--- a/src/terralib/kernel/TeConsoleErrorMessage.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//***********************************************************************
-// TerraLib is a GIS Classes and Functions Library that
-// strongly explores Spatial Database Technologies
-//
-// Copyright � 2002 INPE and Tecgraf/PUC-Rio.
-//
-// This library is free software; you can redistribute it
-// and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation
-// version 2.1.(http://www.opensource.org/licenses/lgpl-license.php)
-//
-//
-//
-// Send questions or suggestions about the TerraLib Project
-// to terralib at dpi.inpe.br .
-//**************************************************************************//
-/*! \file TeConsoleErrorMessage.h
- This file deals with the display of error messages in a console
-*/
-#ifndef TeConsoleErrorMessage_H
-#define TeConsoleErrorMessage_H
-
-#include <iostream>
-#include "TeErrorMessage.h"
-
-using namespace std;
-
-//! A class to handle the display of error messages in a console
-class TeConsoleErrorMessage: public TeErrorMessage
-{
-public:
-
- //! Constructor
- TeConsoleErrorMessage()
- {}
-
- //! Destructor
- ~TeConsoleErrorMessage()
- {}
-
- //! Display the message
- virtual TeMessageReturn apply (
- const string& appName,
- const string & msgText,
- TeMessageType msgType,
- TeMessageIcon iconType )
- { cout << appName << msgText; return Te_IDOK; }
-
-};
-
-//! A prototype of a Console Error Message handler
-class TeConsoleErrorMessagePrototype: public TeErrorMessagePrototype
-{
- virtual TeErrorMessage* build()
- { return new TeConsoleErrorMessage(); }
-
-};
-
-//! A single instance of the console error message handler
-static TeConsoleErrorMessagePrototype consoleInstance;
-#endif
-
diff --git a/src/terralib/kernel/TeCoord2D.h b/src/terralib/kernel/TeCoord2D.h
index 94624f7..3eb5093 100644
--- a/src/terralib/kernel/TeCoord2D.h
+++ b/src/terralib/kernel/TeCoord2D.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeCoord2D.h
\brief This file contains the definition of a classes to handle 2D coordinates
*/
diff --git a/src/terralib/kernel/TeCounted.h b/src/terralib/kernel/TeCounted.h
index cbc501d..cd13717 100644
--- a/src/terralib/kernel/TeCounted.h
+++ b/src/terralib/kernel/TeCounted.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeCounted.h
\brief This file contains classes to support the counted object idiom
*/
diff --git a/src/terralib/kernel/TeDBConnection.cpp b/src/terralib/kernel/TeDBConnection.cpp
deleted file mode 100644
index 94c03e5..0000000
--- a/src/terralib/kernel/TeDBConnection.cpp
+++ /dev/null
@@ -1,619 +0,0 @@
-
-#include <sstream>
-#include "TeDBConnection.h"
-#include "TeDatabase.h"
-#include "TeDatabaseFactory.h"
-#include "TeDBConnectionsPool.h"
-
-
-TeDBConnection::TeDBConnection(const bool& isShared) :
- id_(-1), driverInUse_(false), isShared_(isShared), db_(0), dbmsName_(""),
- host_(""), databaseName_(""), user_(""), password_(""), portNumber_(-1)
-{ }
-
-TeDBConnection::TeDBConnection(const std::string& hostName, const std::string& databaseName,
- const std::string& userName, const std::string& dbmsName, const int& port,
- const std::string& userPasswd, const int& conId, TeDatabase* db, const bool& isShared) :
- id_(conId), driverInUse_(false), isShared_(isShared), db_(db), dbmsName_(dbmsName),
- host_(hostName), databaseName_(databaseName), user_(userName), password_(userPasswd),
- portNumber_(port)
-{
-}
-
-TeDBConnection::TeDBConnection(const int& conId, TeDatabase* db, const bool& isShared) :
- id_(conId), driverInUse_(false), isShared_(isShared), db_(db), dbmsName_(""),
- host_(""), databaseName_(""), user_(""), password_(""), portNumber_(-1)
-{
- if(db)
- {
- string dbKey = db->getDatabaseDescription();
- fillDBConnectionInfo(dbKey);
- }
-}
-
-TeDBConnection::TeDBConnection(const std::string& dbKey, const bool& isShared) :
- id_(-1), driverInUse_(false), isShared_(isShared), db_(0), dbmsName_(""),
- host_(""), databaseName_(""), user_(""), password_(""), portNumber_(-1)
-{
- fillDBConnectionInfo(dbKey);
-}
-
-TeDBConnection::TeDBConnection(const TeDBConnection& other)
-{
- id_ = other.id_;
- driverInUse_ = other.driverInUse_;
- isShared_ = other.isShared_;
- dbmsName_ = other.dbmsName_;
- host_ = other.host_;
- databaseName_ = other.databaseName_;
- user_ = other.user_;
- password_ = other.password_;
- portNumber_ = other.portNumber_;
- db_=0;
- if(other.db_)
- {
- db_ = TeDatabaseFactory::make(other.asDatabaseFactoryParams());
- *db_ = *other.db_;
- }
-}
-
-TeDBConnection&
-TeDBConnection::operator=(const TeDBConnection& other)
-{
- if(this != &other)
- {
- id_ = other.id_;
- driverInUse_ = other.driverInUse_;
- isShared_ = other.isShared_;
- dbmsName_ = other.dbmsName_;
- host_ = other.host_;
- databaseName_ = other.databaseName_;
- user_ = other.user_;
- password_ = other.password_;
- portNumber_ = other.portNumber_;
- if(db_)
- {
- db_->close();
- delete db_;
- db_=0;
- }
- if(other.db_)
- {
- db_ = TeDatabaseFactory::make(other.asDatabaseFactoryParams());
- *db_ = *other.db_;
- }
- }
- return *this;
-}
-
-
-TeDBConnection::~TeDBConnection()
-{
- if (db_)
- {
- db_->close();
- delete db_;
- }
- db_ = 0;
-}
-
-bool
-TeDBConnection::operator==(const TeDBConnection& other)
-{
- return ((id_==other.id_) &&
- (dbmsName_ == other.dbmsName_) &&
- (host_==other.host_) && (portNumber_==other.portNumber_) &&
- (databaseName_==other.databaseName_) &&
- (user_ == other.user_) && (password_== other.password_));
-}
-
-void
-TeDBConnection::clear()
-{
- id_ = -1;
- driverInUse_ = false;
- isShared_ = true;
- if(db_)
- {
- db_->close();
- delete db_;
- }
- db_ = 0;
- dbmsName_ = "";
- host_ = "";
- portNumber_ = -1;
- databaseName_= "";
- user_= "";
- password_= "";
-}
-
-void
-TeDBConnection::setId(const int& id)
-{
- id_ = id;
-}
-
-int
-TeDBConnection::getId()
-{
- return id_;
-}
-
-bool TeDBConnection::isInUse()
-{
- return driverInUse_;
-}
-
-void TeDBConnection::setInUse(const bool& inUse)
-{
- driverInUse_ = inUse;
-}
-
-bool TeDBConnection::isShared()
-{
- return isShared_;
-}
-
-void TeDBConnection::setShared(const bool& isShared)
-{
- isShared_ = isShared;
-}
-
-TeDatabase* TeDBConnection::getDatabase()
-{
- return db_;
-}
-
-void TeDBConnection::setDatabase(TeDatabase* db)
-{
- db_ = db;
-}
-
-std::string TeDBConnection::getDbmsName()
-{
- return dbmsName_;
-}
-
-void TeDBConnection::setDbmsName(const std::string& dbmsName)
-{
- dbmsName_ = dbmsName;
-}
-
-std::string TeDBConnection::getHost()
-{
- return host_;
-}
-
-void TeDBConnection::setHost(const std::string& host)
-{
- host_ = host;
-}
-
-std::string TeDBConnection::getDatabaseName()
-{
- return databaseName_;
-}
-
-void TeDBConnection::setDatabaseName(const std::string& databaseName)
-{
- databaseName_ = databaseName;
-}
-
-std::string TeDBConnection::getUser()
-{
- return user_;
-}
-
-void TeDBConnection::setUser(const std::string& user)
-{
- user_ = user;
-}
-
-std::string TeDBConnection::getPassword()
-{
- return password_;
-}
-
-void TeDBConnection::setPassword(const std::string& password)
-{
- password_ = password;
-}
-
-int TeDBConnection::getPortNumber()
-{
- return portNumber_;
-}
-
-void TeDBConnection::setPortNumber(const int& port)
-{
- portNumber_ = port;
-}
-
-std::string TeDBConnection::getDbKey()
-{
- std::string dbKey = "";
-
- dbKey += dbmsName_;
- dbKey += ";";
- dbKey += host_;
- dbKey += ";";
- dbKey += Te2String(portNumber_);
- dbKey += ";";
- dbKey += databaseName_;
- dbKey += ";";
- dbKey += user_;
- dbKey += ";";
- dbKey += password_;
- return dbKey;
-}
-
-void TeDBConnection::fillDBConnectionInfo(const std::string& dbKey)
-{
- int NUM_PARAMS = 6;
-
- if (dbKey.empty())
- return;
-
- // Checking for valid key.
- size_t start = 0;
- vector<int> indexs;
- while (true)
- {
- start = dbKey.find_first_of(";", start);
- if (start == string::npos)
- break;
-
- indexs.push_back(start);
- start++;
- }
-
- if ((int)indexs.size() != (NUM_PARAMS - 1))
- return;
-
- string dbms_name = "";
- if (indexs[0] > 0)
- dbms_name = dbKey.substr(0, indexs[0]);
-
- string host = "";
- if ((indexs[1] - indexs[0]) > 1)
- host = dbKey.substr(indexs[0] + 1, (indexs[1] - indexs[0]) - 1);
-
- int port_number = -1;
- if ((indexs[2] - indexs[1]) > 1)
- {
- string v;
- v = dbKey.substr(indexs[1] + 1, (indexs[2] - indexs[1]) - 1);
- port_number = atoi((char*)v.c_str());
- }
-
- string database_name = "";
- if ((indexs[3] - indexs[2]) > 1)
- database_name = dbKey.substr(indexs[2] + 1, (indexs[3] - indexs[2]) - 1);
-
- string user = "";
- if ((indexs[4] - indexs[3]) > 1)
- user = dbKey.substr(indexs[3] + 1, (indexs[4] - indexs[3]) - 1);
-
- string password = "";
- if ((dbKey.size() - indexs[4]) > 1)
- password = dbKey.substr(indexs[4] + 1, (dbKey.size() - indexs[4]) - 1);
-
- this->setDbmsName(dbms_name);
- this->setHost(host);
- this->setPortNumber(port_number);
- this->setDatabaseName(database_name);
- this->setUser(user);
- this->setPassword(password);
-
- return;
-}
-
-void TeDBConnection::lock()
-{
- driverInUse_ = true;
-}
-
-bool TeDBConnection::connect()
-{
- if (!db_)
- {
- if ( !createDatabaseConnection() )
- {
- return false;
- }
- }
-
- if(db_->isConnected())
- db_->close();
-
- return db_->connect(host_, user_, password_, databaseName_, portNumber_);
-}
-
-bool TeDBConnection::createDatabaseModel()
-{
- if (!db_)
- return false;
- if (!db_->newDatabase(databaseName_, user_, password_, host_))
- return false;
- return true;
-}
-
-TeDatabaseFactoryParams
-TeDBConnection::asDatabaseFactoryParams() const
-{
- TeDatabaseFactoryParams params;
- params.host_ = host_;
- params.port_ = portNumber_;
- params.password_ = password_;
- params.user_ = user_;
- params.database_ = databaseName_;
- params.dbms_name_ = dbmsName_;
-
- return params;
-}
-
-bool TeDBConnection::load(TeDatabase* sourceDB, const int& dbId, TeDBConnection& dbCon)
-{
- dbCon.clear();
-
- if(!sourceDB)
- return false;
-
- std::string strSQL = "SELECT * FROM te_database_connection WHERE connection_id = " + Te2String(dbId);
-
- TeDatabasePortal* dbPortal = sourceDB->getPortal();
-
- if(!dbPortal)
- return false;
-
- if(!dbPortal->query(strSQL) || !dbPortal->fetchRow())
- {
- dbPortal->freeResult();
- delete dbPortal;
- return false;
- }
-
- dbCon.setId(dbPortal->getInt("connection_id"));
- dbCon.setDbmsName(dbPortal->getData("dbms_name"));
- dbCon.setHost(dbPortal->getData("host_name"));
- dbCon.setDatabaseName(dbPortal->getData("database_name"));
- dbCon.setUser(dbPortal->getData("user_name"));
- dbCon.setPassword(dbPortal->getData("user_password"));
- dbCon.setPortNumber(dbPortal->getInt("port_number"));
-
- dbPortal->freeResult();
- delete dbPortal;
- return true;
-}
-
-bool TeDBConnection::load(TeDatabase* sourceDB)
-{
- if(!sourceDB)
- return false;
-
- std::string strSQL="SELECT * FROM te_database_connection";
-
- TeDatabasePortal* dbPortal = sourceDB->getPortal();
-
- if(!dbPortal)
- return false;
-
- if(!dbPortal->query(strSQL))
- {
- dbPortal->freeResult();
- delete dbPortal;
- return false;
- }
-
- while(dbPortal->fetchRow())
- {
- TeDBConnection dbConn;
- dbConn.setId(dbPortal->getInt("connection_id"));
- dbConn.setDbmsName(dbPortal->getData("dbms_name"));
- dbConn.setHost(dbPortal->getData("host_name"));
- dbConn.setDatabaseName(dbPortal->getData("database_name"));
- dbConn.setUser(dbPortal->getData("user_name"));
- dbConn.setPassword(dbPortal->getData("user_password"));
- dbConn.setPortNumber(dbPortal->getInt("port_number"));
- dbConn.setDatabase(0);
-
- TeDBConnectionsPool::instance().insertDBConnection(dbConn);
- }
-
- dbPortal->freeResult();
- delete dbPortal;
- return true;
-}
-
-bool TeDBConnection::save(TeDatabase* sourceDB, TeDBConnection& dbConn)
-{
- std::string searchSQL = "SELECT * FROM te_database_connection WHERE connection_id = ";
- searchSQL += Te2String(dbConn.getId());
-
- TeDatabasePortal* portal = sourceDB->getPortal();
-
- if(!portal)
- return false;
-
- if(!portal->query(searchSQL))
- {
- portal->freeResult();
- delete portal;
- return false;
- }
-
- bool isInsert = !portal->fetchRow();
- portal->freeResult();
- delete portal;
-
- std::string strSQL = "";
-
- if(isInsert)
- {
- // insert
- strSQL = "INSERT INTO te_database_connection(dbms_name, host_name, database_name, user_name, user_password, port_number) ";
- strSQL += "VALUES ('" + dbConn.getDbmsName();
- strSQL += "', '" + dbConn.getHost();
- strSQL += "', '" + dbConn.getDatabaseName();
- strSQL += "', '" + dbConn.getUser();
- strSQL += "', '" + dbConn.getPassword();
- strSQL += "', " + Te2String(dbConn.getPortNumber());
- strSQL += ")";
- }
- else
- {
- // update
- strSQL = "UPDATE te_database_connection SET dbms_name='" + dbConn.getDbmsName();
- strSQL += "', host_name='" + dbConn.getHost();
- strSQL += "', database_name='" + dbConn.getDatabaseName();
- strSQL += "', user_name='" + dbConn.getUser();
- strSQL += "', user_password='" + dbConn.getPassword();
- strSQL += "', port_number=" + Te2String(dbConn.getPortNumber());
- strSQL += " WHERE connection_id = " + Te2String(dbConn.getId());
- }
-
- if(!sourceDB->execute(strSQL))
- return false;
-
- if(isInsert)
- return updateId(sourceDB, dbConn);
-
- return true;
-}
-
-bool TeDBConnection::remove(TeDatabase* sourceDB, TeDBConnection& dbConn)
-{
- std::string deleteSQL = " DELETE FROM te_database_connection WHERE connection_id = ";
- deleteSQL += Te2String(dbConn.getId());
-
- if(!sourceDB->execute(deleteSQL))
- return false;
-
- TeDBConnectionsPool::instance().removeDBConnection(dbConn);
-
- return true;
-}
-
-int TeDBConnection::createDBConnectionTable(TeDatabase* sourceDB)
-{
- if(!sourceDB)
- return 0;
-
- if(sourceDB->tableExist("te_database_connection"))
- return -1;
-
- TeAttributeList attList;
-
- TeAttribute att1;
- att1.rep_.name_ = "connection_id";
- att1.rep_.isAutoNumber_ = true;
- att1.rep_.isPrimaryKey_ = true;
- att1.rep_.null_ = false;
- att1.rep_.type_ = TeINT;
- att1.rep_.numChar_ = 0;
- attList.push_back(att1);
-
- TeAttribute att2;
- att2.rep_.name_ = "dbms_name";
- att2.rep_.isAutoNumber_ = false;
- att2.rep_.isPrimaryKey_ = false;
- att2.rep_.null_ = true;
- att2.rep_.type_ = TeSTRING;
- att2.rep_.numChar_ = 255;
- attList.push_back(att2);
-
- TeAttribute att3;
- att3.rep_.name_ = "host_name";
- att3.rep_.isAutoNumber_ = false;
- att3.rep_.isPrimaryKey_ = false;
- att3.rep_.null_ = true;
- att3.rep_.type_ = TeSTRING;
- att3.rep_.numChar_ = 255;
- attList.push_back(att3);
-
- TeAttribute att4;
- att4.rep_.name_ = "database_name";
- att4.rep_.isAutoNumber_ = false;
- att4.rep_.isPrimaryKey_ = false;
- att4.rep_.null_ = true;
- att4.rep_.type_ = TeSTRING;
- att4.rep_.numChar_ = 255;
- attList.push_back(att4);
-
- TeAttribute att5;
- att5.rep_.name_ = "user_name";
- att5.rep_.isAutoNumber_ = false;
- att5.rep_.isPrimaryKey_ = false;
- att5.rep_.null_ = true;
- att5.rep_.type_ = TeSTRING;
- att5.rep_.numChar_ = 255;
- attList.push_back(att5);
-
- TeAttribute att6;
- att6.rep_.name_ = "user_password";
- att6.rep_.isAutoNumber_ = false;
- att6.rep_.isPrimaryKey_ = false;
- att6.rep_.null_ = true;
- att6.rep_.type_ = TeSTRING;
- att6.rep_.numChar_ = 255;
- attList.push_back(att6);
-
- TeAttribute att7;
- att7.rep_.name_ = "port_number";
- att7.rep_.isAutoNumber_ = false;
- att7.rep_.isPrimaryKey_ = false;
- att7.rep_.null_ = true;
- att7.rep_.type_ = TeINT;
- att7.rep_.numChar_ = 0;
- attList.push_back(att7);
-
- if(!sourceDB->createTable("te_database_connection", attList))
- return 0;
-
- return 1;
-}
-
-bool TeDBConnection::createDatabaseConnection()
-{
- if(db_)
- {
- db_->close();
- delete db_;
- db_=0;
- }
- db_ = TeDatabaseFactory::make(this->asDatabaseFactoryParams());
- if(!db_)
- return false;
- return true;
-}
-
-bool TeDBConnection::updateId(TeDatabase* sourceDB, TeDBConnection& dbConn)
-{
- std::string searchSQL = "SELECT * FROM te_database_connection WHERE ";
- searchSQL += "dbms_name = '" + dbConn.getDbmsName();
- searchSQL += "' AND host_name = '" + dbConn.getHost();
- searchSQL += "' AND database_name = '" + dbConn.getDatabaseName();
- searchSQL += "' AND user_name = '" + dbConn.getUser();
- searchSQL += "' AND user_password = '" + dbConn.getPassword();
- searchSQL += "' AND port_number = " + Te2String(dbConn.getPortNumber());
-
- TeDatabasePortal* portal = sourceDB->getPortal();
-
- if(!portal)
- return false;
-
- bool status = false;
-
- if(portal->query(searchSQL) && portal->fetchRow())
- {
- dbConn.setId(portal->getInt("connection_id"));
-
- status = true;
- }
-
- portal->freeResult();
- delete portal;
- return status;
-}
-
-
diff --git a/src/terralib/kernel/TeDBConnection.h b/src/terralib/kernel/TeDBConnection.h
deleted file mode 100644
index 9204e43..0000000
--- a/src/terralib/kernel/TeDBConnection.h
+++ /dev/null
@@ -1,207 +0,0 @@
-
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDBConnection.h
- \brief This file contains the class TeDBConnection that defines a database
- connection.
-*/
-
-#ifndef __TERRALIB_INTERNAL_DBCONNECTION_H
-#define __TERRALIB_INTERNAL_DBCONNECTION_H
-
-#include "TeDatabaseFactoryParams.h"
-#include <string>
-
-class TeDatabase;
-
-///! A class to represent a database connection.
-/*!
- This class defines a database connection.
-
- \sa
- TeDatabase
-*/
-class TL_DLL TeDBConnection
-{
-
-protected:
-
- //! A number to identify a database connection
- int id_;
-
- //! Flag to indicate if this connection is in use or not
- bool driverInUse_;
-
- //! Flag to indicate if this connection can be shared by more than one user
- bool isShared_;
-
- //! A Database pointer
- TeDatabase* db_;
-
- //! The name of the DMBS
- std::string dbmsName_;
-
- //! The host name
- std::string host_;
-
- //! The database name
- std::string databaseName_;
-
- //! The user name
- std::string user_;
-
- //! The user passwor
- std::string password_;
-
- //! The user password
- int portNumber_;
-
-public:
-
- //! Empty constructor
- TeDBConnection(const bool& isShared=true);
-
- //! Constructor
- TeDBConnection(const std::string& hostName, const std::string& databaseName,
- const std::string& userName, const std::string& dbmsName, const int& portNumber = -1,
- const std::string& userPasswd = "", const int& conId = -1, TeDatabase* db = 0, const bool& isShared=true);
-
- //! Constructor
- TeDBConnection(const int& conId, TeDatabase* db = 0, const bool& isShared=true);
-
- //! Constructor
- TeDBConnection(const std::string& dbKey, const bool& isShared=true);
-
- //! Copy constructor
- TeDBConnection(const TeDBConnection& other);
-
- //! Operator =
- TeDBConnection& operator=(const TeDBConnection& other);
-
- //! Destructor
- virtual ~TeDBConnection();
-
- //! Equal operator
- bool operator==(const TeDBConnection& other);
-
- //! Clear
- void clear();
-
- //! Set the connection identity
- virtual void setId(const int& id);
- //! Get the connection identity
- virtual int getId();
-
- //! Verify if this connection is in use
- virtual bool isInUse();
- //! Set if this connection is in use or not
- virtual void setInUse(const bool& inUse);
-
- //! Verify if this connection is shared
- virtual bool isShared();
- //! Set if this connection is shared or not
- virtual void setShared(const bool& isShared);
-
- //! Get the database pointer
- virtual TeDatabase* getDatabase();
- //! Set the database pointer
- virtual void setDatabase(TeDatabase* db);
-
- //! Returns the name of the DBMS
- virtual std::string getDbmsName();
- //! Sets the name of the DBMS
- virtual void setDbmsName(const std::string& dbmsName);
-
- //! Returns the host name
- virtual std::string getHost();
- virtual void setHost(const std::string& host);
-
- //! Returns the database name.
- virtual std::string getDatabaseName();
- //! Sets the database name.
- virtual void setDatabaseName(const std::string& databaseName);
-
- //! Returns user name
- virtual std::string getUser();
- //! Sets the user name
- virtual void setUser(const std::string& user);
-
- //! Returns the user password
- virtual std::string getPassword();
- //! Sets the user password
- virtual void setPassword(const std::string& password);
-
- //! Returns the port number
- virtual int getPortNumber();
- //! Sets the port number
- virtual void setPortNumber(const int& port);
-
- //! Returns the database key (with user password)
- virtual std::string getDbKey();
-
- //! Fills the connection parameters (dbms name, database name, host, port number, user and password) based on the database key given
- virtual void fillDBConnectionInfo(const std::string& dbKey);
-
- //! Lock this connection setting it as in use
- virtual void lock();
-
- //! Opens a database connection based on the connection parameters
- virtual bool connect();
-
- //! Creates a new database and the terralib data model
- virtual bool createDatabaseModel();
-
- //! Return the connection parameters
- virtual TeDatabaseFactoryParams asDatabaseFactoryParams() const;
-
- //! Loads a specific database connection from a database
- static bool load(TeDatabase* sourceDB, const int& dbId, TeDBConnection& dbConn);
-
- //! Loads all database connections from database and put them in the database connection pool.
- static bool load(TeDatabase* sourceDB);
-
- //! Save a database connection in the database
- static bool save(TeDatabase* sourceDB, TeDBConnection& dbConn);
-
- //! Remove a database connection in the database
- static bool remove(TeDatabase* sourceDB, TeDBConnection& dbConn);
-
- /** \brief Creates the table where we store a list of connections to other databases.
- \param sourceDB A connection to a TerraLib database that stores information about others databases that can be used for example by remote themes. (Input)
- \return Returns 1 if the table was created, -1 if it already exists and 0 on error.
- */
- static int createDBConnectionTable(TeDatabase* sourceDB);
-
- //! Updates the database connection identity from database
- static bool updateId(TeDatabase* sourceDB, TeDBConnection& dbConn);
-
-private:
- //! Creates a new opened database connection based on the connection parameters
- virtual bool createDatabaseConnection();
-
-};
-
-
-#endif
-
-
diff --git a/src/terralib/kernel/TeDBConnectionsPool.cpp b/src/terralib/kernel/TeDBConnectionsPool.cpp
deleted file mode 100644
index 377c078..0000000
--- a/src/terralib/kernel/TeDBConnectionsPool.cpp
+++ /dev/null
@@ -1,403 +0,0 @@
-
-#include "TeDBConnectionsPool.h"
-#include "TeDBConnection.h"
-
-#include <vector>
-#include <map>
-
-
-TeDBConnectionsPool::TeDBConnectionsPool()
-{ }
-
-TeDBConnectionsPool::~TeDBConnectionsPool()
-{
- clearAllDBConnections();
-}
-
-TeDatabase*
-TeDBConnectionsPool::getDatabase(const std::string& hostName, const std::string& databaseName,
- const std::string& userName, const std::string& dbmsName, const int& portNumber, const std::string& userPasswd)
-{
- TeDatabase* db = 0;
- TeDBConnection* dr = 0;
-
- TeDBConnection conn(hostName, databaseName, userName, dbmsName, portNumber, userPasswd);
- std::string dbKey = conn.getDbKey();
-
- //Look for a valid connection
- dr = findDBConnection(dbKey);
- if(dr)
- {
- dr->setInUse(true);
- return dr->getDatabase();
- }
-
- //Creates a new connection and put it in the pool
- dr = createDBConnection(conn);
- if(dr)
- {
- dr->setInUse(true);
- return dr->getDatabase();
- }
-
- return db;
-}
-
-TeDatabase*
-TeDBConnectionsPool::getDatabase(const int& dbDriverIndx)
-{
- TeDatabase* db = 0;
- TeDBConnection* dr = 0;
-
- //Look for a valid connection
- dr = findDBConnection(dbDriverIndx);
- if(dr)
- {
- dr->setInUse(true);
- return dr->getDatabase();
- }
- return db;
-}
-
-TeDatabase*
-TeDBConnectionsPool::getDatabase(const std::string& dbDescriptorKey)
-{
- TeDatabase* db = 0;
- TeDBConnection* dr = 0;
-
- //Look for a valid connection
- dr = findDBConnection(dbDescriptorKey);
- if(dr)
- {
- dr->setInUse(true);
- return dr->getDatabase();
- }
-
- //Creates a new connection and put it in the pool
- TeDBConnection dbCon;
- dbCon.fillDBConnectionInfo(dbDescriptorKey);
- dr = createDBConnection(dbCon);
- if(dr)
- {
- dr->setInUse(true);
- return dr->getDatabase();
- }
- return db;
-}
-bool TeDBConnectionsPool::releaseDatabase(TeDatabase* db)
-{
- if (!db)
- return false;
-
- std::string dbKey = db->getDatabaseDescription();
-
- std::map< std::string, int, std::less<std::string> >::iterator itKey = dbIndxs_.find(dbKey);
- if(itKey == dbIndxs_.end())
- return false;
-
- //Look for this database in the database connection vector
- std::map<int, TeDBConnectionsVector, std::less<int> >::iterator itAux = dbs_.find(itKey->second);
- if(itAux==dbs_.end())
- return false;
-
- TeDBConnectionsVector::iterator it;
- for (it = itAux->second.begin(); it != itAux->second.end(); ++it)
- {
- TeDatabase* aux_db = it->getDatabase();
- if (aux_db == db)
- {
- it->setInUse(false);
- return true;
- }
- }
- return false;
-}
-
-void TeDBConnectionsPool::releaseAllDatabases()
-{
- std::map<int, TeDBConnectionsVector, std::less<int> >::iterator it = dbs_.begin();
- while(it!=dbs_.end())
- {
- TeDBConnectionsVector::iterator itCon = it->second.begin();
- while(itCon!=it->second.end())
- {
- itCon->setInUse(false);
- ++itCon;
- }
- ++it;
- }
- return;
-}
-
-bool TeDBConnectionsPool::insertDBConnection(TeDBConnection& dr)
-{
- int indx=0;
- //creates the database key based on the connection parameters
- std::string dbKey = dr.getDbKey();
-
- std::map< std::string, int, std::less<std::string> >::iterator itKey = dbIndxs_.find(dbKey);
- if(itKey == dbIndxs_.end())
- {
- //creates a new entity in the both maps
- indx = dr.getId();
- if(indx<0)
- {
- //look for a valid database connection id
- indx = createsValidConId();
- dr.setId(indx);
- }
-
- TeDBConnectionsVector vec;
- vec.push_back(dr);
- dbs_.insert(std::pair<int, TeDBConnectionsVector>(indx, vec));
- dbIndxs_.insert(std::pair<std::string, int>(dbKey, indx));
- return true;
- }
-
- indx = itKey->second;
- std::map<int, TeDBConnectionsVector, std::less<int> >::iterator it = dbs_.find(indx);
- if(it == dbs_.end())
- return false;
-
- //This implementation supports only one connection by database descriptor
- //because of the maps in the TeDatabase (layerMap, ThemeMap, etc...)
- clearDBConnectionVector(it->second);
- it->second.push_back(dr);
- return true;
-}
-
-bool TeDBConnectionsPool::removeDBConnection(TeDBConnection& dr)
-{
- //creates the database key based on the connection parameters
- std::string dbKey = dr.getDbKey();
-
- std::map< std::string, int, std::less<std::string> >::iterator itKey = dbIndxs_.find(dbKey);
- if(itKey==dbIndxs_.end())
- return false;
-
- std::map<int, TeDBConnectionsVector, std::less<int> >::iterator it = dbs_.find(itKey->second);
- if(it==dbs_.end())
- return false;
-
- TeDBConnectionsVector::iterator itVec = it->second.begin();
- while(itVec!=it->second.end())
- {
- if((*itVec) == dr)
- {
- it->second.erase(itVec);
- continue;
- }
- ++itVec;
- }
-
- if(it->second.size()>0)
- return true;
-
- dbs_.erase(it);
- dbIndxs_.erase(itKey);
- return true;
-}
-
-int
-TeDBConnectionsPool::getDBConnectionIndx(TeDBConnection& dbCon)
-{
- string dbKey = dbCon.getDbKey();
- int status = this->getDBConnectionIndx(dbKey);
- return status;
-}
-
-int
-TeDBConnectionsPool::getDBConnectionIndx(const std::string& dbDescriptorKey)
-{
- std::map< std::string, int, std::less<std::string> >::iterator itKey = dbIndxs_.find(dbDescriptorKey);
- if (itKey != dbIndxs_.end())
- return itKey->second;
- return -1;
-}
-
-std::string
-TeDBConnectionsPool::getDBConnectionKey(const int& dbConnectionIndx)
-{
- std::map< std::string, int, std::less<std::string> >::iterator itKey = dbIndxs_.begin();
- while(itKey!=dbIndxs_.end())
- {
- if(itKey->second == dbConnectionIndx)
- return itKey->first;
- ++itKey;
- }
- return "";
-}
-
-void TeDBConnectionsPool::clearAllDBConnections()
-{
- //clean the the drivers pool
- std::map<int, TeDBConnectionsVector, std::less<int> >::iterator it = dbs_.begin();
- while(it!=dbs_.end())
- {
- clearDBConnectionVector(it->second);
- ++it;
- }
-
- dbs_.clear();
- dbIndxs_.clear();
-}
-
-void TeDBConnectionsPool::closeDBConnection(TeDatabase* db)
-{
- if(!db)
- return;
- releaseDatabase(db);
- db->close();
-}
-
-void TeDBConnectionsPool::closeDBConnection(std::string& dbDescriptorKey)
-{
- TeDBConnection* dr = findDBConnection(dbDescriptorKey);
- if (!dr)
- return;
-
- dr->setInUse(false);
- TeDatabase* db = dr->getDatabase();
- if (db)
- db->close();
-}
-
-//protected
-
-bool TeDBConnectionsPool::isDBConnectionInPool(TeDatabase* db)
-{
- if(!db)
- return false;
-
- std::string dbKey = db->getDatabaseDescription();
-
- std::map< std::string, int, std::less<std::string> >::iterator itKey = dbIndxs_.find(dbKey);
- if(itKey == dbIndxs_.end())
- return false;
-
- //Look for this database in the database connection vector
- std::map<int, TeDBConnectionsVector, std::less<int> >::iterator itAux = dbs_.find(itKey->second);
- if(itAux==dbs_.end())
- return false;
-
- TeDBConnectionsVector::iterator it;
- for (it = itAux->second.begin(); it != itAux->second.end(); ++it)
- {
- TeDatabase* aux_db = it->getDatabase();
- if (aux_db == db)
- return true;
- }
- return false;
-}
-
-TeDBConnection*
-TeDBConnectionsPool::findDBConnection(const int& dbDriverIndx)
-{
- TeDBConnection* dr = 0;
- std::map<int, TeDBConnectionsVector, std::less<int> >::iterator it = dbs_.find(dbDriverIndx);
- if(it==dbs_.end())
- return dr; // There are no database connection to this index
-
- //Find one databases connection
- TeDBConnectionsVector::iterator it2;
- for (it2 = it->second.begin(); it2 != it->second.end(); ++it2)
- {
- //Verify if this connection is in use. If it is, continue to look for another connection.
- if (it2->isInUse() && !it2->isShared())
- continue;
-
- TeDatabase* db = it2->getDatabase();
- if((!db) || (!db->isConnected()))
- {
- it2->connect(); //Open this db connection based on its descriptor
- db = it2->getDatabase();
- }
-
- if (db->isConnected())
- return &(*it2);
- }
- return dr;
-}
-
-TeDBConnection*
-TeDBConnectionsPool::findDBConnection(const std::string& dbkey)
-{
- TeDBConnection* db = 0;
- std::map< std::string, int, std::less<std::string> >::iterator itKey = dbIndxs_.find(dbkey);
- if (itKey != dbIndxs_.end())
- return findDBConnection(itKey->second);
- return db;
-}
-
-void TeDBConnectionsPool::clearDBConnectionVector(TeDBConnectionsVector& connections)
-{
- //the clear method calls the destructor of all TeDBConnection
- connections.clear();
-}
-
-TeDBConnection*
-TeDBConnectionsPool::createDBConnection(const std::string& hostName, const std::string& databaseName,
- const std::string& userName, const std::string& dbmsName, const int& portNumber, const std::string& userPasswd)
-{
- TeDBConnection dbCon(hostName, databaseName, userName, dbmsName, portNumber, userPasswd);
- return createDBConnection(dbCon);
-}
-
-TeDBConnection*
-TeDBConnectionsPool::createDBConnection(TeDBConnection& dbCon)
-{
- TeDBConnection* con = 0;
- if(dbCon.getId()<0)
- {
- int indx = createsValidConId();
- dbCon.setId(indx);
- }
-
- if(!dbCon.connect()) //create a new opened database connection
- return con;
-
- //Insert this new connection in the maps
- if(!insertDBConnection(dbCon))
- return con;
-
- std::map<int, TeDBConnectionsVector, std::less<int> >::iterator it = dbs_.find(dbCon.getId());
- if(it==dbs_.end())
- return con;
-
- TeDBConnectionsVector::iterator itVec = it->second.begin();
- if(itVec == it->second.end())
- return con;
- return &(*itVec);
-}
-
-int
-TeDBConnectionsPool::createsValidConId()
-{
- int indx = dbIndxs_.size();
- bool isNotValid = true;
- //verify if this number already exists
- while(isNotValid)
- {
- std::map<int, TeDBConnectionsVector, std::less<int> >::iterator it = dbs_.find(indx);
- if(it==dbs_.end())
- isNotValid = false;
- else
- ++indx;
- }
- return indx;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/terralib/kernel/TeDBConnectionsPool.h b/src/terralib/kernel/TeDBConnectionsPool.h
deleted file mode 100644
index fbe4db5..0000000
--- a/src/terralib/kernel/TeDBConnectionsPool.h
+++ /dev/null
@@ -1,210 +0,0 @@
-
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDBConnectionsPool.h
- \brief This file contains the class TeDBConnectionsPool that defines
- a pool of database connections.
-*/
-
-#ifndef __TERRALIB_INTERNAL_DBCONNECTIONPOOL_H
-#define __TERRALIB_INTERNAL_DBCONNECTIONPOOL_H
-
-#include "TeSingleton.h"
-#include "TeDBConnection.h"
-#include "TeDatabase.h"
-
-#include <vector>
-#include <map>
-#include <string>
-
-//! A database connections vector.
-typedef std::vector<TeDBConnection> TeDBConnectionsVector;
-
-
-///! A class that implements a manager for a database connections pool.
-/*!
- \sa
- TeDatabase, TeDBConnection
-*/
-class TL_DLL TeDBConnectionsPool : public TeSingleton<TeDBConnectionsPool>
-{
-public:
-
- //! Constructor.
- TeDBConnectionsPool();
-
- //! Destructor.
- virtual ~TeDBConnectionsPool();
-
- //! Returns an available connection in the pool for the given connection parameters.
- /*!
- Searches one available connection in the pool. If there is, returns this
- pointer otherwise creates a new connection based on the given descriptor,
- connects it, sets it "in use" and inserts it in the pool, then returns the new connection.
- \param desc The database descriptor.
- \return If success returns a connection otherwise returns NULL.
- */
- TeDatabase* getDatabase(const std::string& hostName, const std::string& databaseName,
- const std::string& userName, const std::string& dbmsName, const int& portNumber = 0,
- const std::string& userPasswd = "");
-
- //! Returns one available connection in the pool for a given connection index.
- /*!
- Searches one available connection in the pool based on the given index.
- \param desc The database descriptor.
- \return If success returns a connection otherwise returns NULL.
- */
- TeDatabase* getDatabase(const int& dbConnectionIndx);
-
- //! Returns one available connection in the pool for a given database connection key.
- /*!
- Searches one available connection in the pool. If there is, returns this
- pointer otherwise creates a new connection based on the given descriptor key,
- connects it, sets it "in use" and inserts it in the pool, then returns the new connection.
- \param database descriptor key.
- \return If success returns a connection otherwise returns NULL.
- */
- TeDatabase* getDatabase(const std::string& dbKey);
-
- //! Releases the given database connection.
- /*!
- Checks if the database connection is in the pool, then set
- the connection as "available".
- \param db A pointer to a database connection.
- */
- bool releaseDatabase(TeDatabase* db);
-
- //! Releases all connection in the pool.
- /*!
- Sets all connections in the pool as "available".
- */
- void releaseAllDatabases();
-
- //! Inserts a database connection in the pool.
- /*!
- Inserts a database connection in the pool. If the database connection identity
- is equal to -1, this method creates a new identity.
- \param db the database connection.
- */
- bool insertDBConnection(TeDBConnection& dr);
-
- //! Removes the database connection of the pool.
- /*!
- Removes a database connection of the pool.
- \param db the database connection.
- */
- bool removeDBConnection(TeDBConnection& dr);
-
- //! Returns the connection index for the given connection parameters.
- /*!
- If success returns the found connection index otherwise returns -1.
- \param desc The connection descriptor.
- \return If success returns a connection index otherwise returns -1.
- */
- int getDBConnectionIndx(TeDBConnection& dbCon);
-
- //! Returns the connection index for a given connection key.
- /*!
- If success returns the found connection index otherwise returns -1.
- \param dbKey The database key.
- \return If success returns a connection index otherwise returns -1.
- */
- int getDBConnectionIndx(const std::string& dbKey);
-
- //! Returns the connection key for a given connection index.
- /*!
- If success returns the found connection key otherwise returns an empty string.
- \param dbConnectionIndx The connection index.
- \return If success returns a connection key returns an empty string.
- */
- std::string getDBConnectionKey(const int& dbConnectionIndx);
-
- //! Closes all connections and clears the pool.
- /*!
- Closes each database connection in the vectors and clear the maps.
- */
- void clearAllDBConnections();
-
- //! Sets the database connection as not available and close it.
- /*!
- Checks if the database connection is in the pool,
- then set it as not available and close it.
- \param db A pointer to a database connection.
- */
- void closeDBConnection(TeDatabase* db);
- void closeDBConnection(std::string& dbDescriptorKey);
-
- //! Returns how many connections exist in the pool
- unsigned int size() { return dbIndxs_.size(); }
-
- //! Returns a reference to the connection container
- std::map<int, TeDBConnectionsVector>& getDBConnections() { return dbs_; }
-
-
-protected:
-
- //! Checks if the database connection is in the pool.
- /*!
- \param db A pointer to a database connection.
- \return Returns true if the database connection is in the pool
- otherwise returns false.
- */
- bool isDBConnectionInPool(TeDatabase* db);
-
- //! Searches the first available database connection in the pool for the given index.
- /*!
- \param dbConnectionIndx The connection index.
- \return Returns a valid pointer if there is a valid connected in the pool otherwise return NULL.
- */
- TeDBConnection* findDBConnection(const int& dbConnectionIndx);
-
- //! Searches the first available database connection in the pool for the given database key.
- /*!
- \param dbkey The database connection key.
- \return Returns a valid pointer if there is a valid connected in the pool otherwise return NULL.
- */
- TeDBConnection* findDBConnection(const std::string& dbkey);
-
- //! Closes all connections in the given vector and clears it.
- void clearDBConnectionVector(TeDBConnectionsVector& connectionsVector);
-
- //! Creates a new database connection based on the given connection parameters, puts it in the pool and returns it
- TeDBConnection* createDBConnection(const std::string& hostName, const std::string& databaseName,
- const std::string& userName, const std::string& dbmsName, const int& portNumber = 0,
- const std::string& userPasswd = "");
-
- //! Creates a new database connection based on the given connection parameters, puts it in the pool and returns it
- TeDBConnection* createDBConnection(TeDBConnection& dbCon);
-
-private:
-
- //! Hash table that maps a database key with a database connections vector.
- std::map<int, TeDBConnectionsVector, std::less<int> > dbs_;
- std::map< std::string, int, std::less<std::string> > dbIndxs_;
-
- //! Creates a new valid connection database identity
- int createsValidConId();
-};
-
-#endif
-
diff --git a/src/terralib/kernel/TeDataTypes.h b/src/terralib/kernel/TeDataTypes.h
index 2347318..32003f5 100644
--- a/src/terralib/kernel/TeDataTypes.h
+++ b/src/terralib/kernel/TeDataTypes.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeDataTypes.h
\brief This file contains enumerators and data types used by TerraLib
*/
diff --git a/src/terralib/kernel/TeDatabase.cpp b/src/terralib/kernel/TeDatabase.cpp
deleted file mode 100644
index df55e56..0000000
--- a/src/terralib/kernel/TeDatabase.cpp
+++ /dev/null
@@ -1,9712 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeDatabase.h"
-#include "TeDecoderDatabase.h"
-#include "TeGeometryAlgorithms.h"
-#include "TeSpatialOperations.h"
-#include "TeImportRaster.h"
-#include "TeLayer.h"
-#include "TeAbstractTheme.h"
-#include "TeExternalTheme.h"
-#include "TeDatabaseFactoryParams.h"
-#include <TeRasterTransform.h>
-#include <TeTimeInterval.h>
-
-#include <sys/stat.h>
-#include <stdio.h>
-#include <sstream>
-#include <cstring>
-
-typedef map<int,TeNode> TeNodeMap;
-
-static const int scales [] =
-{ 150000,
- 80000,
- 40000,
- 20000,
- 10000,
- 3000,
- 1500,
- 800,
- 400,
- 200,
- 100,
- 30,
- 15,
- 8,
- 4,
- 2,
- 1
-};
-
-//-*********************
-
-TeDatabase::TeDatabase() :
- isConnected_ (false),
- host_(""),
- user_(""),
- password_(""),
- database_(""),
- portNumber_(-1),
- errorNumber_(0),
- errorMessage_(""),
- transactionCounter_(0)
-{
- metaModel_.reset(new TeMetaModelCache);
-}
-
-TeDatabase& TeDatabase::operator=(const TeDatabase& other)
-{
- if(this != &other)
- metaModel_ = other.metaModel_;
-
- return *this;
-}
-
-TeDatabase::~TeDatabase()
-{
-}
-
-string
-TeDatabase::getDatabaseDescription()
-{
- std::stringstream desc;
- const char sep = ';';
-
- desc << dbmsName_;
- desc << sep << host_;
- desc << sep << portNumber_;
- desc << sep << database_;
- desc << sep << user_;
- desc << sep << password_;
-
- return desc.str();
-}
-
-void TeDatabase::alterTableInfoInMemory(const string& updatedTableName, string oldTableName)
-{
- //update table in memory
- TeTable updatedTable(updatedTableName);
- loadTableInfo(updatedTable);
- if(oldTableName.empty())
- oldTableName = updatedTableName;
-
- TeLayerMap::iterator itLayer = metaModel_->layerMap().begin();
- while(itLayer!=metaModel_->layerMap().end())
- {
- TeAttrTableVector::iterator itAttr = itLayer->second->attrTables().begin();
- while(itAttr!=itLayer->second->attrTables().end())
- {
- if(TeConvertToUpperCase(itAttr->name())==TeConvertToUpperCase(oldTableName))
- {
- (*itAttr)=updatedTable;
- break;
- }
- ++itAttr;
- }
- ++itLayer;
- }
- TeThemeMap::iterator itTheme = metaModel_->themeMap().begin();
- while(itTheme!=metaModel_->themeMap().end())
- {
- if(itTheme->second->getProductId() != TeTHEME)
- {
- ++itTheme;
- continue;
- }
-
- TeTheme* theme = static_cast<TeTheme*>(itTheme->second);
-
- TeAttrTableVector::iterator itAttr = theme->attrTables().begin();
- while(itAttr!=theme->attrTables().end())
- {
- if(TeConvertToUpperCase(itAttr->name())==TeConvertToUpperCase(oldTableName))
- {
- (*itAttr)=updatedTable;
- theme->loadAliasVector();
- theme->loadAttrLists();
- theme->loadTablesJoin();
- break;
- }
- ++itAttr;
- }
- ++itTheme;
- }
- return;
-}
-
-bool TeDatabase::validTable (TeTable& table)
-{
- int cont=0;
- bool change = false;
- bool changeTable = false;
- bool uniqueName, linkName;
-
- TeAttributeList::iterator it = table.attributeList().begin();
- TeAttributeList::iterator it2;
- while(it != table.attributeList().end())
- {
- uniqueName = false;
- linkName = false;
-
- if((*it).rep_.name_==table.uniqueName())
- uniqueName=true;
-
- if((*it).rep_.name_==table.linkName())
- linkName=true;
-
- string errorMess;
- string temp = TeCheckName((*it).rep_.name_, change, errorMess);
-
- if(change)
- {
- it2 = table.attributeList().begin();
- while(it2!=table.attributeList().end())
- {
- if(temp==(*it2).rep_.name_)
- {
- temp += Te2String(cont);
- it2 = table.attributeList().begin();
- ++cont;
- }
- else
- ++it2;
- }
-
- changeTable = true;
- }
-
- if(change && uniqueName)
- table.setUniqueName(temp);
- if(change && linkName)
- table.setLinkName (temp);
-
- (*it).rep_.name_ = temp;
- ++it;
- ++cont;
- }
-
- return changeTable;
-}
-
-string TeDatabase::getTableName(int tableId)
-{
- string tableName;
-
- TeDatabasePortal* pt = getPortal();
- string q = "SELECT attr_table FROM te_layer_table";
- q += " WHERE table_id = " + Te2String(tableId);
- if (pt->query(q) == true && pt->fetchRow())
- tableName = pt->getData("attr_table");
- delete pt;
- return tableName;
-}
-
-bool
-TeDatabase::deleteTable (const string& table)
-{
-// int f = table.find ("te_collection", std::string::npos);
- int f = table.find ("te_collection");
-
- if( table=="te_theme" ||
- table=="te_layer" ||
- table=="te_representation" ||
- table=="te_tables_relation" ||
- table=="te_layer_table" ||
- table=="te_raster_metadata" ||
- table=="te_projection" ||
- table=="te_view" ||
- table=="te_legend" ||
- table=="te_visual" ||
- table=="te_database" ||
- f == 0)
- {
- errorMessage_ = "N�o � poss�vel deletar tabelas do modelo!";
- return false;
- }
-
- string del = "DROP TABLE " + table;
- if(tableExist(table))
- {
- if(!execute(del))
- return false;
- }
-
- return true;
-}
-
-
-bool
-TeDatabase::deleteColumn (const string& table, const string& colName)
-{
- if(!tableExist(table))
- return false;
- TeAttribute attr;
- if (!columnExist(table,colName,attr))
- return true;
- string drop = "ALTER TABLE "+ table +" DROP COLUMN "+ colName;
- if(execute(drop) == false)
- return false;
-
- string tableId;
- TeDatabasePortal* portal = getPortal();
- string sql = "SELECT table_id FROM te_layer_table WHERE attr_table = '" + table + "'";
- if(portal->query(sql) && portal->fetchRow())
- tableId = portal->getData(0);
-
- delete portal;
- if(tableId.empty() == false)
- {
- // delete relation
- sql = "DELETE FROM te_tables_relation WHERE (related_table_id = " + tableId;
- sql += " AND related_attr = '" + colName + "')";
- sql += " OR (external_table_name = '" + table + "'";
- sql += " AND external_attr = '" + colName + "')";
- if(execute(sql) == false)
- return false;
-
- // delete grouping
- TeDatabasePortal* portal = getPortal();
- sql = "SELECT theme_id FROM te_grouping WHERE grouping_attr = '" + table + "." + colName + "'";
- if(portal->query(sql) && portal->fetchRow())
- {
- string themeId = portal->getData(0);
-
- sql = "DELETE FROM te_legend WHERE theme_id = " + themeId + " AND group_id >= 0";
- if(execute(sql) == false)
- {
- delete portal;
- return false;
- }
- }
- delete portal;
-
- sql = "DELETE FROM te_grouping";
- sql += " WHERE grouping_attr = '" + table + "." + colName + "'";
- if(execute(sql) == false)
- return false;
- }
- alterTableInfoInMemory(table);
- return true;
-}
-
-bool
-TeDatabase::defineIntegrity(void)
-{
- if (existRelation("te_layer","fk_layer_proj_id") == TeNoRelation )
- if (!createRelation("fk_layer_proj_id", "te_layer", "projection_id", "te_projection", "projection_id", false))
- return false;
-
- if (existRelation("te_representation","fk_rep_layer_id") == TeNoRelation )
- if (!createRelation("fk_rep_layer_id", "te_representation", "layer_id", "te_layer", "layer_id", true))
- return false;
-
- if (existRelation("te_view","fk_view_proj_id") == TeNoRelation )
- if (!createRelation("fk_view_proj_id", "te_view", "projection_id", "te_projection", "projection_id", false))
- return false;
-
- if (existRelation("te_view", "fk_view_current_theme") == TeNoRelation )
- if (!createRelation("fk_view_current_theme", "te_view", "current_theme", "te_theme", "theme_id", false))
- return false;
-
- if (existRelation("te_theme","fk_theme_layer_id") == TeNoRelation )
- if (!createRelation("fk_theme_layer_id", "te_theme", "layer_id", "te_layer", "layer_id", true))
- return false;
-
- if (existRelation("te_theme","fk_theme_view_id") == TeNoRelation )
- if (!createRelation("fk_theme_view_id", "te_theme", "view_id", "te_view", "view_id", true))
- return false;
-
- if (existRelation("te_theme_table","fk_thmtable_theme_id") == TeNoRelation )
- if (!createRelation("fk_thmtable_theme_id", "te_theme_table", "theme_id", "te_theme", "theme_id", true))
- return false;
-
- if (existRelation("te_theme_table","fk_thmtable_lytable_id") == TeNoRelation )
- if (!createRelation("fk_thmtable_lytable_id", "te_theme_table", "table_id", "te_layer_table", "table_id", false))
- return false;
-
- if (existRelation("te_theme_table","fk_thmtable_relation_id") == TeNoRelation )
- if (!createRelation("fk_thmtable_relation_id", "te_theme_table", "relation_id", "te_tables_relation", "relation_id", false))
- return false;
-
- if (existRelation("te_grouping","fk_group_theme_id") == TeNoRelation )
- if (!createRelation("fk_group_theme_id", "te_grouping", "theme_id", "te_theme", "theme_id", true))
- return false;
-
- if (existRelation("te_legend","fk_legend_theme_id") == TeNoRelation )
- if (!createRelation("fk_legend_theme_id", "te_legend", "theme_id", "te_theme", "theme_id", true))
- return false;
-
- if (existRelation("te_visual","fk_visual_legend_id") == TeNoRelation )
- if (!createRelation("fk_visual_legend_id", "te_visual", "legend_id", "te_legend", "legend_id", true))
- return false;
-
- if (existRelation("te_layer_table","fk_laytable_layer_id") == TeNoRelation )
- if (!createRelation ("fk_laytable_layer_id", "te_layer_table", "layer_id", "te_layer", "layer_id", true))
- return false;
-
- if (existRelation("te_tables_relation","fk_tabrelation_laytable_id") == TeNoRelation )
- if (!createRelation("fk_tabrelation_laytable_id", "te_tables_relation", "related_table_id", "te_layer_table", "table_id", true))
- return false;
-
- if (existRelation("te_visual_raster","fk_visrast_theme_id") == TeNoRelation )
- if (!createRelation("fk_visrast_theme_id", "te_visual_raster", "theme_id", "te_theme", "theme_id", true))
- return false;
-
- if (existRelation("te_project_view","fk_projectview_project_id") == TeNoRelation )
- if (!createRelation("fk_projectview_project_id", "te_project_view", "project_id", "te_project", "project_id", true))
- return false;
-
- if (existRelation("te_project_view","fk_projectview_view_id") == TeNoRelation )
- if (!createRelation("fk_projectview_view_id", "te_project_view", "view_id", "te_view", "view_id", true))
- return false;
-
- return true;
-}
-
-bool
-TeDatabase::createConceptualModel(bool withIntegrity, bool newDatabase, bool /* createIndex */)
-{
- bool status = true;
- bool createMainTables = false;
-
- if (!this->tableExist("te_projection"))
- {
- status = this->createProjectionTable();
- if (!status)
- return false;
- createMainTables = true;
- }
-
- if (!this->tableExist("te_layer"))
- {
- status = this->createLayerTable();
- if (!status)
- return false;
- createMainTables = true;
- }
-
- if (!this->tableExist("te_layer_table"))
- {
- status = this->createLayerTableTable();
- if (!status)
- return false;
- createMainTables = true;
- }
-
- if (!this->tableExist("te_tables_relation"))
- {
- status = this->createTablesRelationTable();
- if (!status)
- return false;
- createMainTables = true;
- }
-
- if (!this->tableExist("te_representation"))
- {
- status = this->createRepresentationTable();
- if (!status)
- return false;
- createMainTables = true;
- }
-
- if (!this->tableExist("te_theme"))
- {
- status = this->createThemeTable();
- if (!status)
- return false;
- createMainTables = true;
- }
-
- if (!this->tableExist("te_view"))
- {
- status = this->createViewTable();
- if (!status)
- return false;
- createMainTables = true;
- }
-
- if (!this->tableExist("te_grouping"))
- {
- status = this->createGroupingTable();
- if (!status)
- return false;
- }
-
- if (!this->tableExist("te_theme_table"))
- {
- status = this->createThemeTablesTable();
- if (!status)
- return false;
- }
-
- if (!this->tableExist("te_legend"))
- {
- status = this->createLegendTable();
- if (!status)
- return false;
- }
-
- if (!this->tableExist("te_visual"))
- {
- status = this->createVisualTable();
- if (!status)
- return false;
- }
-
- if (!this->tableExist("te_visual_raster"))
- {
- status = this->createVisualRasterTable();
- if (!status)
- return false;
- }
-
- if (!this->tableExist("te_database"))
- {
- status = this->createDatabaseTable();
- if (!status)
- return false;
- }
-
- if (!this->tableExist("te_project"))
- {
- status = this->createProjectTable();
- if (!status)
- return false;
- }
-
- if (!this->tableExist("te_project_view"))
- {
- status = this->createProjectViewTable();
- if (!status)
- return false;
- }
- if (newDatabase || createMainTables)
- {
- string ins = "INSERT INTO te_database (db_version) VALUES ('" + TeDBVERSION + "')";
- if (!execute(ins))
- return false;
- }
-
- if (withIntegrity)
- status = defineIntegrity();
-
- return status;
-}
-
-bool
-TeDatabase::createIndex(const string& tableName, const string& indexName, const string& columnsName)
-{
- string sql = "CREATE INDEX " + indexName + " ON " + tableName + "(" + columnsName + ")";
- return execute (sql);
-}
-
-bool
-TeDatabase::createDatabaseTable()
-{
- TeAttributeList attList;
-
- {TeAttribute attDBVersion;
- attDBVersion.rep_.name_ = "db_version";
- attDBVersion.rep_.type_ = TeSTRING;
- attDBVersion.rep_.numChar_ = 50;
- attDBVersion.rep_.isPrimaryKey_ = true;
- attDBVersion.rep_.null_ = false;
- attList.push_back(attDBVersion);}
-
- {TeAttribute attDBCreation;
- attDBCreation.rep_.name_ = "db_creation";
- attDBCreation.rep_.type_ = TeDATETIME;
- attList.push_back(attDBCreation);}
-
- return createTable("te_database", attList);
-}
-
-bool
-TeDatabase::createProjectTable()
-{
- TeAttributeList attList;
-
- {TeAttribute attProjectId;
- attProjectId.rep_.name_ = "project_id";
- attProjectId.rep_.type_ = TeUNSIGNEDINT;
- attProjectId.rep_.isAutoNumber_ = true;
- attProjectId.rep_.isPrimaryKey_ = true;
- attProjectId.rep_.null_ = false;
- attList.push_back(attProjectId);}
-
- {TeAttribute attName;
- attName.rep_.name_ = "name";
- attName.rep_.type_ = TeSTRING;
- attName.rep_.numChar_ = 50;
- attName.rep_.null_ = false;
- attList.push_back(attName);}
-
- {TeAttribute attDescription;
- attDescription.rep_.name_ = "description";
- attDescription.rep_.type_ = TeSTRING;
- attDescription.rep_.numChar_ = 255;
- attDescription.rep_.null_ = true;
- attList.push_back(attDescription);}
-
- {TeAttribute attCurrentView;
- attCurrentView.rep_.name_ = "current_view";
- attCurrentView.rep_.type_ = TeINT;
- attList.push_back(attCurrentView);}
-
- return createTable("te_project", attList);
-}
-
-bool
-TeDatabase::createProjectViewTable()
-{
- TeAttributeList attList;
-
- {TeAttribute attProjectId;
- attProjectId.rep_.name_ = "project_id";
- attProjectId.rep_.type_ = TeUNSIGNEDINT;
- attProjectId.rep_.isPrimaryKey_ = true;
- attProjectId.rep_.null_ = false;
- attList.push_back(attProjectId);}
-
- {TeAttribute attViewId;
- attViewId.rep_.name_ = "view_id";
- attViewId.rep_.type_ = TeUNSIGNEDINT;
- attViewId.rep_.isPrimaryKey_ = true;
- attViewId.rep_.null_ = false;
- attList.push_back(attViewId);}
-
- return createTable("te_project_view", attList);
-}
-
-bool
-TeDatabase::createProjectionTable ()
-{
- TeAttributeList attList;
-
- {TeAttribute attProjectId;
- attProjectId.rep_.name_ = "projection_id";
- attProjectId.rep_.type_ = TeUNSIGNEDINT;
- attProjectId.rep_.isPrimaryKey_ = true;
- attProjectId.rep_.isAutoNumber_ = true;
- attProjectId.rep_.null_ = false;
- attList.push_back(attProjectId);}
-
- {TeAttribute attName;
- attName.rep_.name_ = "name";
- attName.rep_.type_ = TeSTRING;
- attName.rep_.numChar_ = 50;
- attName.rep_.null_ = false;
- attList.push_back(attName);}
-
- {TeAttribute attLong0;
- attLong0.rep_.name_ = "long0";
- attLong0.rep_.type_ = TeREAL;
- attLong0.rep_.decimals_ = 15;
- attLong0.rep_.defaultValue_ = "0.0";
- attList.push_back(attLong0);}
-
- {TeAttribute attLat0;
- attLat0.rep_.name_ = "lat0";
- attLat0.rep_.type_ = TeREAL;
- attLat0.rep_.decimals_ = 15;
- attLat0.rep_.defaultValue_ = "0.0";
- attList.push_back(attLat0);}
-
- {TeAttribute attOffX;
- attOffX.rep_.name_ = "offx";
- attOffX.rep_.type_ = TeREAL;
- attOffX.rep_.decimals_ = 15;
- attOffX.rep_.defaultValue_ = "0.0";
- attList.push_back(attOffX);}
-
- {TeAttribute attOffY;
- attOffY.rep_.name_ = "offy";
- attOffY.rep_.type_ = TeREAL;
- attOffY.rep_.decimals_ = 15;
- attOffY.rep_.defaultValue_ = "0.0";
- attList.push_back(attOffY);}
-
- {TeAttribute attSlat1;
- attSlat1.rep_.name_ = "stlat1";
- attSlat1.rep_.type_ = TeREAL;
- attSlat1.rep_.decimals_ = 15;
- attSlat1.rep_.defaultValue_ = "0.0";
- attList.push_back(attSlat1);}
-
- {TeAttribute attSlat2;
- attSlat2.rep_.name_ = "stlat2";
- attSlat2.rep_.type_ = TeREAL;
- attSlat2.rep_.decimals_ = 15;
- attSlat2.rep_.defaultValue_ = "0.0";
- attList.push_back(attSlat2);}
-
- {TeAttribute attUnit;
- attUnit.rep_.name_ = "unit";
- attUnit.rep_.type_ = TeSTRING;
- attUnit.rep_.numChar_ = 50;
- attUnit.rep_.null_ = false;
- attList.push_back(attUnit);}
-
- {TeAttribute attScale;
- attScale.rep_.name_ = "scale";
- attScale.rep_.type_ = TeREAL;
- attScale.rep_.decimals_ = 15;
- attScale.rep_.defaultValue_ = "0.0";
- attList.push_back(attScale);}
-
- {TeAttribute attHemis;
- attHemis.rep_.name_ = "hemis";
- attHemis.rep_.type_ = TeINT;
- attHemis.rep_.null_ = false;
- attList.push_back(attHemis);}
-
- {TeAttribute attDatum;
- attDatum.rep_.name_ = "datum";
- attDatum.rep_.type_ = TeSTRING;
- attDatum.rep_.numChar_ = 50;
- attDatum.rep_.null_ = false;
- attList.push_back(attDatum);}
-
- {TeAttribute attRadius;
- attRadius.rep_.name_ = "radius";
- attRadius.rep_.type_ = TeREAL;
- attRadius.rep_.decimals_ = 15;
- attRadius.rep_.defaultValue_ = "0.0";
- attList.push_back(attRadius);}
-
- {TeAttribute attFlattening;
- attFlattening.rep_.name_ = "flattening";
- attFlattening.rep_.type_ = TeREAL;
- attFlattening.rep_.decimals_ = 15;
- attFlattening.rep_.defaultValue_ = "0.0";
- attList.push_back(attFlattening);}
-
- {TeAttribute attDX;
- attDX.rep_.name_ = "dx";
- attDX.rep_.type_ = TeREAL;
- attDX.rep_.decimals_ = 15;
- attDX.rep_.defaultValue_ = "0.0";
- attList.push_back(attDX);}
-
- {TeAttribute attDY;
- attDY.rep_.name_ = "dy";
- attDY.rep_.type_ = TeREAL;
- attDY.rep_.decimals_ = 15;
- attDY.rep_.defaultValue_ = "0.0";
- attList.push_back(attDY);}
-
- {TeAttribute attDZ;
- attDZ.rep_.name_ = "dz";
- attDZ.rep_.type_ = TeREAL;
- attDZ.rep_.decimals_ = 15;
- attDZ.rep_.defaultValue_ = "0.0";
- attList.push_back(attDZ);}
-
- return createTable("te_projection", attList);
-}
-
-bool TeDatabase::createLayerTable ()
-{
- TeAttributeList attList;
-
- {TeAttribute attLayerId;
- attLayerId.rep_.name_ = "layer_id";
- attLayerId.rep_.type_ = TeUNSIGNEDINT;
- attLayerId.rep_.isPrimaryKey_ = true;
- attLayerId.rep_.isAutoNumber_ = true;
- attLayerId.rep_.null_ = false;
- attList.push_back(attLayerId);}
-
- {TeAttribute attProjectionId;
- attProjectionId.rep_.name_ = "projection_id";
- attProjectionId.rep_.type_ = TeUNSIGNEDINT;
- attProjectionId.rep_.null_ = false;
- attList.push_back(attProjectionId);}
-
- {TeAttribute attName;
- attName.rep_.name_ = "name";
- attName.rep_.type_ = TeSTRING;
- attName.rep_.numChar_ = 255;
- attName.rep_.null_ = false;
- attList.push_back(attName);}
-
- {TeAttribute attLowerX;
- attLowerX.rep_.name_ = "lower_x";
- attLowerX.rep_.type_ = TeREAL;
- attLowerX.rep_.decimals_ = 15;
- attLowerX.rep_.defaultValue_ = "0.0";
- attList.push_back(attLowerX);}
-
- {TeAttribute attLowerY;
- attLowerY.rep_.name_ = "lower_y";
- attLowerY.rep_.type_ = TeREAL;
- attLowerY.rep_.decimals_ = 15;
- attLowerY.rep_.defaultValue_ = "0.0";
- attList.push_back(attLowerY);}
-
- {TeAttribute attUpperX;
- attUpperX.rep_.name_ = "upper_x";
- attUpperX.rep_.type_ = TeREAL;
- attUpperX.rep_.decimals_ = 15;
- attUpperX.rep_.defaultValue_ = "0.0";
- attList.push_back(attUpperX);}
-
- {TeAttribute attUpperY;
- attUpperY.rep_.name_ = "upper_y";
- attUpperY.rep_.type_ = TeREAL;
- attUpperY.rep_.decimals_ = 15;
- attUpperY.rep_.defaultValue_ = "0.0";
- attList.push_back(attUpperY);}
-
- {TeAttribute attInitialTime;
- attInitialTime.rep_.name_ = "initial_time";
- attInitialTime.rep_.type_ = TeDATETIME;
- attList.push_back(attInitialTime);}
-
- {TeAttribute attFinalTime;
- attFinalTime.rep_.name_ = "final_time";
- attFinalTime.rep_.type_ = TeDATETIME;
- attList.push_back(attFinalTime);}
-
- if(!createTable("te_layer", attList))
- return false;
-
- string idxName = "te_idx_layer_proj";
-
- if(!createIndex("te_layer", idxName, "projection_id"))
- return false;
-
- idxName = "te_idx_layer_name";
-
- return createIndex("te_layer", idxName, "name");
-}
-
-bool TeDatabase::createLayerTableTable()
-{
- TeAttributeList attList;
-
- {TeAttribute attTableId;
- attTableId.rep_.name_ = "table_id";
- attTableId.rep_.type_ = TeUNSIGNEDINT;
- attTableId.rep_.isPrimaryKey_ = true;
- attTableId.rep_.isAutoNumber_ = true;
- attTableId.rep_.null_ = false;
- attList.push_back(attTableId);}
-
- {TeAttribute attLayerId;
- attLayerId.rep_.name_ = "layer_id";
- attLayerId.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attLayerId);}
-
- {TeAttribute attTable;
- attTable.rep_.name_ = "attr_table";
- attTable.rep_.type_ = TeSTRING;
- attTable.rep_.numChar_ = 255;
- attTable.rep_.null_ = false;
- attList.push_back(attTable);}
-
- {TeAttribute attUniqueID;
- attUniqueID.rep_.name_ = "unique_id";
- attUniqueID.rep_.type_ = TeSTRING;
- attUniqueID.rep_.numChar_ = 255;
- attList.push_back(attUniqueID);}
-
- {TeAttribute attLink;
- attLink.rep_.name_ = "attr_link";
- attLink.rep_.type_ = TeSTRING;
- attLink.rep_.numChar_ = 255;
- attList.push_back(attLink);}
-
- {TeAttribute attAttrInitialTime;
- attAttrInitialTime.rep_.name_ = "attr_initial_time";
- attAttrInitialTime.rep_.type_ = TeSTRING;
- attAttrInitialTime.rep_.numChar_ = 255;
- attList.push_back(attAttrInitialTime);}
-
- {TeAttribute attAttrFinalTime;
- attAttrFinalTime.rep_.name_ = "attr_final_time";
- attAttrFinalTime.rep_.type_ = TeSTRING;
- attAttrFinalTime.rep_.numChar_ = 255;
- attList.push_back(attAttrFinalTime);}
-
- {TeAttribute attTimeUnit;
- attTimeUnit.rep_.name_ = "attr_time_unit";
- attTimeUnit.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attTimeUnit);}
-
- {TeAttribute attTableType;
- attTableType.rep_.name_ = "attr_table_type";
- attTableType.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attTableType);}
-
- {TeAttribute attUserName;
- attUserName.rep_.name_ = "user_name";
- attUserName.rep_.type_ = TeSTRING;
- attUserName.rep_.numChar_ = 255;
- attList.push_back(attUserName);}
-
- {TeAttribute attInitialTime;
- attInitialTime.rep_.name_ = "initial_time";
- attInitialTime.rep_.type_ = TeDATETIME;
- attList.push_back(attInitialTime);}
-
- {TeAttribute attFinalTime;
- attFinalTime.rep_.name_ = "final_time";
- attFinalTime.rep_.type_ = TeDATETIME;
- attList.push_back(attFinalTime);}
-
- if(!createTable("te_layer_table", attList))
- return false;
-
- string idxName = "te_idx_layertable_layer";
-
- if(!createIndex("te_layer_table", idxName, "layer_id"))
- return false;
-
- idxName = "te_idx_layertable_att";
-
- return createIndex("te_layer_table", idxName, "attr_table");
-}
-
-bool
-TeDatabase::updateTableInfo(int layerId, TeTable &table, const string user)
-{
- if (table.id() <= 0 ) // table information doesn�t exist in database yet
- return this->insertTableInfo(layerId,table,user);
- string sql;
- sql = "UPDATE te_layer_table SET ";
- sql += "unique_id='" + table.uniqueName() + "', ";
- sql += "attr_link='" + table.linkName() + "', ";
- sql += "attr_initial_time='" + table.attInitialTime() + "', ";
- sql += "attr_final_time='" + table.attFinalTime() + "', ";
- sql += "attr_time_unit=" + Te2String(table.attTimeUnit()) + ", ";
- sql += "attr_table_type="+ Te2String(table.tableType()) + ", ";
- sql += "user_name='" + user + "' WHERE ";
- sql += "layer_id=" + Te2String(layerId) + " AND ";
- sql += "attr_table_name='" + table.name() + "'";
- return execute (sql);
-}
-
-bool
-TeDatabase::loadTableInfo(TeTable& table)
-{
- if (table.name().empty())
- return false;
-
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- {
- this->errorMessage_ = "N�o foi poss�vel abrir portal para o banco";
- return false;
- }
-
- //theme tables
- string sel = " SELECT table_id, layer_id, attr_table, unique_id, ";
- sel += " attr_link, attr_initial_time, attr_final_time, attr_time_unit, ";
- sel += " attr_table_type, user_name, initial_time, final_time ";
- sel += " FROM te_layer_table ";
- sel += " WHERE attr_table = '" + table.name() + "'";
-
- if ((!portal->query(sel)) || (!portal->fetchRow()))
- {
- delete portal;
- return false;
- }
-
- if(!portal->getAttrTable(table))
- {
- delete portal;
- return false;
- }
-
- TeAttributeList attrList;
- getAttributeList(table.name(), attrList);
- table.setAttributeList(attrList);
-
- if (table.tableType() == TeAttrExternal) //information about external table
- {
- portal->freeResult();
-
- sel = " SELECT te_layer_table.attr_table, te_tables_relation.related_table_id, ";
- sel += " te_tables_relation.related_attr, te_tables_relation.external_attr ";
- sel += " FROM te_layer_table INNER JOIN te_tables_relation";
- sel += " ON te_layer_table.table_id = te_tables_relation.related_table_id ";
- sel += " WHERE te_tables_relation.external_table_name = '" + table.name() + "'";
-
- if (!portal->query(sel))
- {
- delete portal;
- return false;
- }
-
- if (!portal->fetchRow())
- {
- delete portal;
- return true;
- }
-
- int relatedTableId = portal->getInt(1); //related_table_id
- string relatedTable = portal->getData(0); //static table name
- string relatedAttr = portal->getData(2); // static column name - related_attr
-
- table.setTableType(TeAttrExternal, relatedTableId, relatedAttr);
- table.relatedTableName(relatedTable);
- table.setLinkName(portal->getData(3)); //external column name - external_attr
- }
-
- delete portal;
- return true;
-}
-
-
-bool TeDatabase::createLUTTable(const string& name)
-{
- if(name.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attIndexId;
- attIndexId.rep_.name_ = "index_id";
- attIndexId.rep_.type_ = TeUNSIGNEDINT;
- attIndexId.rep_.isPrimaryKey_ = true;
- attIndexId.rep_.null_ = false;
- attList.push_back(attIndexId);}
-
- {TeAttribute attRVal;
- attRVal.rep_.name_ = "r_val";
- attRVal.rep_.type_ = TeUNSIGNEDINT;
- attRVal.rep_.null_ = false;
- attList.push_back(attRVal);}
-
- {TeAttribute attGVal;
- attGVal.rep_.name_ = "g_val";
- attGVal.rep_.type_ = TeUNSIGNEDINT;
- attGVal.rep_.null_ = false;
- attList.push_back(attGVal);}
-
- {TeAttribute attBVal;
- attBVal.rep_.name_ = "b_val";
- attBVal.rep_.type_ = TeUNSIGNEDINT;
- attBVal.rep_.null_ = false;
- attList.push_back(attBVal);}
-
- return createTable(name, attList);
-}
-
-bool TeDatabase::createTablesRelationTable()
-{
- TeAttributeList attList;
-
- {TeAttribute attRelationId;
- attRelationId.rep_.name_ = "relation_id";
- attRelationId.rep_.type_ = TeUNSIGNEDINT;
- attRelationId.rep_.isAutoNumber_ = true;
- attRelationId.rep_.isPrimaryKey_ = true;
- attRelationId.rep_.null_ = false;
- attList.push_back(attRelationId);}
-
- {TeAttribute attRelatedTableId;
- attRelatedTableId.rep_.name_ = "related_table_id";
- attRelatedTableId.rep_.type_ = TeINT;
- attRelatedTableId.rep_.null_ = false;
- attList.push_back(attRelatedTableId);}
-
- {TeAttribute attRelatedAttr;
- attRelatedAttr.rep_.name_ = "related_attr";
- attRelatedAttr.rep_.type_ = TeSTRING;
- attRelatedAttr.rep_.numChar_ = 255;
- attRelatedAttr.rep_.null_ = false;
- attList.push_back(attRelatedAttr);}
-
- {TeAttribute attExternalTableName;
- attExternalTableName.rep_.name_ = "external_table_name";
- attExternalTableName.rep_.type_ = TeSTRING;
- attExternalTableName.rep_.numChar_ = 255;
- attExternalTableName.rep_.null_ = false;
- attList.push_back(attExternalTableName);}
-
- {TeAttribute attExternalAttr;
- attExternalAttr.rep_.name_ = "external_attr";
- attExternalAttr.rep_.type_ = TeSTRING;
- attExternalAttr.rep_.numChar_ = 255;
- attExternalAttr.rep_.null_ = false;
- attList.push_back(attExternalAttr);}
-
- return createTable("te_tables_relation", attList);
-}
-
-bool TeDatabase::createRepresentationTable ()
-{
- TeAttributeList attList;
-
- {TeAttribute attRepresId;
- attRepresId.rep_.name_ = "repres_id";
- attRepresId.rep_.type_ = TeUNSIGNEDINT;
- attRepresId.rep_.isAutoNumber_ = true;
- attRepresId.rep_.isPrimaryKey_ = true;
- attRepresId.rep_.null_ = false;
- attList.push_back(attRepresId);}
-
- {TeAttribute attLayerId;
- attLayerId.rep_.name_ = "layer_id";
- attLayerId.rep_.type_ = TeUNSIGNEDINT;
- attLayerId.rep_.null_ = false;
- attList.push_back(attLayerId);}
-
- {TeAttribute attGeomType;
- attGeomType.rep_.name_ = "geom_type";
- attGeomType.rep_.type_ = TeINT;
- attGeomType.rep_.null_ = false;
- attList.push_back(attGeomType);}
-
- {TeAttribute attGeomTable;
- attGeomTable.rep_.name_ = "geom_table";
- attGeomTable.rep_.type_ = TeSTRING;
- attGeomTable.rep_.numChar_ = 255;
- attGeomTable.rep_.null_ = false;
- attList.push_back(attGeomTable);}
-
- {TeAttribute attDescription;
- attDescription.rep_.name_ = "description";
- attDescription.rep_.type_ = TeSTRING;
- attDescription.rep_.numChar_ = 255;
- attList.push_back(attDescription);}
-
- {TeAttribute attLowerX;
- attLowerX.rep_.name_ = "lower_x";
- attLowerX.rep_.type_ = TeREAL;
- attLowerX.rep_.decimals_ = 15;
- attLowerX.rep_.defaultValue_ = "0.0";
- attList.push_back(attLowerX);}
-
- {TeAttribute attLowerY;
- attLowerY.rep_.name_ = "lower_y";
- attLowerY.rep_.type_ = TeREAL;
- attLowerY.rep_.decimals_ = 15;
- attLowerY.rep_.defaultValue_ = "0.0";
- attList.push_back(attLowerY);}
-
- {TeAttribute attUpperX;
- attUpperX.rep_.name_ = "upper_x";
- attUpperX.rep_.type_ = TeREAL;
- attUpperX.rep_.decimals_ = 15;
- attUpperX.rep_.defaultValue_ = "0.0";
- attList.push_back(attUpperX);}
-
- {TeAttribute attUpperY;
- attUpperY.rep_.name_ = "upper_y";
- attUpperY.rep_.type_ = TeREAL;
- attUpperY.rep_.decimals_ = 15;
- attUpperY.rep_.defaultValue_ = "0.0";
- attList.push_back(attUpperY);}
-
- {TeAttribute attResX;
- attResX.rep_.name_ = "res_x";
- attResX.rep_.type_ = TeREAL;
- attResX.rep_.decimals_ = 15;
- attResX.rep_.defaultValue_ = "0.0";
- attList.push_back(attResX);}
-
- {TeAttribute attResY;
- attResY.rep_.name_ = "res_y";
- attResY.rep_.type_ = TeREAL;
- attResY.rep_.decimals_ = 15;
- attResY.rep_.defaultValue_ = "0.0";
- attList.push_back(attResY);}
-
- {TeAttribute attNumCols;
- attNumCols.rep_.name_ = "num_cols";
- attNumCols.rep_.type_ = TeINT;
- attList.push_back(attNumCols);}
-
- {TeAttribute attNumRows;
- attNumRows.rep_.name_ = "num_rows";
- attNumRows.rep_.type_ = TeINT;
- attList.push_back(attNumRows);}
-
- {TeAttribute attInitialTime;
- attInitialTime.rep_.name_ = "initial_time";
- attInitialTime.rep_.type_ = TeDATETIME;
- attList.push_back(attInitialTime);}
-
- {TeAttribute attFinalTime;
- attFinalTime.rep_.name_ = "final_time";
- attFinalTime.rep_.type_ = TeDATETIME;
- attList.push_back(attFinalTime);}
-
- if(!createTable("te_representation", attList))
- return false;
-
- string idxName = "te_idx_representation";
-
- return createIndex("te_representation", idxName, "layer_id");
-}
-
-bool TeDatabase::createRasterMetadataTable(const string& tableName)
-{
- if(tableName.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attGeomId;
- attGeomId.rep_.name_ = "geom_id";
- attGeomId.rep_.type_ = TeUNSIGNEDINT;
- attGeomId.rep_.isPrimaryKey_ = true;
- attGeomId.rep_.null_ = false;
- attList.push_back(attGeomId);}
-
- {TeAttribute attBandId;
- attBandId.rep_.name_ = "band_id";
- attBandId.rep_.type_ = TeUNSIGNEDINT;
- attBandId.rep_.isPrimaryKey_ = true;
- attBandId.rep_.null_ = false;
- attList.push_back(attBandId);}
-
- {TeAttribute attMinValue;
- attMinValue.rep_.name_ = "min_value";
- attMinValue.rep_.type_ = TeREAL;
- attMinValue.rep_.decimals_ = 15;
- attMinValue.rep_.defaultValue_ = "0.0";
- attList.push_back(attMinValue);}
-
- {TeAttribute attMaxValue;
- attMaxValue.rep_.name_ = "max_value";
- attMaxValue.rep_.type_ = TeREAL;
- attMaxValue.rep_.decimals_ = 15;
- attMaxValue.rep_.defaultValue_ = "0.0";
- attList.push_back(attMaxValue);}
-
- {TeAttribute attNumBits;
- attNumBits.rep_.name_ = "num_bits";
- attNumBits.rep_.type_ = TeINT;
- attList.push_back(attNumBits);}
-
- {TeAttribute attDatatype;
- attDatatype.rep_.name_ = "data_type";
- attDatatype.rep_.type_ = TeINT;
- attList.push_back(attDatatype);}
-
- {TeAttribute attPhotoType;
- attPhotoType.rep_.name_ = "photometric_type";
- attPhotoType.rep_.type_ = TeINT;
- attList.push_back(attPhotoType);}
-
- {TeAttribute attCompressType;
- attCompressType.rep_.name_ = "compression_type";
- attCompressType.rep_.type_ = TeINT;
- attList.push_back(attCompressType);}
-
- {TeAttribute attDummy;
- attDummy.rep_.name_ = "dummy";
- attDummy.rep_.type_ = TeREAL;
- attDummy.rep_.decimals_ = 15;
- attList.push_back(attDummy);}
-
- return createTable(tableName, attList);
-}
-
-bool TeDatabase::createRasterTable(const string& tableName)
-{
- if(tableName.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attGeomId;
- attGeomId.rep_.name_ = "block_id";
- attGeomId.rep_.type_ = TeSTRING;
- attGeomId.rep_.numChar_ = 50;
- attGeomId.rep_.isPrimaryKey_ = true;
- attGeomId.rep_.null_ = false;
- attList.push_back(attGeomId);}
-
- {TeAttribute attSpatialData;
- attSpatialData.rep_.name_ = "spatial_data";
- attSpatialData.rep_.type_ = TeRASTERTYPE;
- attList.push_back(attSpatialData);}
-
- if(!createTable(tableName, attList))
- return false;
-
- string idxName = "te_idx_" + tableName + "_b";
-
- return createIndex(tableName, idxName, "band_id");
-}
-
-bool TeDatabase::createRasterGeometry(const string& tableName)
-{
- if(tableName.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attGeomId;
- attGeomId.rep_.name_ = "geom_id";
- attGeomId.rep_.type_ = TeUNSIGNEDINT;
- attGeomId.rep_.isAutoNumber_ = true;
- attGeomId.rep_.isPrimaryKey_ = true;
- attGeomId.rep_.null_ = false;
- attList.push_back(attGeomId);}
-
- {TeAttribute attObjId;
- attObjId.rep_.name_ = "object_id";
- attObjId.rep_.type_ = TeSTRING;
- attObjId.rep_.numChar_ = 255;
- attObjId.rep_.null_ = false;
- attList.push_back(attObjId);}
-
- {TeAttribute attRasterTable;
- attRasterTable.rep_.name_ = "raster_table";
- attRasterTable.rep_.type_ = TeSTRING;
- attRasterTable.rep_.numChar_ = 255;
- attRasterTable.rep_.null_ = false;
- attList.push_back(attRasterTable);}
-
- {TeAttribute attLutTable;
- attLutTable.rep_.name_ = "lut_table";
- attLutTable.rep_.type_ = TeSTRING;
- attLutTable.rep_.numChar_ = 255;
- attList.push_back(attLutTable);}
-
- {TeAttribute attResX;
- attResX.rep_.name_ = "res_x";
- attResX.rep_.type_ = TeREAL;
- attResX.rep_.decimals_ = 15;
- attResX.rep_.defaultValue_ = "0.0";
- attList.push_back(attResX);}
-
- {TeAttribute attResY;
- attResY.rep_.name_ = "res_y";
- attResY.rep_.type_ = TeREAL;
- attResY.rep_.decimals_ = 15;
- attResY.rep_.defaultValue_ = "0.0";
- attList.push_back(attResY);}
-
- {TeAttribute attNumBands;
- attNumBands.rep_.name_ = "num_bands";
- attNumBands.rep_.type_ = TeINT;
- attList.push_back(attNumBands);}
-
- {TeAttribute attNumCols;
- attNumCols.rep_.name_ = "num_cols";
- attNumCols.rep_.type_ = TeINT;
- attList.push_back(attNumCols);}
-
- {TeAttribute attNumRows;
- attNumRows.rep_.name_ = "num_rows";
- attNumRows.rep_.type_ = TeINT;
- attList.push_back(attNumRows);}
-
- {TeAttribute attBlockHeight;
- attBlockHeight.rep_.name_ = "block_height";
- attBlockHeight.rep_.type_ = TeINT;
- attList.push_back(attBlockHeight);}
-
- {TeAttribute attBlockWidth;
- attBlockWidth.rep_.name_ = "block_width";
- attBlockWidth.rep_.type_ = TeINT;
- attList.push_back(attBlockWidth);}
-
- {TeAttribute attLowerX;
- attLowerX.rep_.name_ = "lower_x";
- attLowerX.rep_.type_ = TeREAL;
- attLowerX.rep_.decimals_ = 15;
- attLowerX.rep_.defaultValue_ = "0.0";
- attList.push_back(attLowerX);}
-
- {TeAttribute attLowerY;
- attLowerY.rep_.name_ = "lower_y";
- attLowerY.rep_.type_ = TeREAL;
- attLowerY.rep_.decimals_ = 15;
- attLowerY.rep_.defaultValue_ = "0.0";
- attList.push_back(attLowerY);}
-
- {TeAttribute attUpperX;
- attUpperX.rep_.name_ = "upper_x";
- attUpperX.rep_.type_ = TeREAL;
- attUpperX.rep_.decimals_ = 15;
- attUpperX.rep_.defaultValue_ = "0.0";
- attList.push_back(attUpperX);}
-
- {TeAttribute attUpperY;
- attUpperY.rep_.name_ = "upper_y";
- attUpperY.rep_.type_ = TeREAL;
- attUpperY.rep_.decimals_ = 15;
- attUpperY.rep_.defaultValue_ = "0.0";
- attList.push_back(attUpperY);}
-
- {TeAttribute attTilingType;
- attTilingType.rep_.name_ = "tiling_type";
- attTilingType.rep_.type_ = TeINT;
- attList.push_back(attTilingType);}
-
- if(!createTable(tableName, attList))
- return false;
-
- string idxName = "te_idx_" + tableName;
-
- return createIndex(tableName, idxName, "object_id");
-}
-
-bool TeDatabase::createViewTable ()
-{
- TeAttributeList attList;
-
- {TeAttribute attViewId;
- attViewId.rep_.name_ = "view_id";
- attViewId.rep_.type_ = TeUNSIGNEDINT;
- attViewId.rep_.isPrimaryKey_ = true;
- attViewId.rep_.isAutoNumber_ = true;
- attViewId.rep_.null_ = false;
- attList.push_back(attViewId);}
-
- {TeAttribute attProjectionId;
- attProjectionId.rep_.name_ = "projection_id";
- attProjectionId.rep_.type_ = TeUNSIGNEDINT;
- attProjectionId.rep_.null_ = false;
- attList.push_back(attProjectionId);}
-
- {TeAttribute attName;
- attName.rep_.name_ = "name";
- attName.rep_.type_ = TeSTRING;
- attName.rep_.numChar_ = 255;
- attName.rep_.null_ = false;
- attList.push_back(attName);}
-
- {TeAttribute attUserName;
- attUserName.rep_.name_ = "user_name";
- attUserName.rep_.type_ = TeSTRING;
- attUserName.rep_.numChar_ = 255;
- attList.push_back(attUserName);}
-
- {TeAttribute attVisibility;
- attVisibility.rep_.name_ = "visibility";
- attVisibility.rep_.type_ = TeINT;
- attList.push_back(attVisibility);}
-
- {TeAttribute attLowerX;
- attLowerX.rep_.name_ = "lower_x";
- attLowerX.rep_.type_ = TeREAL;
- attLowerX.rep_.decimals_ = 15;
- attList.push_back(attLowerX);}
-
- {TeAttribute attLowerY;
- attLowerY.rep_.name_ = "lower_y";
- attLowerY.rep_.type_ = TeREAL;
- attLowerY.rep_.decimals_ = 15;
- attList.push_back(attLowerY);}
-
- {TeAttribute attUpperX;
- attUpperX.rep_.name_ = "upper_x";
- attUpperX.rep_.type_ = TeREAL;
- attUpperX.rep_.decimals_ = 15;
- attList.push_back(attUpperX);}
-
- {TeAttribute attUpperY;
- attUpperY.rep_.name_ = "upper_y";
- attUpperY.rep_.type_ = TeREAL;
- attUpperY.rep_.decimals_ = 15;
- attList.push_back(attUpperY);}
-
- {TeAttribute attCurrentTheme;
- attCurrentTheme.rep_.name_ = "current_theme";
- attCurrentTheme.rep_.type_ = TeINT;
- attList.push_back(attCurrentTheme);}
-
- if(!createTable("te_view", attList))
- return false;
-
- string idxName = "te_idx_view_projid";
-
- if(!createIndex("te_view", idxName, "projection_id"))
- return false;
-
- idxName = "te_idx_view_name";
-
- if(!createIndex("te_view", idxName, "name"))
- return false;
-
- idxName = "te_idx_view_user_name";
-
- return createIndex("te_view", idxName, "user_name");
-}
-
-bool TeDatabase::createThemeTable ()
-{
- TeAttributeList attList;
-
- {TeAttribute attThemeId;
- attThemeId.rep_.name_ = "theme_id";
- attThemeId.rep_.type_ = TeUNSIGNEDINT;
- attThemeId.rep_.isPrimaryKey_ = true;
- attThemeId.rep_.isAutoNumber_ = true;
- attThemeId.rep_.null_ = false;
- attList.push_back(attThemeId);}
-
- {TeAttribute attLayerId;
- attLayerId.rep_.name_ = "layer_id";
- attLayerId.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attLayerId);}
-
- {TeAttribute attViewId;
- attViewId.rep_.name_ = "view_id";
- attViewId.rep_.type_ = TeUNSIGNEDINT;
- attViewId.rep_.null_ = false;
- attList.push_back(attViewId);}
-
- {TeAttribute attName;
- attName.rep_.name_ = "name";
- attName.rep_.type_ = TeSTRING;
- attName.rep_.numChar_ = 255;
- attName.rep_.null_ = false;
- attList.push_back(attName);}
-
- {TeAttribute attParentId;
- attParentId.rep_.name_ = "parent_id";
- attParentId.rep_.type_ = TeUNSIGNEDINT;
- attParentId.rep_.null_ = false;
- attList.push_back(attParentId);}
-
- {TeAttribute attPriority;
- attPriority.rep_.name_ = "priority";
- attPriority.rep_.type_ = TeUNSIGNEDINT;
- attPriority.rep_.null_ = false;
- attList.push_back(attPriority);}
-
- {TeAttribute attNodeType;
- attNodeType.rep_.name_ = "node_type";
- attNodeType.rep_.type_ = TeUNSIGNEDINT;
- attNodeType.rep_.null_ = false;
- attList.push_back(attNodeType);}
-
- {TeAttribute attMinScale;
- attMinScale.rep_.name_ = "min_scale";
- attMinScale.rep_.type_ = TeREAL;
- attMinScale.rep_.decimals_ = 15;
- attList.push_back(attMinScale);}
-
- {TeAttribute attMaxScale;
- attMaxScale.rep_.name_ = "max_scale";
- attMaxScale.rep_.type_ = TeREAL;
- attMaxScale.rep_.decimals_ = 15;
- attList.push_back(attMaxScale);}
-
- {TeAttribute attGenAttWhere;
- attGenAttWhere.rep_.name_ = "generate_attribute_where";
- attGenAttWhere.rep_.type_ = TeSTRING;
- attGenAttWhere.rep_.numChar_ = 255;
- attList.push_back(attGenAttWhere);}
-
- {TeAttribute attGenSpatWhere;
- attGenSpatWhere.rep_.name_ = "generate_spatial_where";
- attGenSpatWhere.rep_.type_ = TeSTRING;
- attGenSpatWhere.rep_.numChar_ = 255;
- attList.push_back(attGenSpatWhere);}
-
- {TeAttribute attGenTempWhere;
- attGenTempWhere.rep_.name_ = "generate_temporal_where";
- attGenTempWhere.rep_.type_ = TeSTRING;
- attGenTempWhere.rep_.numChar_ = 255;
- attList.push_back(attGenTempWhere);}
-
- {TeAttribute attCollectionT;
- attCollectionT.rep_.name_ = "collection_table";
- attCollectionT.rep_.type_ = TeSTRING;
- attCollectionT.rep_.numChar_ = 255;
- attList.push_back(attCollectionT);}
-
- {TeAttribute attVisiRep;
- attVisiRep.rep_.name_ = "visible_rep";
- attVisiRep.rep_.type_ = TeINT;
- attList.push_back(attVisiRep);}
-
- {TeAttribute attEnableVis;
- attEnableVis.rep_.name_ = "enable_visibility";
- attEnableVis.rep_.type_ = TeINT;
- attList.push_back(attEnableVis);}
-
- {TeAttribute attLowerX;
- attLowerX.rep_.name_ = "lower_x";
- attLowerX.rep_.type_ = TeREAL;
- attLowerX.rep_.decimals_ = 15;
- attLowerX.rep_.defaultValue_ = "0.0";
- attList.push_back(attLowerX);}
-
- {TeAttribute attLowerY;
- attLowerY.rep_.name_ = "lower_y";
- attLowerY.rep_.type_ = TeREAL;
- attLowerY.rep_.decimals_ = 15;
- attLowerY.rep_.defaultValue_ = "0.0";
- attList.push_back(attLowerY);}
-
- {TeAttribute attUpperX;
- attUpperX.rep_.name_ = "upper_x";
- attUpperX.rep_.type_ = TeREAL;
- attUpperX.rep_.decimals_ = 15;
- attUpperX.rep_.defaultValue_ = "0.0";
- attList.push_back(attUpperX);}
-
- {TeAttribute attUpperY;
- attUpperY.rep_.name_ = "upper_y";
- attUpperY.rep_.type_ = TeREAL;
- attUpperY.rep_.decimals_ = 15;
- attUpperY.rep_.defaultValue_ = "0.0";
- attList.push_back(attUpperY);}
-
- if(!createTable("te_theme", attList))
- return false;
-
- string idxName = "te_idx_theme_view_id";
-
- if(!createIndex("te_theme", idxName, "view_id"))
- return false;
-
- idxName = "te_idx_theme_name";
-
- if(!createIndex("te_theme", idxName, "name"))
- return false;
-
- idxName = "te_idx_theme_layer_id";
-
- return createIndex("te_theme", idxName, "layer_id");
-}
-
-bool TeDatabase::createGroupingTable()
-{
- TeAttributeList attList;
-
- {TeAttribute attThemeId;
- attThemeId.rep_.name_ = "theme_id";
- attThemeId.rep_.type_ = TeUNSIGNEDINT;
- attThemeId.rep_.isPrimaryKey_ = true;
- attThemeId.rep_.null_ = false;
- attList.push_back(attThemeId);}
-
- {TeAttribute attGNumber;
- attGNumber.rep_.name_ = "grouping_number";
- attGNumber.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attGNumber);}
-
- {TeAttribute attGAttr;
- attGAttr.rep_.name_ = "grouping_attr";
- attGAttr.rep_.type_ = TeSTRING;
- attGAttr.rep_.numChar_ = 255;
- attList.push_back(attGAttr);}
-
- {TeAttribute attGAttrType;
- attGAttrType.rep_.name_ = "grouping_attr_type";
- attGAttrType.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attGAttrType);}
-
- {TeAttribute attGMode;
- attGMode.rep_.name_ = "grouping_mode";
- attGMode.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attGMode);}
-
- {TeAttribute attGNormAttr;
- attGNormAttr.rep_.name_ = "grouping_norm_attr";
- attGNormAttr.rep_.type_ = TeSTRING;
- attGNormAttr.rep_.numChar_ = 255;
- attList.push_back(attGNormAttr);}
-
- {TeAttribute attGStdDev;
- attGStdDev.rep_.name_ = "grouping_std_dev";
- attGStdDev.rep_.type_ = TeREAL;
- attGStdDev.rep_.decimals_ = 15;
- attGStdDev.rep_.defaultValue_ = "0.0";
- attList.push_back(attGStdDev);}
-
- {TeAttribute attGPrec;
- attGPrec.rep_.name_ = "grouping_precision";
- attGPrec.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attGPrec);}
-
- {TeAttribute attGFunc;
- attGFunc.rep_.name_ = "grouping_function";
- attGFunc.rep_.type_ = TeSTRING;
- attGFunc.rep_.numChar_ = 20;
- attList.push_back(attGFunc);}
-
- {TeAttribute attGChronon;
- attGChronon.rep_.name_ = "grouping_chronon";
- attGChronon.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attGChronon);}
-
- return createTable("te_grouping", attList);
-}
-
-bool TeDatabase::createThemeTablesTable()
-{
- TeAttributeList attList;
-
- {TeAttribute attThemeTableId;
- attThemeTableId.rep_.name_ = "theme_table_id";
- attThemeTableId.rep_.type_ = TeUNSIGNEDINT;
- attThemeTableId.rep_.isPrimaryKey_ = true;
- attThemeTableId.rep_.isAutoNumber_ = true;
- attThemeTableId.rep_.null_ = false;
- attList.push_back(attThemeTableId);}
-
- {TeAttribute attThemeId;
- attThemeId.rep_.name_ = "theme_id";
- attThemeId.rep_.type_ = TeUNSIGNEDINT;
- attThemeId.rep_.null_ = false;
- attList.push_back(attThemeId);}
-
- {TeAttribute attTableId;
- attTableId.rep_.name_ = "table_id";
- attTableId.rep_.type_ = TeUNSIGNEDINT;
- attTableId.rep_.null_ = false;
- attList.push_back(attTableId);}
-
- {TeAttribute attRelationId;
- attRelationId.rep_.name_ = "relation_id";
- attRelationId.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attRelationId);}
-
- {TeAttribute attTableOrderId;
- attTableOrderId.rep_.name_ = "table_order";
- attTableOrderId.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attTableOrderId);}
-
- if(!createTable("te_theme_table", attList))
- return false;
-
- string idxName = "te_idx_theme_table_id";
-
- if(!createIndex("te_theme_table", idxName, "table_id"))
- return false;
-
- idxName = "te_idx_theme_relat_id";
-
- if(!createIndex("te_theme_table", idxName, "relation_id"))
- return false;
-
- idxName = "te_idx_themetable_theme";
-
- return createIndex("te_theme_table", idxName, "theme_id");
-}
-
-bool TeDatabase::createLegendTable ()
-{
- TeAttributeList attList;
-
- {TeAttribute attLegendId;
- attLegendId.rep_.name_ = "legend_id";
- attLegendId.rep_.type_ = TeUNSIGNEDINT;
- attLegendId.rep_.isPrimaryKey_ = true;
- attLegendId.rep_.isAutoNumber_ = true;
- attLegendId.rep_.null_ = false;
- attList.push_back(attLegendId); }
-
- {TeAttribute attThemeId;
- attThemeId.rep_.name_ = "theme_id";
- attThemeId.rep_.type_ = TeUNSIGNEDINT;
- attThemeId.rep_.null_ = false;
- attList.push_back(attThemeId);}
-
- {TeAttribute attGId;
- attGId.rep_.name_ = "group_id";
- attGId.rep_.type_ = TeINT;
- attList.push_back(attGId);}
-
- {TeAttribute attNObjs;
- attNObjs.rep_.name_ = "num_objs";
- attNObjs.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attNObjs);}
-
- {TeAttribute attLValue;
- attLValue.rep_.name_ = "lower_value";
- attLValue.rep_.type_ = TeSTRING;
- attLValue.rep_.numChar_ = 255;
- attList.push_back(attLValue);}
-
- {TeAttribute attUValue;
- attUValue.rep_.name_ = "upper_value";
- attUValue.rep_.type_ = TeSTRING;
- attUValue.rep_.numChar_ = 255;
- attList.push_back(attUValue);}
-
- {TeAttribute attLabel;
- attLabel.rep_.name_ = "label";
- attLabel.rep_.type_ = TeSTRING;
- attLabel.rep_.numChar_ = 255;
- attList.push_back(attLabel);}
-
- if(!createTable("te_legend", attList))
- return false;
-
- string idxName = "te_idx_legend_theme";
-
- return createIndex("te_legend", idxName, "theme_id");
-}
-
-bool TeDatabase::createVisualTable()
-{
- TeAttributeList attList;
-
- {TeAttribute attLegendId;
- attLegendId.rep_.name_ = "legend_id";
- attLegendId.rep_.type_ = TeUNSIGNEDINT;
- attLegendId.rep_.isPrimaryKey_ = true;
- attLegendId.rep_.null_ = false;
- attList.push_back(attLegendId);}
-
- {TeAttribute attGeomType;
- attGeomType.rep_.name_ = "geom_type";
- attGeomType.rep_.type_ = TeUNSIGNEDINT;
- attGeomType.rep_.isPrimaryKey_ = true;
- attGeomType.rep_.null_ = false;
- attList.push_back(attGeomType);}
-
- {TeAttribute attSymbId;
- attSymbId.rep_.name_ = "symb_id";
- attSymbId.rep_.type_ = TeINT;
- attList.push_back(attSymbId);}
-
- {TeAttribute attRed;
- attRed.rep_.name_ = "red";
- attRed.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attRed);}
-
- {TeAttribute attGreen;
- attGreen.rep_.name_ = "green";
- attGreen.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attGreen);}
-
- {TeAttribute attBlue;
- attBlue.rep_.name_ = "blue";
- attBlue.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attBlue);}
-
- {TeAttribute attTransp;
- attTransp.rep_.name_ = "transparency";
- attTransp.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attTransp);}
-
- {TeAttribute attWidth;
- attWidth.rep_.name_ = "width";
- attWidth.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attWidth);}
-
- {TeAttribute attContourSymbId;
- attContourSymbId.rep_.name_ = "contour_symb_id";
- attContourSymbId.rep_.type_ = TeINT;
- attList.push_back(attContourSymbId);}
-
- {TeAttribute attContourRed;
- attContourRed.rep_.name_ = "contour_red";
- attContourRed.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attContourRed);}
-
- {TeAttribute attContourGreen;
- attContourGreen.rep_.name_ = "contour_green";
- attContourGreen.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attContourGreen);}
-
- {TeAttribute attContourBlue;
- attContourBlue.rep_.name_ = "contour_blue";
- attContourBlue.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attContourBlue);}
-
- {TeAttribute attContourTransp;
- attContourTransp.rep_.name_ = "contour_transp";
- attContourTransp.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attContourTransp);}
-
- {TeAttribute attContourWidth;
- attContourWidth.rep_.name_ = "contour_width";
- attContourWidth.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attContourWidth);}
-
- {TeAttribute attSizeValue;
- attSizeValue.rep_.name_ = "size_value";
- attSizeValue.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attSizeValue);}
-
- {TeAttribute attPtAngle;
- attPtAngle.rep_.name_ = "pt_angle";
- attPtAngle.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attPtAngle);}
-
- {TeAttribute attFamily;
- attFamily.rep_.name_ = "family";
- attFamily.rep_.type_ = TeSTRING;
- attFamily.rep_.numChar_ = 255;
- attList.push_back(attFamily);}
-
- {TeAttribute attBold;
- attBold.rep_.name_ = "bold";
- attBold.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attBold);}
-
- {TeAttribute attItalic;
- attItalic.rep_.name_ = "italic";
- attItalic.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attItalic);}
-
- {TeAttribute attAlignVert;
- attAlignVert.rep_.name_ = "alignment_vert";
- attAlignVert.rep_.type_ = TeREAL;
- attAlignVert.rep_.decimals_ = 15;
- attList.push_back(attAlignVert);}
-
- {TeAttribute attAlignHoriz;
- attAlignHoriz.rep_.name_ = "alignment_horiz";
- attAlignHoriz.rep_.type_ = TeREAL;
- attAlignHoriz.rep_.decimals_ = 15;
- attList.push_back(attAlignHoriz);}
-
- {TeAttribute attTabSize;
- attTabSize.rep_.name_ = "tab_size";
- attTabSize.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attTabSize);}
-
- {TeAttribute attLineSpace;
- attLineSpace.rep_.name_ = "line_space";
- attLineSpace.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attLineSpace);}
-
- {TeAttribute attFixedSize;
- attFixedSize.rep_.name_ = "fixed_size";
- attFixedSize.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attFixedSize);}
-
- return createTable("te_visual", attList);
-}
-
-
-bool TeDatabase::createVisualRasterTable()
-{
- TeAttributeList attList;
-
- {TeAttribute attThemeId;
- attThemeId.rep_.name_ = "theme_id";
- attThemeId.rep_.type_ = TeUNSIGNEDINT;
- attThemeId.rep_.isPrimaryKey_ = true;
- attThemeId.rep_.null_ = false;
- attList.push_back(attThemeId);}
-
- {TeAttribute attBandIn;
- attBandIn.rep_.name_ = "band_in";
- attBandIn.rep_.type_ = TeUNSIGNEDINT;
- attBandIn.rep_.isPrimaryKey_ = true;
- attBandIn.rep_.null_ = false;
- attList.push_back(attBandIn);}
-
- {TeAttribute attBandOut;
- attBandOut.rep_.name_ = "band_out";
- attBandOut.rep_.type_ = TeUNSIGNEDINT;
- attList.push_back(attBandOut);}
-
- {TeAttribute attTransfType;
- attTransfType.rep_.name_ = "transf_type";
- attTransfType.rep_.type_ = TeINT;
- attList.push_back(attTransfType);}
-
- {TeAttribute attParam1;
- attParam1.rep_.name_ = "param1";
- attParam1.rep_.type_ = TeREAL;
- attParam1.rep_.decimals_ = 15;
- attList.push_back(attParam1);}
-
- {TeAttribute attParam2;
- attParam2.rep_.name_ = "param2";
- attParam2.rep_.type_ = TeREAL;
- attParam2.rep_.decimals_ = 15;
- attList.push_back(attParam2);}
-
- {TeAttribute attLutTable;
- attLutTable.rep_.name_ = "lut_table";
- attLutTable.rep_.type_ = TeSTRING;
- attLutTable.rep_.numChar_ = 255;
- attList.push_back(attLutTable);}
-
- return createTable("te_visual_raster", attList);
-}
-
-bool TeDatabase::insertVisual (TeLegendEntry *legend)
-{
- TeGeomRepVisualMap::iterator it = legend->getVisualMap().begin();
- while ( it != legend->getVisualMap().end())
- {
- string style("0"), contourStyle("0"), sizeValue("0"), width("0");
-
- if(it->first == TePOLYGONS || it->first == TeCELLS)
- {
- contourStyle = Te2String(it->second->contourStyle());
- style = Te2String(it->second->style());
- }
- else if(it->first == TeLINES)
- {
- width = Te2String(it->second->width());
- style = Te2String(it->second->style());
- }
- else if(it->first == TePOINTS)
- {
- sizeValue = Te2String(it->second->size());
- style = Te2String(it->second->style());
- }
- else if(it->first == TeTEXT)
- {
- sizeValue = Te2String(it->second->size());
- }
-
- string insert = "INSERT INTO te_visual(legend_id, geom_type, ";
- insert += " symb_id, ";
- insert += "red, green, blue, transparency, width, ";
- insert += " contour_symb_id, ";
- insert += "contour_red, contour_green,";
- insert += "contour_blue, contour_transp, contour_width, size_value,";
- insert += "pt_angle, family, bold, italic, ";
- insert += "alignment_vert, alignment_horiz, tab_size, line_space, fixed_size) ";
- insert += " VALUES (";
- insert += Te2String(legend->id()) + ", ";
- insert += Te2String(it->first)+ ", ";
- insert += style + ", ";
- insert += Te2String(it->second->color().red_) + ", ";
- insert += Te2String(it->second->color().green_) + ", ";
- insert += Te2String(it->second->color().blue_) + ", ";
- insert += Te2String(it->second->transparency()) + ", ";
- insert += width +",";
- insert += contourStyle + ", ";
- insert += Te2String(it->second->contourColor().red_) + ", ";
- insert += Te2String(it->second->contourColor().green_) + ", ";
- insert += Te2String(it->second->contourColor().blue_) + ", ";
- insert += Te2String(it->second->contourTransparency()) + ", ";
- insert += Te2String(it->second->contourWidth()) + ", ";
-
- insert += sizeValue +",";
- insert += Te2String(it->second->ptAngle()) +", ";
-
- insert += "'" + it->second->family() + "', ";
- if (it->second->bold())
- insert += "1, ";
- else
- insert += "0, ";
- if (it->second->italic())
- insert += "1, ";
- else
- insert += "0, ";
- insert += Te2String(it->second->alignmentVert()) + ",";
- insert += Te2String(it->second->alignmentHoriz()) + ",";
- insert += Te2String(it->second->tabSize()) + ",";
- insert += Te2String(it->second->lineSpace()) +",";
- if (it->second->fixedSize())
- insert += "1 ";
- else
- insert += "0";
- insert += ")";
-
- if (!execute(insert))
- return false;
- ++it;
- }
- return true;
-}
-
-bool TeDatabase::createCollectionTable(const string& tableName)
-{
- if(tableName.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attCObjId;
- attCObjId.rep_.name_ = "c_object_id";
- attCObjId.rep_.type_ = TeSTRING;
- attCObjId.rep_.numChar_ = 255;
- attCObjId.rep_.isPrimaryKey_ = true;
- attCObjId.rep_.null_ = false;
- attList.push_back(attCObjId);}
-
- {TeAttribute attCLegendId;
- attCLegendId.rep_.name_ = "c_legend_id";
- attCLegendId.rep_.type_ = TeINT;
- attList.push_back(attCLegendId);}
-
- {TeAttribute attLabelX;
- attLabelX.rep_.name_ = "label_x";
- attLabelX.rep_.type_ = TeREAL;
- attLabelX.rep_.decimals_ = 15;
- attList.push_back(attLabelX);}
-
- {TeAttribute attLabelY;
- attLabelY.rep_.name_ = "label_y";
- attLabelY.rep_.type_ = TeREAL;
- attLabelY.rep_.decimals_ = 15;
- attList.push_back(attLabelY);}
-
- {TeAttribute attCLegendOwn;
- attCLegendOwn.rep_.name_ = "c_legend_own";
- attCLegendOwn.rep_.type_ = TeINT;
- attList.push_back(attCLegendOwn);}
-
- {TeAttribute attCObjStatus;
- attCObjStatus.rep_.name_ = "c_object_status";
- attCObjStatus.rep_.type_ = TeINT;
- attList.push_back(attCObjStatus);}
-
- if(!createTable(tableName, attList))
- return false;
-
- string collectionId;
- unsigned int pos = tableName.rfind("_");
- if ( (pos+1<tableName.size()) )
- collectionId = tableName.substr(pos+1);
-
- string idxName = "te_idx_c" + collectionId + "_clegid";
-
- if(!createIndex(tableName, idxName, "c_legend_id"))
- return false;
-
- idxName = "te_idx_c" + collectionId + "_clegown";
-
- return createIndex(tableName, idxName, "c_legend_own");
-}
-
-bool TeDatabase::createCellGeometry (const string& table)
-{
- if(table.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attGeomId;
- attGeomId.rep_.name_ = "geom_id";
- attGeomId.rep_.type_ = TeUNSIGNEDINT;
- attGeomId.rep_.isAutoNumber_ = true;
- attGeomId.rep_.isPrimaryKey_ = true;
- attGeomId.rep_.null_ = false;
- attList.push_back(attGeomId);}
-
- {TeAttribute attObjId;
- attObjId.rep_.name_ = "object_id";
- attObjId.rep_.type_ = TeSTRING;
- attObjId.rep_.numChar_ = 255;
- attObjId.rep_.null_ = false;
- attList.push_back(attObjId);}
-
- {TeAttribute attSpatial;
- attSpatial.rep_.name_ = "spatial_data";
- attSpatial.rep_.type_ = TeCELLTYPE;
- attList.push_back(attSpatial);}
-
- if(!createTable(table, attList))
- return false;
-
- string idxName = "te_idx_" + table + "obj";
-
- if(!createIndex(table, idxName, "object_id"))
- return false;
-
- idxName = "te_idx_" + table + "_lc";
-
- return createIndex(table, idxName, "row_number, col_number");
-}
-
-bool TeDatabase::createTextGeometry(const string& table)
-{
- if(table.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attGeomId;
- attGeomId.rep_.name_ = "geom_id";
- attGeomId.rep_.type_ = TeUNSIGNEDINT;
- attGeomId.rep_.isAutoNumber_ = true;
- attGeomId.rep_.isPrimaryKey_ = true;
- attGeomId.rep_.null_ = false;
- attList.push_back(attGeomId);}
-
- {TeAttribute attObjId;
- attObjId.rep_.name_ = "object_id";
- attObjId.rep_.type_ = TeSTRING;
- attObjId.rep_.numChar_ = 255;
- attObjId.rep_.null_ = false;
- attList.push_back(attObjId);}
-
- {TeAttribute attX;
- attX.rep_.name_ = "x";
- attX.rep_.type_ = TeREAL;
- attX.rep_.decimals_ = 15;
- attX.rep_.defaultValue_ = "0.0";
- attList.push_back(attX);}
-
- {TeAttribute attY;
- attY.rep_.name_ = "y";
- attY.rep_.type_ = TeREAL;
- attY.rep_.decimals_ = 15;
- attY.rep_.defaultValue_ = "0.0";
- attList.push_back(attY);}
-
- {TeAttribute attTextValue;
- attTextValue.rep_.name_ = "text_value";
- attTextValue.rep_.type_ = TeSTRING;
- attTextValue.rep_.numChar_ = 255;
- attList.push_back(attTextValue);}
-
- {TeAttribute attAngle;
- attAngle.rep_.name_ = "angle";
- attAngle.rep_.type_ = TeREAL;
- attAngle.rep_.decimals_ = 15;
- attAngle.rep_.defaultValue_ = "0.0";
- attList.push_back(attAngle);}
-
- {TeAttribute attHeight;
- attHeight.rep_.name_ = "height";
- attHeight.rep_.type_ = TeREAL;
- attHeight.rep_.decimals_ = 15;
- attHeight.rep_.defaultValue_ = "0.0";
- attList.push_back(attHeight);}
-
- {TeAttribute attAlignVert;
- attAlignVert.rep_.name_ = "alignment_vert";
- attAlignVert.rep_.type_ = TeREAL;
- attAlignVert.rep_.decimals_ = 15;
- attList.push_back(attAlignVert);}
-
- {TeAttribute attAlignHoriz;
- attAlignHoriz.rep_.name_ = "alignment_horiz";
- attAlignHoriz.rep_.type_ = TeREAL;
- attAlignHoriz.rep_.decimals_ = 15;
- attList.push_back(attAlignHoriz);}
-
- if(!createTable(table, attList))
- return false;
-
- string idxName = "te_idx_" + table + "_obj";
-
- if(!createIndex(table, idxName, "object_id"))
- return false;
-
- idxName = "te_idx_" + table + "_pos";
-
- return createIndex(table, idxName, "x, y");
-}
-
-bool TeDatabase::createNodeGeometry(const string& table)
-{
- if(table.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attGeomId;
- attGeomId.rep_.name_ = "geom_id";
- attGeomId.rep_.type_ = TeUNSIGNEDINT;
- attGeomId.rep_.isAutoNumber_ = true;
- attGeomId.rep_.isPrimaryKey_ = true;
- attGeomId.rep_.null_ = false;
- attList.push_back(attGeomId);}
-
- {TeAttribute attObjId;
- attObjId.rep_.name_ = "object_id";
- attObjId.rep_.type_ = TeSTRING;
- attObjId.rep_.numChar_ = 255;
- attObjId.rep_.null_ = false;
- attList.push_back(attObjId);}
-
- {TeAttribute attSpatial;
- attSpatial.rep_.name_ = "spatial_data";
- attSpatial.rep_.type_ = TeNODETYPE;
- attList.push_back(attSpatial);}
-
- if(!createTable(table, attList))
- return false;
-
- string idxName = "te_idx_" + table + "_obj";
-
- return createIndex(table, idxName, "object_id");
-}
-
-bool TeDatabase::createPointGeometry(const string& table)
-{
- if(table.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attGeomId;
- attGeomId.rep_.name_ = "geom_id";
- attGeomId.rep_.type_ = TeUNSIGNEDINT;
- attGeomId.rep_.isAutoNumber_ = true;
- attGeomId.rep_.isPrimaryKey_ = true;
- attGeomId.rep_.null_ = false;
- attList.push_back(attGeomId);}
-
- {TeAttribute attObjId;
- attObjId.rep_.name_ = "object_id";
- attObjId.rep_.type_ = TeSTRING;
- attObjId.rep_.numChar_ = 255;
- attObjId.rep_.null_ = false;
- attList.push_back(attObjId);}
-
- {TeAttribute attSpatial;
- attSpatial.rep_.name_ = "spatial_data";
- attSpatial.rep_.type_ = TePOINTTYPE;
- attList.push_back(attSpatial);}
-
- if(!createTable(table, attList))
- return false;
-
- string idxName = "te_idx_" + table + "_obj";
-
- return createIndex(table, idxName, "object_id");
-}
-
-bool TeDatabase::createArcGeometry(const string& table)
-{
- if(table.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attGeomId;
- attGeomId.rep_.name_ = "geom_id";
- attGeomId.rep_.type_ = TeUNSIGNEDINT;
- attGeomId.rep_.isAutoNumber_ = true;
- attGeomId.rep_.isPrimaryKey_ = true;
- attGeomId.rep_.null_ = false;
- attList.push_back(attGeomId);}
-
- {TeAttribute attObjId;
- attObjId.rep_.name_ = "object_id";
- attObjId.rep_.type_ = TeSTRING;
- attObjId.rep_.numChar_ = 255;
- attObjId.rep_.null_ = false;
- attList.push_back(attObjId);}
-
- {TeAttribute attFromNode;
- attFromNode.rep_.name_ = "from_node";
- attFromNode.rep_.type_ = TeINT;
- attFromNode.rep_.null_ = false;
- attList.push_back(attFromNode);}
-
- {TeAttribute attToNode;
- attToNode.rep_.name_ = "to_node";
- attToNode.rep_.type_ = TeINT;
- attToNode.rep_.null_ = false;
- attList.push_back(attToNode);}
-
- if(!createTable(table, attList))
- return false;
-
- string idxName = "te_idx_" + table + "_obj";
-
- if(!createIndex(table, idxName, "object_id"))
- return false;
-
- idxName = "te_idx_" + table + "_from";
-
- if(!createIndex(table, idxName, "from_node"))
- return false;
-
- idxName = "te_idx_" + table + "_to";
-
- return createIndex(table, idxName, "to_node");
-}
-
-
-bool
-TeDatabase::insertTable (TeTable &table)
-{
- string tableName = table.name();
- int size = table.size();
- TeAttributeList att = table.attributeList();
- TeAttributeList::iterator it = att.begin();
- TeAttributeList::iterator itEnd = att.end();
- TeTableRow row;
-
- int blobIndex=-1;
- if (!beginTransaction())
- return false;
-
- int i;
- unsigned int j;
- for ( i = 0; i < size; i++ )
- {
- row = table[i];
- it = att.begin();
- string attrs;
- string values;
- j = 1;
- int jj = 0;
- while ( it != itEnd )
- {
- if (row[jj].empty() || (*it).rep_.isAutoNumber_)
- {
- ++it;
- j++;
- jj++;
- continue;
- }
-
- if (!values.empty())
- {
- attrs += ", ";
- values += ", ";
- }
- attrs += (*it).rep_.name_;
- switch ((*it).rep_.type_)
- {
- case TeSTRING:
- values += "'"+ escapeSequence( row[jj] ) +"'";
- break;
- case TeREAL:
- {
- std::string strValue = row[jj];
- replace(strValue.begin(), strValue.end(), ',', '.');
- values += strValue;
- }
- break;
- case TeINT:
- values += row[jj];
- break;
- case TeDATETIME:
- {
- const string temp_dt = string(row[jj].c_str());
- TeTime t(temp_dt, (*it).dateChronon_, (*it).dateTimeFormat_, (*it).dateSeparator_, (*it).timeSeparator_, (*it).indicatorPM_);
- values += this->getSQLTime(t);
- }
- break;
- case TeCHARACTER:
- values += "'" + escapeSequence(row[jj]) + "'";
- break;
- case TeBLOB:
- blobIndex = jj;
- default:
- values += "'"+ escapeSequence(row[jj]) +"'";
- break;
- }
- ++it;
- j++;
- jj++;
- }
-
- if (values.empty())
- continue;
-
- string q = "INSERT INTO "+tableName + " ("+ attrs+") " + " VALUES ("+values+") ";
- if (!execute(q))
- continue;
-
- //If there were blob type
- if(blobIndex>=0)
- {
- TeAttribute uniqueAttr;
- table.attrUnique(uniqueAttr);
- string uniqueValue;
- int indexUniquePos = table.attrUniquePosition();
- if(uniqueAttr.rep_.isAutoNumber_)
- {
- //we have to get the last autonumber inserted
- string sql = " SELECT MAX("+ uniqueAttr.rep_.name_ +") FROM ";
- sql += tableName;
- TeDatabasePortal* portal = getPortal();
- if(!portal)
- {
- rollbackTransaction();
- return false;
- }
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- rollbackTransaction();
- return false;
- }
- uniqueValue = portal->getData(0);
- delete portal;
- }
- else
- //we can use the unique value
- uniqueValue = row[indexUniquePos];
-
- if(!insertBlob(tableName, att[blobIndex].rep_.name_, uniqueAttr.rep_, uniqueValue,
- (unsigned char*) row[blobIndex].c_str(), row[blobIndex].size()))
- {
- rollbackTransaction();
- return false;
- }
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::alterTable(const string& tableName, TeAttributeRep& rep, const string& oldColName)
-{
- if(!tableExist(tableName))
- return false;
-
- string tab;
-
- if(oldColName.empty())
- {
- tab = " ALTER TABLE " + tableName + " MODIFY ";
- tab += rep.name_ +" ";
- }
- else
- {
- tab = " ALTER TABLE " + tableName + " CHANGE ";
- tab += oldColName +" "+ rep.name_ +" ";
- }
-
- switch (rep.type_)
- {
- case TeSTRING:
- tab += "VARCHAR(" + Te2String(rep.numChar_) + ") ";
- break;
-
- case TeREAL:
- tab += "DOUBLE(24, 15)";
- break;
-
- case TeINT:
- tab += "INT";
- break;
-
- case TeDATETIME:
- tab += "DATETIME";
- break;
-
- case TeCHARACTER:
- tab += "CHAR";
- break;
-
- case TeBLOB:
- tab += "LONGBLOB";
- break;
-
- default:
- tab += "VARCHAR(" + Te2String(rep.numChar_) + ") ";
- break;
- }
-
- tab += " NULL ";
-
- if(!execute(tab))
- {
- if(errorMessage_.empty())
- errorMessage_ = "Error alter table " + tableName + " !";
- return false;
- }
-
- string tableId;
- TeDatabasePortal* portal = getPortal();
- string sql = "SELECT table_id FROM te_layer_table WHERE attr_table = '" + tableName + "'";
- if(portal->query(sql) && portal->fetchRow())
- tableId = portal->getData(0);
-
- delete portal;
-
- if(tableId.empty() == false)
- {
- if(oldColName.empty() == false) // column name changed
- {
- // update relation
- sql = "UPDATE te_tables_relation SET related_attr = '" + rep.name_ + "'";
- sql += " WHERE related_table_id = " + tableId;
- sql += " AND related_attr = '" + oldColName + "'";
- if(execute(sql) == false)
- return false;
-
- sql = "UPDATE te_tables_relation SET external_attr = '" + rep.name_ + "'";
- sql += " WHERE external_table_name = '" + tableName + "'";
- sql += " AND external_attr = '" + oldColName + "'";
- if(execute(sql) == false)
- return false;
-
- // update grouping
- sql = "UPDATE te_grouping SET grouping_attr = '" + tableName + "." + rep.name_ + "'";
- sql += " WHERE grouping_attr = '" + tableName + "." + oldColName + "'";
- if(execute(sql) == false)
- return false;
- }
- else // column type changed
- {
- // delete relation
- sql = "DELETE FROM te_tables_relation WHERE (related_table_id = " + tableId;
- sql += " AND related_attr = '" + rep.name_ + "')";
- sql += " OR (external_table_name = '" + tableName + "'";
- sql += " AND external_attr = '" + rep.name_ + "')";
- if(execute(sql) == false)
- return false;
-
- // delete grouping
- TeDatabasePortal* portal = getPortal();
- sql = "SELECT theme_id FROM te_grouping WHERE grouping_attr = '" + tableName + "." + oldColName + "'";
- if(portal->query(sql) && portal->fetchRow())
- {
- string themeId = portal->getData(0);
-
- sql = "DELETE FROM te_legend WHERE theme_id = " + themeId + " AND group_id >= 0";
- if(execute(sql) == false)
- {
- delete portal;
- return false;
- }
- }
- delete portal;
-
- sql = "DELETE FROM te_grouping";
- sql += " WHERE grouping_attr = '" + tableName + "." + oldColName + "'";
- if(execute(sql) == false)
- return false;
- }
- }
-
- alterTableInfoInMemory(tableName);
- return true;
-}
-
-bool
-TeDatabase::alterTable(const string& oldTableName, const string& newTablename)
-{
- string sql = " ALTER TABLE "+ oldTableName +" RENAME "+ newTablename;
- if(!execute(sql))
- return false;
-
- //update te_layer_table
- sql = " UPDATE te_layer_table ";
- sql += " SET attr_table = '"+ newTablename +"'";
- sql += " WHERE attr_table = '"+ oldTableName +"'";
- execute(sql);
-
- //update te_tables_relation
- sql = " UPDATE te_tables_relation ";
- sql += " SET external_table_name = '"+ newTablename +"'";
- sql += " WHERE external_table_name = '"+ oldTableName +"'";
- execute(sql);
-
- alterTableInfoInMemory(newTablename, oldTableName);
- return true;
-}
-
-bool
-TeDatabase::insertBlob (const string& tableName, const string& columnBlob, TeAttributeRep& columnId, const string& valueId, unsigned char* data, int size)
-{
- string whereClause = columnId.name_ +" = ";
- switch (columnId.type_ )
- {
- case TeSTRING:
- whereClause += "'"+ valueId + "'";
- break;
- default:
- whereClause += valueId;
- break;
- }
- return (insertBlob (tableName, columnBlob, whereClause, data, size));
-}
-
-bool
-TeDatabase::insertBlob (const string& tableName, const string& columnBlob, TeAttributeRep& columnId, const string& valueId, const string& fileName)
-{
- string whereClause = columnId.name_ +" = ";
- switch (columnId.type_ )
- {
- case TeSTRING:
- whereClause += "'"+ valueId + "'";
- break;
- default:
- whereClause += valueId;
- break;
- }
- return (insertBlob(tableName, columnBlob, whereClause, fileName));
-}
-
-bool
-TeDatabase::insertBlob (const string& tableName, const string& columnBlob, const string& whereClause, const string& fileName)
-{
- unsigned char *cdata = 0;
- int size;
- FILE *fp = 0;
-
- struct stat buf;
- int result;
-
- result = stat(fileName.c_str(), &buf);
-
- if( result != 0 )
- return false;
-
- size = buf.st_size;
-
- cdata = new unsigned char[size];
- fp = fopen(fileName.c_str(), "rb");
- fread(cdata, sizeof(unsigned char), size, fp);
-
- bool status = insertBlob (tableName, columnBlob, whereClause, cdata, size);
-
- if(fp)
- fclose(fp);
-
- if (cdata)
- delete []cdata;
-
- return status;
-}
-
-bool
-TeDatabase::getAttrTables(TeAttrTableVector& atts, TeAttrTableType attType)
-{
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- {
- this->errorMessage_ = "N�o foi poss�vel abrir portal para o banco";
- return false;
- }
-
- // Get layer tables
- string get = " SELECT * FROM te_layer_table";
- if (attType != TeAllAttrTypes)
- get += " WHERE attr_table_type = " + Te2String(attType);
- if (!portal->query(get))
- {
- delete portal;
- return false;
- }
-
- while (portal->fetchRow())
- {
- TeTable attTable;
- if(!portal->getAttrTable(attTable))
- {
- delete portal;
- return false;
- }
-
- TeAttributeList attrList;
- getAttributeList(attTable.name(), attrList);
- atts.push_back(attTable);
- }
- delete portal;
- return (atts.size() > 0);
-}
-
-bool
-TeDatabase::updateTable (TeTable &table)
-{
- TeAttributeList& att = table.attributeList();
- unsigned int i;
- string uniqueVal;
- bool isUniqueValString = false;
-
- if (!beginTransaction())
- return false;
-
- string uniqueName = table.uniqueName(); // primary key explicitly defined or
- if (table.uniqueName().empty()) // check in the attribute list
- {
- for (i=0; i<att.size(); ++i)
- if (att[i].rep_.isPrimaryKey_)
- {
- uniqueName = att[i].rep_.name_;
- table.setUniqueName(uniqueName);
- break;
- }
- }
-
- int blobIndex = -1;
- TeAttributeList::iterator it;
- TeTableRow row;
- unsigned int j;
- for (i = 0; i < table.size(); i++ )
- {
- row = table[i];
- it = att.begin();
- string q;
- j = 1;
- int jj = 0;
- while ( it != att.end() )
- {
- if (uniqueName != (*it).rep_.name_)
- {
- if ((*it).rep_.isAutoNumber_)
- {
- ++it;
- j++;
- jj++;
- continue;
- }
-
- if ((*it).rep_.type_ != TeBLOB)
- {
- if (q.empty()==false)
- q+= ",";
- q += (*it).rep_.name_ + "=";
- }
-
- switch ((*it).rep_.type_)
- {
- case TeSTRING:
- q += "'"+escapeSequence(row[jj])+"'";
- break;
- case TeREAL:
- {
- std::string value = row[jj];
- replace(value.begin(), value.end(), ',', '.');
- q += value;
- }
- break;
- case TeINT:
- q += row[jj];
- break;
- case TeDATETIME:
- {
- const string temp_dt = string(row[jj].c_str());
- TeTime t(temp_dt, (*it).dateChronon_, (*it).dateTimeFormat_, (*it).dateSeparator_, (*it).timeSeparator_, (*it).indicatorPM_);
- q += this->getSQLTime(t);
- }
- break;
- case TeCHARACTER:
- q += "'" + escapeSequence(row[jj]) + "'";
- break;
- case TeBLOB:
- blobIndex = jj;
- break;
- default:
- q += "'"+escapeSequence(row[jj])+"'";
- break;
- }
-
- }
- else
- {
- uniqueVal = row[jj];
- isUniqueValString = ((*it).rep_.type_ == TeSTRING);
- }
- ++it;
- j++;
- jj++;
- }
- if (q.empty())
- continue;
-
- if (!uniqueName.empty() && !uniqueVal.empty())
- {
- if(isUniqueValString)
- q += " WHERE " + uniqueName + " = '" + uniqueVal +"'";
- else
- q += " WHERE " + uniqueName + " = " + uniqueVal;
- }
- string sql = "UPDATE "+ table.name() + " SET " + q;
- if (!execute(sql))
- {
- rollbackTransaction();
- return false;
- }
-
- //verify if there was blob type
- if(blobIndex>=0)
- {
- TeAttribute uniqueAttr;
- table.attrUnique(uniqueAttr);
- if(!insertBlob (table.name(), att[blobIndex].rep_.name_, uniqueAttr.rep_, uniqueVal,
- (unsigned char*)row[blobIndex].c_str(), row[blobIndex].size()))
- {
- rollbackTransaction();
- return false;
- }
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-
-bool
-TeDatabase::loadTable(const string& tableName, TeTable &table)
-{
- bool isreg = false;
- table.name(tableName);
- if (loadTableInfo(table)) // this is not a registered table...
- isreg = true;
-
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- string q ="SELECT * FROM " + tableName;
- if (!portal->query(q))
- {
- delete portal;
- return false;
- }
- if (!isreg)
- table.setAttributeList(portal->getAttributeList());
- while (portal->fetchRow())
- {
- TeTableRow row;
- for (int j = 0; j < portal->numFields(); j++)
- {
- TeAttribute& attr = table.attributeList()[j];
- if (attr.rep_.type_ == TeBLOB)
- {
- unsigned char* data = NULL;
- long size = 0;
- portal->getBlob (attr.rep_.name_, data, size);
- string blobValue;
- if (data != NULL)
- {
- blobValue.assign((char*)data, size);
- delete [] data;
- data = NULL;
- }
- row.push_back(blobValue);
- }
- else
- row.push_back (portal->getData (j));
- }
- table.add(row);
- }
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::selectTable (const string& tableName, const string& criteria, TeTable &table)
-{
- bool isreg = false;
- table.name(tableName);
- if (loadTableInfo(table)) // this is not a registered table...
- isreg = true;
-
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- string q ="SELECT * FROM " + tableName;
- if (!criteria.empty())
- q += " WHERE " + criteria;
-
- if (!portal->query(q))
- {
- delete portal;
- return false;
- }
- if (!isreg)
- table.setAttributeList(portal->getAttributeList());
- while (portal->fetchRow())
- {
- TeTableRow row;
- for(int i = 0; i < portal->numFields(); i++)
- row.push_back(portal->getData(i));
- table.add(row);
- }
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::updateView (TeView *view)
-{
- TeProjection* proj = view->projection();
- if (proj)
- {
- if (proj->id() <= 0)
- this->insertProjection(view->projection());
- else
- this->updateProjection(view->projection());
- }
- else
- {
- errorMessage_ = "N�o � poss�vel atualizar vista sem proje��o!";
- return false;
- }
-
- string sql = "UPDATE te_view SET projection_id=" + Te2String(proj->id());
- sql+= ", name='" + view->name() + "'";
- sql+= ", user_name='" + view->user() + "'";
- sql+= ", visibility= " + Te2String((int)view->isVisible());
- sql+= ", lower_x = " + Te2String(view->getCurrentBox().lowerLeft().x(),15);
- sql+= ", lower_y = " + Te2String(view->getCurrentBox().lowerLeft().y(),15);
- sql+= ", upper_x = " + Te2String(view->getCurrentBox().upperRight().x(),15);
- sql+= ", upper_y = " + Te2String(view->getCurrentBox().upperRight().y(),15);
- if(view->getCurrentTheme() > 0)
- sql+= ", current_theme = " + Te2String(view->getCurrentTheme());
- else
- sql+= ", current_theme = null";
- sql +=" WHERE view_id = " + Te2String(view->id());
-
- if (!this->execute (sql))
- return false;
-
- TeViewTree* tree = view->root();
- if (tree)
- return updateViewTree(tree);
- return true;
-
-}
-
-
-bool
-TeDatabase::loadViewSet (const string& user, const bool& loadAttrList, const string& visualType)
-{
- //clear view map
- TeViewMap::iterator it = metaModel_->viewMap().begin();
- while (it != metaModel_->viewMap().end())
- {
- if(it->second)
- delete it->second;
- ++it;
- }
- metaModel_->viewMap().clear();
-
- //clear theme map
- TeThemeMap::iterator itTheme = metaModel_->themeMap().begin();
- while (itTheme != metaModel_->themeMap().end())
- {
- if(itTheme->second)
- delete itTheme->second;
- ++itTheme;
- }
-
- //clear invalid theme map
- itTheme = metaModel_->invalidThemeMap().begin();
- while (itTheme != metaModel_->invalidThemeMap().end())
- {
- if(itTheme->second)
- delete itTheme->second;
- ++itTheme;
- }
- metaModel_->invalidThemeMap().clear();
- metaModel_->themeMap().clear();
- metaModel_->legendMap().clear();
-
- //load view, projection, themes and grouping
- string sql = " SELECT ";
- sql += " te_view.*, "; //0-9 (10 columns)
- sql += " te_projection.*, "; //10 - 26 (17 columns)
- sql += " te_theme.*, "; // 27 - 45 (19 columns)
- sql += " te_grouping.*, "; //46 - 55 (10 columns)
- sql += " te_legend.*, "; // 56 - 62 (7 columns)
- sql += " te_visual.*, "; // 63 - 86 (24 columns)
- sql += " te_visual_raster.* "; // 87 (7 columns)
-
- sql += " FROM ((((((te_view INNER JOIN te_projection ";
- sql += " ON te_view.projection_id = te_projection.projection_id) ";
- sql += " LEFT JOIN te_theme ON te_view.view_id = te_theme.view_id ) ";
- sql += " LEFT JOIN te_grouping ON te_theme.theme_id = te_grouping.theme_id) ";
- sql += " LEFT JOIN te_legend ON te_theme.theme_id = te_legend.theme_id) ";
- sql += " LEFT JOIN te_visual ON te_visual.legend_id = te_legend.legend_id) ";
- sql += " LEFT JOIN te_visual_raster ON te_theme.theme_id = te_visual_raster.theme_id) ";
-
- sql += " WHERE ";
- if (!user.empty())
- sql += " te_view.user_name = '" + user + "'";
- else
- sql += " te_view.user_name = '" + this->user() + "'";
- sql += " ORDER BY te_view.view_id, te_theme.priority, te_theme.theme_id, te_legend.legend_id, ";
- sql += " te_legend.group_id, te_visual.geom_type, te_visual_raster.band_in ";
-
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- int lastViewId = -1;
- TeView *view = 0;
- bool hasNewRow = portal->fetchRow(); //idicates that this portal was fetched
- while(hasNewRow)
- {
- //load view and its projection
- if(lastViewId!=atoi(portal->getData(0)))
- {
- //store the last view
- if(view)
- {
- metaModel_->viewMap()[view->id()] = view;
- view = 0;
- }
- TeProjection* proj = 0;
- if(!portal->getProjection(&proj, 10)) //load projection
- {
- delete portal;
- return false;
- }
- view = new TeView();
- if(!portal->getView(*view, 0)) //load view
- {
- delete portal;
- delete view;
- return false;
- }
- if (proj != 0)
- view->projection(proj);
- lastViewId = view->id();
- }
-
- //make the rigth object
- string aux = portal->getData(27);
- if (aux.empty())
- {
- hasNewRow = portal->fetchRow();
- continue;
- }
- TeViewNodeType viewNodeType = (TeViewNodeType)portal->getInt(33);
- TeViewNode* viewNode = TeViewNodeFactory::make(viewNodeType);
-
- if(!viewNode)
- {
- int currentThemeId = portal->getInt(27);
-
- while((hasNewRow = portal->fetchRow()) && (portal->getInt(27) == currentThemeId))
- ;
-
- continue;
- }
-
- if(viewNodeType == TeTREE)
- {
- viewNode = loadViewTree(view, portal->getInt(27), loadAttrList, visualType);
- view->add(viewNode);
-
- hasNewRow = portal->fetchRow();
- continue;
- }
- else
- {
- if(!portal->getTheme(static_cast<TeAbstractTheme&>(*viewNode), 27))
- {
- delete viewNode;
- delete portal;
- return false;
- }
-
- if(viewNodeType == TeTHEME)
- {
- //load layer
- int id = static_cast<TeTheme*>(viewNode)->layerId();
- TeLayerMap::iterator it = metaModel_->layerMap().find(id);
- if (it == metaModel_->layerMap().end())
- loadLayerSet(loadAttrList);
-
- static_cast<TeTheme*>(viewNode)->layer(metaModel_->layerMap()[id]);
- }
- }
-
- TeAbstractTheme* theme = static_cast<TeAbstractTheme*>(viewNode);
-
- //load grouping
- TeGrouping group;
- if(portal->getGrouping(group, 46))
- theme->grouping(group);
-
- //load all legends of this theme
- //and its visual
- bool hasLegsToThisTheme = true;
- while(hasLegsToThisTheme)
- {
- //legend
- TeLegendEntry legend;
- if(!portal->getLegend(legend, 56))
- {
- delete theme;
- delete view;
- delete portal;
- return false;
- }
-
- //visual
- TeRasterVisual* rasterVisual = new TeRasterVisual();
- bool hasVisualToThisLeg = true;
- bool hasRasterVisual = false;
- while(hasVisualToThisLeg)
- {
- TeVisual* visual = TeVisualFactory::make(visualType);
- TeGeomRep geomRep;
- if(portal->getVisual(visual, geomRep, 63))
- legend.setVisual(visual, geomRep);
-
- if(portal->getRasterVisual(*rasterVisual, 87))
- hasRasterVisual=true;
-
- hasNewRow = portal->fetchRow();
- if(!hasNewRow || portal->getInt(58)!= legend.group() || portal->getInt(56)!= legend.id())
- hasVisualToThisLeg = false;
- }
-
- //Set raster visual to this theme
- if(hasRasterVisual)
- theme->rasterVisual(rasterVisual);
- else
- delete rasterVisual;
-
- //Set legend to this theme
- theme->legend(legend);
-
- //fill legend buffer
- if(legend.group() == -6)
- metaModel_->legendMap()[legend.id()] = &theme->queryAndPointingLegend();
- else if(legend.group() == -5)
- metaModel_->legendMap()[legend.id()] = &theme->queryLegend();
- else if (legend.group() == -4)
- metaModel_->legendMap()[legend.id()] = &theme->pointingLegend();
- else if (legend.group() == -3)
- metaModel_->legendMap()[legend.id()] = &theme->defaultLegend();
- else if (legend.group() == -2)
- metaModel_->legendMap()[legend.id()] = &theme->withoutDataConnectionLegend();
- else if (legend.group() == -1)
- metaModel_->legendMap()[legend.id()] = &theme->outOfCollectionLegend();
- else if (legend.group() == -10) //own legend
- {
- TeLegendEntry* legendTemp = new TeLegendEntry(legend);
- metaModel_->legendMap()[legend.id()] = legendTemp;
- }
-
- if(!hasNewRow || portal->getInt(27)!= theme->id())
- hasLegsToThisTheme = false;
- }
-
- for (unsigned int i = 0; i < theme->legend().size(); ++i)
- metaModel_->legendMap()[theme->legend()[i].id()] = &theme->legend()[i];
-
- if(viewNode->type()==(int)TeTHEME)
- {
- //load theme table
- if(!loadThemeTable(static_cast<TeTheme*>(theme), loadAttrList))
- {
- delete portal;
- return false;
- }
- }
-
- //load specific theme parameters
- if(!theme->loadMetadata(this))
- {
- metaModel_->invalidThemeMap()[viewNode->id()] = theme;
- continue;
- }
-
- metaModel_->themeMap()[viewNode->id()] = theme;
- view->add(viewNode);
- }
-
- //store the last view
- if(view)
- {
- metaModel_->viewMap()[view->id()] = view;
- view = 0;
- }
-
- delete portal;
- return true;
-
-}
-
-TeViewTree*
-TeDatabase::loadViewTree(TeView* view, int id, const bool& loadAttrList, const string& visualType)
-{
- if( view == 0)
- return 0;
-
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return 0;
-
- string q;
- TeViewTree *node = 0;
-
- if (id != 0)
- {
- q = "SELECT * FROM te_theme";
- q += " WHERE view_id = " + Te2String (view->id());
- q += " AND theme_id = " + Te2String(id);
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return 0;
- }
- TeViewNodeType type = (TeViewNodeType)portal->getInt("node_type");
- if(type != TeTREE)
- {
- portal->freeResult();
- delete portal;
- return NULL;
- }
- node = portal->getViewTree();
- portal->freeResult();
- }
-
- q ="SELECT * FROM te_theme";
- q += " WHERE view_id = " + Te2String (view->id());
- q += " AND parent_id = " + Te2String(id);
- q += " ORDER BY priority ASC";
-
- if (!portal->query(q))
- {
- delete portal;
- return node;
- }
-
- while (portal->fetchRow())
- {
- TeViewNodeType childType = (TeViewNodeType)portal->getInt("node_type");
- TeViewNode *childNode;
- if (childType == TeTHEME)
- {
- childNode = new TeTheme();
- childNode->id(portal->getInt(0));
- this->loadTheme((TeTheme*)childNode, loadAttrList, visualType);
- }
- else
- {
- childNode = loadViewTree(view, portal->getInt("theme_id"), loadAttrList, visualType);
- }
-
- if(id == 0)
- {
- view->add(childNode);
- }
- else
- {
-// view->addTheme(childNode);
- node->add(childNode);
- }
- }
- delete portal;
- return node;
-}
-
-bool
-TeDatabase::loadView (TeView* view, const bool& loadAttrList, const string& visualType)
-{
- string rest;
- if (view->id() > 0)
- rest = " te_view.view_id=" + Te2String(view->id());
- else if (!view->name().empty())
- {
- rest = " te_view.name='" + view->name() + "'";
-
- if(!view->user().empty())
- rest += " AND te_view.user_name='" + view->user() + "'";
- }
- else
- return false;
-
- //load view, projection, themes and grouping
- string sql = " SELECT ";
- sql += " te_view.*, "; //0-9 (10 columns)
- sql += " te_projection.*, "; //10 - 26 (17 columns)
- sql += " te_theme.*, "; // 27 - 45 (19 columns)
- sql += " te_grouping.*, "; //46 - 55 (10 columns)
- sql += " te_legend.*, "; // 56 - 62 (7 columns)
- sql += " te_visual.*, "; // 63 - 86 (24 columns)
- sql += " te_visual_raster.* "; // 87 (7 columns)
-
- sql += " FROM ((((((te_view INNER JOIN te_projection ";
- sql += " ON te_view.projection_id = te_projection.projection_id) ";
- sql += " LEFT JOIN te_theme ON te_view.view_id = te_theme.view_id ) ";
- sql += " LEFT JOIN te_grouping ON te_theme.theme_id = te_grouping.theme_id) ";
- sql += " LEFT JOIN te_legend ON te_theme.theme_id = te_legend.theme_id) ";
- sql += " LEFT JOIN te_visual ON te_visual.legend_id = te_legend.legend_id) ";
- sql += " LEFT JOIN te_visual_raster ON te_theme.theme_id = te_visual_raster.theme_id) ";
-
- sql += " WHERE "+ rest;
- sql += " ORDER BY te_view.view_id, te_theme.priority, te_theme.theme_id, te_legend.legend_id, ";
- sql += " te_legend.group_id, te_visual.geom_type, te_visual_raster.band_in ";
-
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- if (!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- //load projection
- TeProjection* proj = 0;
- if(!portal->getProjection(&proj, 10))
- {
- delete portal;
- return false;
- }
- //load view
- if(!portal->getView(*view, 0))
- {
- delete portal;
- return false;
- }
- if (proj != 0)
- view->projection(proj);
-
- bool hasNewRow = true;
-
- while(hasNewRow)
- {
- string aux = portal->getData(27);
- if (aux.empty())
- {
- hasNewRow = portal->fetchRow();
- continue;
- }
- TeViewNodeType viewNodeType = (TeViewNodeType)portal->getInt(33);
- //make the rigth object
- TeViewNode* viewNode = TeViewNodeFactory::make(viewNodeType);
-
- if(!viewNode)
- {
- int currentThemeId = portal->getInt(27);
-
- while((hasNewRow = portal->fetchRow()) && (portal->getInt(27) == currentThemeId))
- ;
-
- continue;
- }
-
- if(viewNodeType == TeTREE)
- {
- viewNode = loadViewTree(view, portal->getInt(27), loadAttrList, visualType);
- view->add(viewNode);
- hasNewRow = portal->fetchRow();
- continue;
- }
- else
- {
- if(!portal->getTheme(static_cast<TeAbstractTheme&>(*viewNode), 27))
- {
- delete viewNode;
- delete portal;
- return false;
- }
-
- if(viewNodeType == TeTHEME)
- {
- //load layer
- int id = static_cast<TeTheme*>(viewNode)->layerId();
- TeLayerMap::iterator it = metaModel_->layerMap().find(id);
- if (it == metaModel_->layerMap().end())
- loadLayerSet(loadAttrList);
-
- static_cast<TeTheme*>(viewNode)->layer(metaModel_->layerMap()[id]);
- }
- }
-
- TeAbstractTheme* abstractTheme = static_cast<TeAbstractTheme*>(viewNode);
-
- //load grouping
- TeGrouping group;
- if(portal->getGrouping(group, 46))
- abstractTheme->grouping(group);
-
- //load all legends of this theme
- //and its visual
- bool hasLegsToThisTheme = true;
- while(hasLegsToThisTheme)
- {
- //legend
- TeLegendEntry legend;
- if(!portal->getLegend(legend, 56))
- {
- delete viewNode;
- delete portal;
- return false;
- }
-
- //visual
- TeRasterVisual* rasterVisual = new TeRasterVisual();
- bool hasVisualToThisLeg = true;
- bool hasRasterVisual = false;
- while(hasVisualToThisLeg)
- {
- TeVisual* visual = TeVisualFactory::make(visualType);
- TeGeomRep geomRep;
- if(portal->getVisual(visual, geomRep, 63))
- legend.setVisual(visual, geomRep);
-
- if(portal->getRasterVisual(*rasterVisual, 87))
- hasRasterVisual=true;
-
- hasNewRow = portal->fetchRow();
- if(!hasNewRow || portal->getInt(58)!= legend.group() || portal->getInt(56)!= legend.id())
- hasVisualToThisLeg = false;
- }
-
- //Set raster visual to this theme
- if(hasRasterVisual)
- abstractTheme->rasterVisual(rasterVisual);
- else
- delete rasterVisual;
-
- //Set legend to this theme
- abstractTheme->legend(legend);
-
- //fill legend buffer
- if(legend.group() == -6)
- metaModel_->legendMap()[legend.id()] = & abstractTheme->queryAndPointingLegend();
- else if(legend.group() == -5)
- metaModel_->legendMap()[legend.id()] = & abstractTheme->queryLegend();
- else if (legend.group() == -4)
- metaModel_->legendMap()[legend.id()] = & abstractTheme->pointingLegend();
- else if (legend.group() == -3)
- metaModel_->legendMap()[legend.id()] = & abstractTheme->defaultLegend();
- else if (legend.group() == -2)
- metaModel_->legendMap()[legend.id()] = & abstractTheme->withoutDataConnectionLegend();
- else if (legend.group() == -1)
- metaModel_->legendMap()[legend.id()] = & abstractTheme->outOfCollectionLegend();
- else if (legend.group() == -10) //own legend
- {
- TeLegendEntry* legendTemp = new TeLegendEntry(legend);
- metaModel_->legendMap()[legend.id()] = legendTemp;
- }
-
- if(!hasNewRow || portal->getInt(27)!= abstractTheme->id())
- hasLegsToThisTheme = false;
- }
-
- for (unsigned int i = 0; i < abstractTheme->legend().size(); ++i)
- metaModel_->legendMap()[abstractTheme->legend()[i].id()] = & abstractTheme->legend()[i];
-
- if(viewNode->type()==(int)TeTHEME)
- {
- //load theme table
- if(!loadThemeTable(static_cast<TeTheme*>(abstractTheme), loadAttrList))
- {
- delete portal;
- return false;
- }
- }
-
- //load specific theme parameters
- if(!abstractTheme->loadMetadata(this))
- {
- metaModel_->invalidThemeMap()[viewNode->id()] = abstractTheme;
- continue;
- }
-
- metaModel_->themeMap()[viewNode->id()] = abstractTheme;
- view->add(viewNode);
- }
-
- metaModel_->viewMap()[view->id()] = view;
- delete portal;
- return true;
-}
-
-
-void
-TeDatabase::clear()
-{
- metaModel_->clear();
-}
-
-bool
-TeDatabase::deleteView (int viewId)
-{
- TeDatabasePortal* portal = this->getPortal();
-
- // view projection should be deleted manually
- string sql = "SELECT projection_id FROM te_view WHERE view_id=" + Te2String(viewId);
- portal->freeResult();
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
- if (!portal->fetchRow())
- {
- delete portal;
- return false;
- }
- string projId = portal->getData("projection_id");
- portal->freeResult();
-
- // delete themes belonging to this view
- sql = "SELECT theme_id FROM te_theme WHERE view_id=" + Te2String(viewId);
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
- while (portal->fetchRow())
- {
- int id = atoi(portal->getData(0));
- if(deleteTheme(id) == false)
- {
- delete portal;
- return false;
- }
- }
-
- //delete the entries in the project relation
- if (existRelation("te_project_view","fk_projectview_view_id") != TeRICascadeDeletion)
- {
- sql = "DELETE FROM te_project_view WHERE view_id =" + Te2String(viewId);
- if (!this->execute (sql))
- return false;
- }
-
- // delete view
- sql = "DELETE FROM te_view WHERE view_id = " + Te2String(viewId);
- if (!this->execute (sql))
- {
- delete portal;
- return false;
- }
-
- sql = "DELETE FROM te_projection WHERE projection_id = " + projId;
- if (!this->execute (sql))
- {
- delete portal;
- return false;
- }
-
- // Delete the view and its themes
- TeView* view = metaModel_->viewMap()[viewId];
- metaModel_->viewMap().erase(viewId);
- delete view;
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::updateViewTree (TeViewTree *tree)
-{
- if(tree ->type() == 1) //tree->id() > 0) //only for TeTREE
- {
- string sql;
- sql = "UPDATE te_theme SET ";
- sql += "name='" + tree->name()+"'";
- sql += ", parent_id=" + Te2String (tree->parentId());
- sql += ", node_type=" + Te2String (tree->type());
- sql += " ,priority=" + Te2String (tree->priority());
- sql += " WHERE theme_id = " + Te2String(tree->id());
-
- if(!this->execute (sql)) return false;
- }
-
- for (unsigned int th=0; th<tree->size(); th++)
- {
- TeViewNode* node = tree->retrieve(th);
- if (node->type() == TeTREE)
- {
- TeViewTree* tree = (TeViewTree*)node;
- if(!updateViewTree(tree)) return false;
- }
- else
- {
- TeTheme *theme = (TeTheme*)node;
- if(!updateTheme(theme)) return false;
- }
- }
- return true;
-}
-
-bool
-TeDatabase::viewExist(string viewName)
-{
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- viewName = TeConvertToUpperCase(viewName);
-
- string sql = "SELECT name FROM te_view";
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
- while (portal->fetchRow())
- {
- string name = portal->getData(0);
- name = TeConvertToUpperCase(name);
- if (viewName == name)
- {
- delete portal;
- return true;
- }
- }
- delete portal;
- return false;
-}
-
-
-bool
-TeDatabase::updateTheme (TeAbstractTheme *theme)
-{
- string sql;
-
- if (theme->id() <= 0 ) // theme doesn�t exist in the database yet
- {
- return this->insertTheme(theme);
- }
-
- // update theme metadata
- sql = "UPDATE te_theme SET ";
-
- if(theme->type()==TeTHEME)
- {
- sql += " layer_id=" + Te2String (static_cast<TeTheme*>(theme)->layerId());
- sql += ", ";
- }
-
- sql += " view_id=" + Te2String (theme->view());
- sql += ", name='" + escapeSequence(theme->name())+"'";
- sql += ", parent_id=" + Te2String (theme->parentId());
- sql += ", priority=" + Te2String (theme->priority());
- sql += ", node_type=" + Te2String (theme->type());
- sql += ", min_scale=" + Te2String (theme->minScale(),15);
- sql += ", max_scale=" + Te2String (theme->maxScale(),15);
- sql += ", generate_attribute_where='" + escapeSequence(theme->attributeRest())+"'";
- sql += ", generate_spatial_where='" + escapeSequence(theme->spatialRest())+"'";
- sql += ", generate_temporal_where='" + escapeSequence(theme->temporalRest())+"'";
-
- if(theme->type()==TeTHEME || theme->type()==TeEXTERNALTHEME )
- sql += ", collection_table='" + static_cast<TeTheme*>(theme)->collectionTable() + "'";
-
- sql += ", visible_rep= " + Te2String(theme->visibleRep ());
- sql += ", enable_visibility= " + Te2String(theme->visibility());
- sql += ", lower_x = " + Te2String(theme->box().x1(), 15);
- sql += ", lower_y = " + Te2String(theme->box().y1(), 15);
- sql += ", upper_x = " + Te2String(theme->box().x2(), 15);
- sql += ", upper_y = " + Te2String(theme->box().y2(), 15);
- sql += " WHERE theme_id=" + Te2String (theme->id(), 15);
-
- if (!this->execute (sql))
- return false;
-
- //delete grouping
- sql = "DELETE FROM te_grouping WHERE theme_id= "+ Te2String(theme->id());
- this->execute (sql);
-
- if(theme->grouping().groupMode_ != TeNoGrouping)
- {
- if(!insertGrouping(theme->id(), theme->grouping()))
- return false;
- }
-
- // update each of its legends
- bool status = true;
-
- if(theme->legend().size() == 0)
- {
- if(!deleteLegend(theme->id()))
- return false;
- }
- else
- {
- status = updateLegend(theme->legend());
- if (!status)
- return status;
- }
-
- status = updateLegend(&(theme->withoutDataConnectionLegend()));
- if (!status)
- return status;
-
- status = updateLegend(&(theme->outOfCollectionLegend()));
- if (!status)
- return status;
-
- status = updateLegend(&(theme->defaultLegend()));
- if (!status)
- return status;
-
- status = updateLegend(&(theme->pointingLegend()));
- if (!status)
- return status;
-
- status = updateLegend(&(theme->queryLegend()));
- if (!status)
- return status;
-
- status = updateLegend(&(theme->queryAndPointingLegend()));
- if (!status)
- return status;
-
- //insert metadata theme
- if(!theme->saveMetadata(this))
- return false;
-
- // theme tables
- if(theme->type()==TeTHEME && !updateThemeTable(static_cast<TeTheme*>(theme)))
- return false;
-
- return true;
-}
-
-bool
-TeDatabase::loadTheme (TeAbstractTheme* theme, const bool& loadAttrList, const string& visualType)
-{
- if (theme == 0)
- return false;
-
- string rest;
- if (theme->id() > 0)
- rest = " te_theme.theme_id = "+ Te2String(theme->id());
- else if (!theme->name().empty())
- rest = " te_theme.name = '"+ theme->name() + "'";
- else
- {
- this->errorMessage_ = "Theme procurado n�o possui nem id nem nome";
- return false;
- }
- rest += " AND te_view.user_name = \'" + this->user() +"\'";
-
- //load view, projection, themes and grouping
- string sql = " SELECT ";
- sql += " te_theme.*, "; // 0 - 18 (19 columns)
- sql += " te_grouping.*, "; //19 - 28 (10 columns)
- sql += " te_legend.*, "; // 29 - 35 (7 columns)
- sql += " te_visual.*, "; // 36 - 59 (24 columns)
- sql += " te_visual_raster.* "; // 60 (7 columns)
- sql += " FROM (((((te_view INNER JOIN te_theme ON te_view.view_id = te_theme.view_id) ";
- sql += " LEFT JOIN te_grouping ON te_theme.theme_id = te_grouping.theme_id ) ";
- sql += " LEFT JOIN te_legend ON te_theme.theme_id = te_legend.theme_id ) ";
- sql += " LEFT JOIN te_visual ON te_legend.legend_id = te_visual.legend_id ) ";
- sql += " LEFT JOIN te_visual_raster ON te_theme.theme_id = te_visual_raster.theme_id) ";
- sql += " WHERE "+ rest;
- sql += " ORDER BY te_theme.theme_id, te_legend.legend_id, te_legend.group_id, te_visual.geom_type, te_visual_raster.band_in ";
-
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return false;
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- TeViewNodeType viewNodeType = (TeViewNodeType)portal->getInt(6);
- if(viewNodeType == TeTREE)
- {
- TeViewNodeParams params;
- portal->getViewNodeParams(params, 0);
- theme->viewNodeParams(params);
- delete portal;
- return true;
- }
-
- if(!portal->getTheme(*theme, 0))
- {
- delete portal;
- return false;
- }
-
- if(viewNodeType==(int)TeTHEME)
- {
- //load layer
- int id = static_cast<TeTheme*>(theme)->layerId();
- TeLayerMap::iterator it = metaModel_->layerMap().find(id);
- if (it == metaModel_->layerMap().end())
- loadLayerSet(loadAttrList);
-
- static_cast<TeTheme*>(theme)->layer(metaModel_->layerMap()[id]);
- }
-
- //load grouping
- TeGrouping group;
- if(portal->getGrouping(group, 19))
- theme->grouping(group);
-
- //load all legends of this theme
- //and its visual
- bool hasLegsToThisTheme = true;
- bool hasNewRow = true;
- while(hasLegsToThisTheme)
- {
- //legend
- TeLegendEntry legend;
- if(!portal->getLegend(legend, 29))
- {
- delete portal;
- return false;
- }
-
- //visual
- TeRasterVisual* rasterVisual = new TeRasterVisual();
- bool hasVisualToThisLeg = true;
- bool hasRasterVisual = false;
- while(hasVisualToThisLeg)
- {
- TeVisual* visual = TeVisualFactory::make(visualType);
- TeGeomRep geomRep;
- if(portal->getVisual(visual, geomRep, 36))
- legend.setVisual(visual, geomRep);
-
- if(portal->getRasterVisual(*rasterVisual, 60))
- hasRasterVisual=true;
-
- hasNewRow = portal->fetchRow();
- if(!hasNewRow || portal->getInt(31)!= legend.group() || portal->getInt(29)!= legend.id() ) //if legend_id and group_id
- hasVisualToThisLeg = false;
- }
-
- //Set raster visual to this theme
- if(hasRasterVisual)
- theme->rasterVisual(rasterVisual);
- else
- delete rasterVisual;
-
- //Set legend to this theme
- theme->legend(legend);
-
- //fill legend buffer
- if(legend.group() == -6)
- metaModel_->legendMap()[legend.id()] = &theme->queryAndPointingLegend();
- else if(legend.group() == -5)
- metaModel_->legendMap()[legend.id()] = &theme->queryLegend();
- else if (legend.group() == -4)
- metaModel_->legendMap()[legend.id()] = &theme->pointingLegend();
- else if (legend.group() == -3)
- metaModel_->legendMap()[legend.id()] = &theme->defaultLegend();
- else if (legend.group() == -2)
- metaModel_->legendMap()[legend.id()] = &theme->withoutDataConnectionLegend();
- else if (legend.group() == -1)
- metaModel_->legendMap()[legend.id()] = &theme->outOfCollectionLegend();
- else if (legend.group() == -10) //own legend
- {
- TeLegendEntry* legendTemp = new TeLegendEntry(legend);
- metaModel_->legendMap()[legend.id()] = legendTemp;
- }
-
- if(!hasNewRow || portal->getInt(0)!= theme->id())
- hasLegsToThisTheme = false;
- }
-
- delete portal;
-
- for (unsigned int i = 0; i < theme->legend().size(); ++i)
- metaModel_->legendMap()[theme->legend()[i].id()] = &theme->legend()[i];
-
- //load theme table
- if(theme->type()==(int)TeTHEME)
- {
- if(!loadThemeTable(static_cast<TeTheme*>(theme), loadAttrList))
- return false;
- }
-
- //load specific theme parameters
- if(!theme->loadMetadata(this))
- {
- metaModel_->invalidThemeMap()[theme->id()] = theme;
- delete portal;
- return false;
- }
-
- metaModel_->themeMap()[theme->id()] = theme;
- return true;
-}
-
-
-bool
-TeDatabase::loadThemeTable (TeTheme* theme, const bool& loadAttrList)
-{
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- {
- this->errorMessage_ = "N�o foi poss�vel abrir portal para o banco";
- return false;
- }
-
- //theme tables
- string sel = "SELECT te_theme_table.*, "; //0 - 4 (5 columnns)
- sel += " te_tables_relation.*, "; //5 - 9 (5 columns)
- sel += " te_layer_table.* "; //10
- sel += " FROM (te_theme_table LEFT JOIN te_tables_relation";
- sel += " ON te_theme_table.relation_id = te_tables_relation.relation_id)";
- sel += " LEFT JOIN te_layer_table ON te_theme_table.table_id = te_layer_table.table_id";
- sel += " WHERE te_theme_table.theme_id = " + Te2String(theme->id());
- sel += " ORDER BY table_order";
-
- if (!portal->query (sel))
- {
- delete portal;
- return false;
- }
-
- while(portal->fetchRow ())
- {
- string tableName = portal->getData(12);
- if(tableName.empty())
- continue;
-
- TeTable table(tableName);
-
- TeLayerMap::iterator itLayer = metaModel_->layerMap().find(theme->layerId());
- if(itLayer!=metaModel_->layerMap().end() && (!itLayer->second->getAttrTablesByName(tableName, table)))
- {
- TeAttributeList attrList;
- if(loadAttrList)
- getAttributeList(tableName, attrList);
- table.setAttributeList(attrList);
- if(!portal->getAttrTable(table, 10))
- {
- delete portal;
- return false;
- }
- }
-
- table.setId(portal->getInt(2)); //"te_theme_table.table_id"
- table.setOrder(portal->getInt(4)); //"table_order"
- TeAttrTableType tableType = table.tableType(); //portal->getInt("attr_table_type");
- if (tableType == TeAttrExternal)
- {
- int relatedTableId = portal->getInt(6); //"related_table_id"
- table.relatedTableName(getTableName(relatedTableId));
- int relationId = portal->getInt(3); //"te_theme_table.relation_id"
- metaModel_->relationMSet().insert(relationId);
-
- string relatedAttr = portal->getData(7); //"related_attr"
- table.setTableType(TeAttrExternal, relatedTableId, relatedAttr);
-
- table.setLinkName(portal->getData(9)); //"external_attr"
- }
- else
- table.setTableType((TeAttrTableType)tableType);
-
- theme->addThemeTable(table);
- }
-
- delete portal;
- return true;
-}
-
-
-bool
-TeDatabase::insertThemeTable(TeTheme *theme, TeTable& inputTable)
-{
- int themeId = theme->id();
- int tableOrder = 0;
- int relationId;
- bool status;
- string qString;
-
- // Get the order of the last theme table
- qString = "SELECT MAX(table_order) FROM te_theme_table";
- qString += " WHERE theme_id = " + Te2String(themeId);
-
- TeDatabasePortal* portal = getPortal();
- if (portal->query(qString) == false || portal->fetchRow() == false)
- return false;
-
- string data = portal->getData(0);
- if (data.empty())
- tableOrder = 0;
- else
- {
- tableOrder = atoi(portal->getData(0));
- ++tableOrder;
- }
- inputTable.setOrder(tableOrder);
- delete portal;
-
- if (inputTable.tableType() == TeAttrExternal)
- {
- status = insertRelationInfo(inputTable.relatedTableId(),inputTable.relatedAttribute(),
- inputTable.name(),inputTable.linkName(),relationId);
- if (status == false)
- return false;
- metaModel_->relationMSet().insert(relationId);
-
- status = insertThemeTable(themeId, inputTable.id(), relationId, tableOrder);
- }
- else
- {
- // Insert the table in the te_theme_table
- status = insertThemeTable(themeId, inputTable.id(), 0, tableOrder);
- }
- return status;
-}
-
-bool
-TeDatabase::removeThemeTable(TeTheme *theme, int tableOrder)
-{
- if (tableOrder < 0)
- return false;
-
- int relationId = -1;
- string qString;
-
- TeAttrTableVector attrTableVector;
- theme->getAttTables(attrTableVector);
-
- // If the table is external, find the relation id
- qString = "SELECT relation_id FROM te_theme_table";
- qString += " WHERE theme_id = " + Te2String(theme->id());
- qString += " AND relation_id IS NOT NULL";
- qString += " AND table_order = " + Te2String(tableOrder);
-
- TeDatabasePortal* portal = getPortal();
- if (portal->query(qString) && portal->fetchRow())
- relationId = portal->getInt("relation_id");
- else
- {
- delete portal;
- return false;
- }
- delete portal;
-
- // Remove the table from the te_theme_table
- qString = "DELETE FROM te_theme_table WHERE theme_id = " + Te2String(theme->id());
- qString += " AND table_order = " + Te2String(tableOrder);
- if (execute(qString) == false)
- return false;
-
- // Remove the relation from the te_tables_relation
- // table if only this theme is using it
- if (relationId > 0)
- {
- if (metaModel_->relationMSet().count(relationId) == 1)
- {
- qString = "DELETE FROM te_tables_relation WHERE relation_id = " + Te2String(relationId);
- if (execute(qString) == false)
- return false;
- metaModel_->relationMSet().erase(relationId);
- }
- else
- metaModel_->relationMSet().erase(metaModel_->relationMSet().find(relationId));
- }
- return true;
-}
-
-
-bool
-TeDatabase::updateThemeTable(TeTheme *theme)
-{
- //Initially remove from te_theme_table all the records of this theme
- string q = "SELECT * FROM te_theme_table WHERE theme_id = " + Te2String(theme->id());
- TeDatabasePortal *portal = getPortal();
-
- if (portal->query(q) == false)
- {
- delete portal;
- return false;
- }
-
- while (portal->fetchRow())
- {
- int relationId;
- int themeTableId = portal->getInt("theme_table_id");
-
- string data = portal->getData("relation_id");
- if (data.empty())
- relationId = -1;
- else
- relationId = atoi(data.c_str());
-
- // Remove the relation from the te_tables_relation
- // table if only this theme is using it
- bool b = false;
- if (relationId > 0)
- {
- if (metaModel_->relationMSet().count(relationId) == 1)
- b = true;
- else
- metaModel_->relationMSet().erase(metaModel_->relationMSet().find(relationId));
- }
-
- // Remove the table from the te_theme_table
- q = "DELETE FROM te_theme_table WHERE theme_id = " + Te2String(theme->id());
- q += " AND theme_table_id = " + Te2String(themeTableId);
- if (execute(q) == false)
- {
- delete portal;
- return false;
- }
- if(b)
- {
- q = "DELETE FROM te_tables_relation WHERE relation_id = " + Te2String(relationId);
- if (execute(q) == false)
- {
- delete portal;
- return false;
- }
- metaModel_->relationMSet().erase(relationId);
- }
- }
- delete portal;
-
- // Update te_theme_table and te_tables_relation(if there are any external tables)
- // with the information provided from the new vector of theme tables
- TeAttrTableVector tablesVector;
- theme->getAttTables(tablesVector);
- for (unsigned i = 0; i < tablesVector.size(); ++i)
- insertThemeTable(theme, tablesVector[i]);
-
- return true;
-}
-
-
-bool
-TeDatabase::insertGrouping (int themeId, const TeGrouping& grouping)
-{
- if((themeId < 1) || (grouping.groupMode_ == TeNoGrouping) )
- return false;
-
- string ins = " INSERT INTO te_grouping (theme_id, grouping_number, ";
- ins += " grouping_attr, grouping_attr_type, grouping_mode, ";
- ins += " grouping_norm_attr, grouping_std_dev, grouping_precision, ";
- ins += " grouping_function, grouping_chronon)";
- ins += " VALUES ( ";
- ins += Te2String(themeId);
- ins += ", "+ Te2String(grouping.groupNumSlices_);
-
- string attname = grouping.groupAttribute_.name_;
- if(attname.empty() || (attname=="NONE") )
- attname = "";
-
- string norname = grouping.groupNormAttribute_;
- if(norname.empty() || (norname=="NONE"))
- norname = "";
-
- map<int, map<string, string> >::iterator it = metaModel_->mapThemeAlias().find(themeId);
- if(it != metaModel_->mapThemeAlias().end())
- {
- map<string, string>::iterator tit = it->second.find(attname);
- if(tit != it->second.end())
- {
- string alias = tit->second;
- attname += "(" + alias + ")";
- }
- if(norname.empty() == false)
- {
- map<string, string>::iterator tit = it->second.find(norname);
- if(tit != it->second.end())
- {
- string nalias = tit->second;
- norname += "(" + nalias + ")";
- }
- }
- }
-
- ins += ", '"+ attname +"'";
- ins += ", "+ Te2String(grouping.groupAttribute_.type_);
- ins += ", "+ Te2String(grouping.groupMode_);
- ins += ", '"+ norname +"'";
- ins += ", "+ Te2String(grouping.groupStdDev_);
- ins += ", "+ Te2String(grouping.groupPrecision_);
- ins += ", '"+ grouping.groupFunction_ +"'";
- ins += ", "+ Te2String(grouping.groupChronon_);
- ins += ")";
-
- return (execute(ins));
-}
-
-bool
-TeDatabase::updateGrouping (int themeId, const TeGrouping& grouping)
-{
- if((themeId < 1) || (grouping.groupMode_ == TeNoGrouping))
- return false;
-
- string up = " UPDATE te_grouping SET ";
- up += " grouping_number = "+ Te2String(grouping.groupNumSlices_);
-
- string attname = grouping.groupAttribute_.name_;
- if(attname.empty() || (attname=="NONE"))
- attname = "";
-
- string norname = grouping.groupNormAttribute_;
- if(norname.empty()|| (norname=="NONE"))
- norname = "";
-
- map<int, map<string, string> >::iterator it = metaModel_->mapThemeAlias().find(themeId);
- if(it != metaModel_->mapThemeAlias().end())
- {
- map<string, string>::iterator tit = it->second.find(attname);
- if(tit != it->second.end())
- {
- string alias = tit->second;
- attname += "(" + alias + ")";
- }
- if(norname.empty() == false)
- {
- map<string, string>::iterator tit = it->second.find(norname);
- if(tit != it->second.end())
- {
- string nalias = tit->second;
- norname += "(" + nalias + ")";
- }
- }
- }
-
- up += ", grouping_attr = '"+ attname +"'";
- up += ", grouping_attr_type = "+ Te2String(grouping.groupAttribute_.type_);
- up += ", grouping_mode = "+ Te2String(grouping.groupMode_);
- up += ", grouping_norm_attr = '"+ norname +"'";
- up += ", grouping_std_dev = "+ Te2String(grouping.groupStdDev_);
- up += ", grouping_precision = "+ Te2String(grouping.groupPrecision_);
- up += ", grouping_function = '"+ grouping.groupFunction_ +"'";
- up += ", grouping_chronon = "+ Te2String(grouping.groupChronon_);
- up += " WHERE theme_id = "+ Te2String(themeId);
-
- return (execute(up));
-}
-
-bool
-TeDatabase::generateLabelPositions(TeTheme *theme, const std::string& objectId)
-{
- string piebar, geomTable, upd;
- string collTable = theme->collectionTable();
-
- if((collTable.empty()) || (!tableExist(collTable)))
- return false;
-
- if (theme->layer()->hasGeometry(TeCELLS) )
- {
- geomTable = theme->layer()->tableName(TeCELLS);
-
- piebar = "SELECT label_x, label_y, lower_x, lower_y, upper_x, upper_y";
- piebar += " FROM " + collTable + " LEFT JOIN " + geomTable;
- piebar += " ON " + collTable + ".c_object_id = " + geomTable + ".object_id";
- if (!objectId.empty())
- upd += " WHERE " + collTable + ".c_object_id = '" + objectId + "'";
-
- upd = " UPDATE (" + piebar + ") SET";
- upd += " label_x = lower_x + (upper_x-lower_x)/2,";
- upd += " label_y = lower_y + (upper_y-lower_y)/2";
-
-
- if(!execute(upd))
- return false;
- }
-
- if( theme->layer()->hasGeometry(TePOLYGONS))
- {
- geomTable = theme->layer()->tableName(TePOLYGONS);
-
- piebar = "SELECT label_x, label_y, lower_x, lower_y, upper_x, upper_y";
- piebar += " FROM " + collTable + " LEFT JOIN " + geomTable;
- piebar += " ON " + collTable + ".c_object_id = " + geomTable + ".object_id";
- piebar += " WHERE label_x is null OR label_y is null";
- if (!objectId.empty())
- upd += " AND " + collTable + ".c_object_id = '" + objectId + "'";
- piebar += " ORDER BY c_object_id ASC, ext_max ASC";
-
- upd = " UPDATE (" + piebar + ") SET";
- upd += " label_x = lower_x + (upper_x-lower_x)/2,";
- upd += " label_y = lower_y + (upper_y-lower_y)/2";
-
- if(!execute(upd))
- return false;
- }
-
- if (theme->layer()->hasGeometry(TePOINTS))
- {
- geomTable = theme->layer()->tableName(TePOINTS);
-
- piebar = "SELECT label_x, label_y, x, y";
- piebar += " FROM " + collTable + " LEFT JOIN " + geomTable;
- piebar += " ON " + collTable + ".c_object_id = " + geomTable + ".object_id";
- piebar += " WHERE label_x is null OR label_y is null";
- if (!objectId.empty())
- upd += " AND " + collTable + ".c_object_id = '" + objectId + "'";
-
- upd = " UPDATE (" + piebar + ") SET";
- upd += " label_x = x,";
- upd += " label_y = y";
-
- if(!execute(upd))
- return false;
- }
-
- if(theme->layer()->hasGeometry(TeLINES))
- {
- geomTable = theme->layer()->tableName(TeLINES);
-
- piebar = "SELECT label_x, label_y, lower_x, lower_y, upper_x, upper_y";
- piebar += " FROM " + collTable + " LEFT JOIN " + geomTable;
- piebar += " ON " + collTable + ".c_object_id = " + geomTable + ".object_id";
- piebar += " WHERE label_x is null OR label_y is null";
- if (!objectId.empty())
- upd += " AND " + collTable + ".c_object_id = '" + objectId + "'";
- piebar += " ORDER BY c_object_id ASC, ext_max ASC";
-
- upd = " UPDATE (" + piebar + ") SET";
- upd += " label_x = lower_x + (upper_x-lower_x)/2,";
- upd += " label_y = lower_y + (upper_y-lower_y)/2";
-
- if(!execute(upd))
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::themeExist(string themeName)
-{
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- themeName = TeConvertToUpperCase(themeName);
-
- string sql = "SELECT name FROM te_theme";
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
- while (portal->fetchRow())
- {
- string name = portal->getData(0);
- name = TeConvertToUpperCase(name);
- if (themeName == name)
- {
- delete portal;
- return true;
- }
- }
- delete portal;
- return false;
-}
-
-string TeDatabase::getNewThemeName(const string& n)
-{
- bool changed;
- string invalidChar;
- string name = TeCheckName(n, changed, invalidChar);
- string newName = name;
-
- string q = "SELECT name FROM te_theme WHERE name = '" + newName + "'";
-
- TeDatabasePortal* portal = this->getPortal();
- if(portal && portal->query(q) && portal->fetchRow())
- {
- // there is already a theme with this theme
- q = "SELECT name FROM te_theme WHERE name LIKE '" + name + "_%' ORDER BY name DESC";
- portal->freeResult();
- if(portal && portal->query(q))
- {
- newName.clear();
- while(portal->fetchRow())
- {
- string s = portal->getData(0);
- size_t i, f = s.rfind("_");
- f++;
- newName = s.substr(0, f);
- string ss = s.substr(f);
- for(i=0; i < ss.size(); ++i)
- {
- if(ss[i] < 0x30 || ss[i] > 0x39)
- break;
- }
- if(i < ss.size())
- continue;
-
- int n = atoi(ss.c_str()) + 1;
- s = Te2String(n);
- newName += s;
- break;
- }
- if(newName.empty())
- newName = name + "_1";
- }
- }
- delete portal;
- return newName;
-}
-
-string TeDatabase::getNewTableName(const string& n)
-{
- bool changed;
- string invalidChar;
- string name = TeCheckName(n, changed, invalidChar);
- string newName = name;
- int i=1;
- while (this->tableExist(newName))
- {
- newName = name + Te2String(i);
- ++i;
- }
- return newName;
-}
-
-string TeDatabase::getConcatFieldsExpression(const vector<string>& fNamesVec)
-{
- string concatExp;
- for (unsigned int i = 0; i < fNamesVec.size(); ++i)
- {
- if (i != 0)
- concatExp += " & ";
- concatExp += fNamesVec[i];
- }
- return concatExp;
-}
-
-
-bool
-TeDatabase::deleteTheme(int themeId)
-{
- TeAbstractTheme* tema;
- bool themeWasFound = false;
- TeThemeMap::iterator it;
-
- it = invalidThemeMap().find(themeId);
- if (it != invalidThemeMap().end())
- {
- themeWasFound = true;
- tema = it->second;
- invalidThemeMap().erase(themeId);
- }
-
- if (themeWasFound == false)
- {
- it = themeMap().find(themeId);
- if(it != themeMap().end())
- {
- themeWasFound = true;
- tema = it->second;
- themeMap().erase(themeId);
- }
- }
-
- if (themeWasFound == false)
- return false;
-
- if(!tema->eraseMetadata(this))
- return false;
-
- string sql;
- // delete the collection table associated to this theme
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return false;
-
- sql = "SELECT collection_table FROM te_theme WHERE theme_id = " + Te2String(themeId);
- if (!portal->query(sql) ||!portal->fetchRow())
- {
- delete portal;
- return false;
- }
- string colTab = portal->getData("collection_table");
- //delete collection table
- if (this->tableExist(colTab))
- {
- sql = "DROP TABLE " + colTab;
- if (!this->execute(sql) )
- {
- delete portal;
- return false;
- }
- }
- //delete auxiliar collection table
- if (this->tableExist(colTab +"_aux"))
- {
- sql = "DROP TABLE " +colTab +"_aux";
- if (!this->execute(sql) )
- {
- delete portal;
- return false;
- }
- }
- portal->freeResult();
-
- //delete the visual associated to this theme
- if (existRelation("te_visual","fk_visual_legend_id") != TeRICascadeDeletion)
- {
- sql = "SELECT legend_id FROM te_legend WHERE theme_id = " + Te2String(themeId);
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
- string wherec;
- int c = 0;
- while (portal->fetchRow())
- {
- if (c)
- wherec += ",";
- c++;
- wherec += portal->getData(0);
- }
- portal->freeResult();
- if (!wherec.empty())
- {
- sql = "DELETE FROM te_visual WHERE legend_id IN (" + wherec + ")";
- if (!this->execute(sql))
- {
- delete portal;
- return false;
- }
- }
- }
-
- //delete all visuals of raster associated to this theme
- if (existRelation("te_visual_raster","fk_visrast_theme_id") != TeRICascadeDeletion)
- {
- sql = "DELETE FROM te_visual_raster WHERE theme_id =" + Te2String(themeId);
- if (!this->execute (sql))
- {
- delete portal;
- return false;
- }
- }
-
- //delete all legends associated to this theme
- if (existRelation("te_legend","fk_legend_theme_id") != TeRICascadeDeletion)
- {
- sql = "DELETE FROM te_legend WHERE theme_id =" + Te2String(themeId);
- if (!this->execute (sql))
- {
- delete portal;
- return false;
- }
- }
-
- //select the view of this theme
- sql = "SELECT view_id FROM te_theme WHERE theme_id = " + Te2String(themeId);
- portal->freeResult();
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- //delete theme of the view tree
- int viewId = portal->getInt("view_id");
- delete portal;
-
- //delete the tables associated to this theme
- if (existRelation("te_theme_table","fk_thmtable_theme_id") != TeRICascadeDeletion)
- {
- sql = "DELETE FROM te_theme_table WHERE theme_id =" + Te2String(themeId);
- if (!this->execute (sql))
- return false;
- }
-
- //delete the grouping
- if (existRelation("te_grouping","fk_group_theme_id") != TeRICascadeDeletion)
- {
- sql = "DELETE FROM te_grouping WHERE theme_id =" + Te2String(themeId);
- if (!this->execute (sql))
- return false;
- }
-
- // delete raster visual
- if (existRelation("te_visual_raster","fk_visrast_theme_id") == TeNoRelation )
- {
- sql = "DELETE FROM te_visual_raster WHERE theme_id =" + Te2String(themeId);
- if (!this->execute (sql))
- return false;
- }
-
- sql = " UPDATE te_view SET current_theme = NULL WHERE current_theme = "+ Te2String(themeId);
- this->execute(sql);
-
- // delete the theme
- sql = " DELETE FROM te_theme WHERE theme_id = " + Te2String(themeId);
- if (!this->execute (sql))
- return false;
-
- //delete in the maps
- TeView* view = viewMap()[viewId];
- if (view) //this view exists
- view->remove(themeId);
-
- unsigned int i;
- TeLegendEntryVector& legendVector = tema->legend();
- for (i = 0; i < legendVector.size(); ++i)
- legendMap().erase(legendVector[i].id());
-
- delete tema;
- return true;
-}
-
-bool
-TeDatabase::deleteThemeGroup(int themeId)
-{
- string sql;
- // delete the theme
- sql = "DELETE FROM te_theme WHERE theme_id = " + Te2String(themeId);
- if (!this->execute (sql))
- return false;
- return true;
-}
-
-bool
-TeDatabase::deleteLegend(int themeId)
-{
- // If there is a collection table update legend of the objects in it
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return false;
- string sel = "SELECT collection_table FROM te_theme WHERE theme_id = " + Te2String(themeId);
- string TC;
- if (portal->query(sel) && portal->fetchRow())
- TC = portal->getData(0);
- delete portal;
-
- if (!TC.empty() && this->tableExist(TC))
- {
- string up = "UPDATE " + TC + " SET c_legend_id = 0";
- if (!execute(up))
- return false;
- }
-
- // Delete visual of the legends
- string del = "DELETE FROM te_visual WHERE legend_id IN ";
- del += "(SELECT legend_id FROM te_legend WHERE theme_id = " + Te2String(themeId);
- del += " AND group_id > -1)";
- if (!execute(del))
- return false;
-
- del = "DELETE FROM te_legend WHERE theme_id = " + Te2String(themeId);
- del += " AND group_id > -1";
- if (!execute(del))
- return false;
-
- // Delete from memory the legends of the theme
- unsigned int i;
- TeAbstractTheme *theme = metaModel_->themeMap()[themeId];
- TeLegendEntryVector& legendVector = theme->legend();
- for (i = 0; i < legendVector.size(); ++i)
- metaModel_->legendMap().erase(legendVector[i].id());
- legendVector.clear();
-
- //delete grouping
- del = "DELETE FROM te_grouping WHERE theme_id =" + Te2String(themeId);
- if (!execute (del))
- return false;
-
- return true;
-}
-
-bool
-TeDatabase::updateLayer(TeLayer *layer)
-{
- if (!layer)
- return false;
-
- if (layer->projection())
- updateProjection(layer->projection());
-
- string sql;
- sql = "UPDATE te_layer SET ";
- sql += "name = '" + layer->name() + "' ";
- if (layer->box().isValid())
- {
- sql += ", lower_x = " + Te2String(layer->box().x1(),15) + " ";
- sql += ", lower_y = " + Te2String(layer->box().y1(),15) + " ";
- sql += ", upper_x = " + Te2String(layer->box().x2(),15) + " ";
- sql += ", upper_y = " + Te2String(layer->box().y2(),15) + " ";
- }else
- {
- sql += ", lower_x = " + Te2String(layer->box().x1()) + " ";
- sql += ", lower_y = " + Te2String(layer->box().y1()) + " ";
- sql += ", upper_x = " + Te2String(layer->box().x2()) + " ";
- sql += ", upper_y = " + Te2String(layer->box().y2()) + " ";
- }
- sql += " WHERE layer_id = " + Te2String(layer->id());
-
- return (this->execute (sql));
-}
-
-bool
-TeDatabase::loadLayerSet(const bool& loadAttrList)
-{
- //clear layer map
- TeLayerMap::iterator it = metaModel_->layerMap().begin();
- while (it != metaModel_->layerMap().end())
- {
- if(it->second)
- delete it->second;
- ++it;
- }
- metaModel_->layerMap().clear();
-
- string sql = " SELECT te_layer.*, "; // 0 - 8 (9 columns)
- sql += " te_projection.*, "; // 9 - 25 (17 columns)
- sql += " te_representation.*, "; // 26 - 40 (15 columns)
- sql += " te_layer_table.* "; // 41 - 52 (12 columns)
-
- sql += " FROM (((te_layer INNER JOIN te_projection ";
- sql += " ON te_layer.projection_id = te_projection.projection_id) ";
- sql += " LEFT JOIN te_representation ON ";
- sql += " te_layer.layer_id = te_representation.layer_id) ";
- sql += " LEFT JOIN te_layer_table ON ";
- sql += " te_layer.layer_id = te_layer_table.layer_id) ";
-
- sql += " ORDER BY te_layer.layer_id, te_representation.geom_type, te_layer_table.table_id ";
-
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return false;
-
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- int lastLayerId = -1;
- TeLayer *layer = 0;
- bool hasNewRow = portal->fetchRow(); //idicates that this portal was fetched
- while(hasNewRow)
- {
- //load view and its projection
- if(lastLayerId!=atoi(portal->getData(0)))
- {
- TeProjection* proj = 0;
- if(!portal->getProjection(&proj, 9)) //load projection
- {
- delete portal;
- return false;
- }
- layer = new TeLayer();
- if(!portal->getLayer(*layer, 0)) //load layer
- {
- delete portal;
- delete layer;
- return false;
- }
- if (proj != 0)
- layer->setProjection(proj);
- lastLayerId = layer->id();
- }
-
- //load its representation and its tables
- bool hasRepsTablesToThisLayer = true;
- vector<int> loadedTableId;
- while(hasRepsTablesToThisLayer)
- {
- //load representation
- string repId = portal->getData(26);
- if(!repId.empty() && !layer->hasGeometry(TeGeomRep(portal->getInt(28))))
- {
- TeRepresentation* rep = new TeRepresentation();
- if(!portal->getRepresentation(*rep, 26))
- {
- delete rep;
- delete layer;
- delete portal;
- }
- layer->addVectRepres(rep);
- }
-
- //load tables
- if( find(loadedTableId.begin(), loadedTableId.end(), portal->getInt(41)) == loadedTableId.end())
- {
- TeTable attrTable;
- if(portal->getAttrTable(attrTable, 41))
- {
- TeAttributeList attrList;
- if(loadAttrList)
- getAttributeList(attrTable.name(), attrList);
- attrTable.setAttributeList(attrList);
- layer->addAttributeTable(attrTable);
- loadedTableId.push_back(attrTable.id());
- }
- }
- hasNewRow = portal->fetchRow();
- if(!hasNewRow || portal->getInt(0)!= layer->id())
- hasRepsTablesToThisLayer = false;
- }
-
- layer->setDatabase(this);
- metaModel_->layerMap()[layer->id()] = layer;
- }
-
- delete portal;
- return true;
-
-}
-
-string
-TeDatabase::getRasterTable(int layerId, const string& objectId)
-{
- if (layerId <=0 )
- return "";
-
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return "";
-
- string get;
- // get the raster representation
- get = "SELECT geom_table FROM te_representation WHERE layer_id = "+Te2String(layerId);
- get += " AND geom_type= " + Te2String((int)TeRASTER) + " OR geom_type= " + Te2String((int)TeRASTERFILE);
-
- // error executing query or no there is no raster representation
- if (!portal->query(get) || !portal->fetchRow())
- {
- delete portal;
- return "";
- }
-
- string tableName = portal->getData(0);
- portal->freeResult();
- if (tableName.empty())
- {
- delete portal;
- return "";
- }
-
- // check if a specific object is being looked for
- get = "SELECT raster_table FROM " + tableName + " WHERE object_id='" + objectId + "'";
- if (!portal->query(get) || !portal->fetchRow())
- {
- delete portal;
- return "";
- }
- tableName = portal->getData(0);
- delete portal;
- return tableName;
-}
-
-
-TeRaster*
-TeDatabase::loadLayerRaster(int layerId, const string& objectId, const char& mode)
-{
- if (layerId <=0 )
- return 0;
-
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return 0;
-
- TeRaster* raster = 0;
- string get;
-
- // get the raster representation
- get = "SELECT geom_table, geom_type FROM te_representation WHERE layer_id = "+Te2String(layerId);
- get += " AND (geom_type= " + Te2String((int)TeRASTER) + " OR geom_type= " + Te2String((int)TeRASTERFILE) + ")";
-
- // error executing query or no there is no raster representation
- if (!portal->query(get) || !portal->fetchRow())
- {
- delete portal;
- return 0;
- }
- string tableName = portal->getData(0);
- TeGeomRep rep = static_cast<TeGeomRep>(portal->getInt(1));
- portal->freeResult();
- if (tableName.empty())
- {
- delete portal;
- return 0;
- }
-
- //--- this check is made for compatibility reasons with older terralib databases
- TeAttributeRep attrRep;
- attrRep.name_ = "tiling_type";
- attrRep.type_ = TeINT;
-
- TeAttribute att;
- if(!columnExist(tableName, attrRep.name_,att))
- {
- addColumn (tableName, attrRep);
- string sql = "UPDATE " + tableName + " SET tiling_type = " + Te2String(static_cast<int>(TeRasterParams::TeExpansible));
- this->execute(sql);
- }
-
- // ---
-
- // check if a specific object is being looked for
- get = "SELECT * FROM " + tableName;
- if (!objectId.empty())
- get += " WHERE object_id='" + objectId + "'";
- if (!portal->query(get) || !portal->fetchRow())
- {
- delete portal;
- return 0;
- }
-
- string oid = portal->getData("object_id");
- int geomId = portal->getInt("geom_id"); // get raster representation id
-
- // get raster parameters from te_raster_table table
- TeRasterParams params;
- params.fileName_ = portal->getData("raster_table");
- params.lutName_ = portal->getData("lut_table");
- params.nBands(portal->getInt("num_bands"));
- params.boundingBoxResolution(portal->getDouble("lower_x"),portal->getDouble("lower_y"),
- portal->getDouble("upper_x"),portal->getDouble("upper_y"),
- portal->getDouble("res_x"),portal->getDouble("res_y"));
- params.blockHeight_ = portal->getInt("block_height");
- params.blockWidth_ = portal->getInt("block_width");
- params.tiling_type_ = static_cast<TeRasterParams::TeRasterTilingType>(portal->getInt("tiling_type"));
-
- portal->freeResult();
-
- // get extra information from te_raster_metadata table
- string metadatatable = tableName + "_metadata";
- unsigned int nb = params.nBands();
- unsigned int i;
- for (i=0; i<nb; i++)
- {
- get = "SELECT * FROM " + metadatatable + " WHERE geom_id=" + Te2String(geomId);
- get += " AND band_id=" + Te2String(i);
- if (portal->query(get) && portal->fetchRow())
- {
- params.vmax_[i] = portal->getDouble("max_value");
- params.vmin_[i] = portal->getDouble("min_value");
- params.nbitsperPixel_[i] = portal->getInt("num_bits");
- params.dataType_[i] = static_cast<TeDataType>(portal->getInt("data_type"));
- params.compression_[i] = static_cast<TeRasterParams::TeRasterCompressionMode>(portal->getInt("compression_type"));
- params.photometric_[i] = static_cast<TeRasterParams::TeRasterPhotometricInterpretation>(portal->getInt("photometric_type"));
- }
- portal->freeResult();
- }
-
- // if raster is pallete get the associated LUT
- if (params.photometric_[0] == TeRasterParams::TePallete && rep != TeRASTERFILE)
- this->loadRasterLUT(¶ms);
-
- // raster has the same projection as its layer
- get = " SELECT te_projection.* FROM ";
- get += " te_projection INNER JOIN te_layer ON ";
- get += " te_projection.projection_id = te_layer.projection_id ";
- get += " WHERE layer_id = " + Te2String(layerId);
-
- TeProjection* proj=0;
- if (portal->query(get) && portal->fetchRow())
- portal->getProjection(&proj);
-
- portal->freeResult();
- params.projection(proj);
- if (proj)
- delete proj;
-
- bool hasDummy = false;
- get = "SELECT band_id, dummy FROM " + metadatatable + " WHERE geom_id=" + Te2String(geomId);
- get += " AND NOT (dummy IS NULL)";
- if (portal->query(get))
- {
- while (portal->fetchRow())
- {
- int b = portal->getInt(0);
- double d = portal->getDouble("dummy");
- params.setDummy(d,b);
- hasDummy = true;
- }
- }
- params.useDummy_ = hasDummy;
- params.mode_ = mode;
- params.objectId_ = oid;
- params.layerId_ = layerId;
- delete portal;
-
- if ( rep == TeRASTER)
- {
- params.nTilesInMemory_ = 0;
- params.database_ = this;
- TeDecoderDatabase* dec = new TeDecoderDatabase(params);
- dec->init();
- raster = new TeRaster();
- raster->setDecoder(dec);
- raster->objectId(oid);
- return raster;
- }
- try
- {
- raster = new TeRaster(params);
- }
- catch(...)
- {
- if (params.fileName_.empty() == false)
- {
- errorMessage_ = "File doesn't exist: ";
- errorMessage_ += params.fileName_;
- }
- else
- {
- errorMessage_ = "Raster file is not accessible.";
- }
- return 0;
- }
- raster->init();
- return raster;
-}
-
-bool
-TeDatabase::loadRasterLUT(TeRasterParams* par)
-{
- if (par->lutName_.empty())
- return false;
-
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- string get = "SELECT COUNT(index_id) FROM " + par->lutName_;
- if (!portal->query(get) || !portal->fetchRow()) // if there is no table, or table is empty
- {
- delete portal;
- return false;
- }
- int nentries = atoi(portal->getData(0));
- if (nentries <= 0)
- {
- delete portal;
- return false;
- }
- portal->freeResult();
-
- par->lutr_.clear();
- par->lutg_.clear();
- par->lutb_.clear();
-
- par->lutr_.resize(nentries);
- par->lutg_.resize(nentries);
- par->lutb_.resize(nentries);
-
- par->lutr_.assign(nentries,0);
- par->lutg_.assign(nentries,0);
- par->lutb_.assign(nentries,0);
-
- get = "SELECT * FROM " + par->lutName_ + " ORDER BY index_id ASC ";
- if (!portal->query(get) || !portal->fetchRow()) // if there is no table, or table is empty
- {
- delete portal;
- return false;
- }
-
- do
- {
- int index = atoi(portal->getData(0));
- par->lutr_[index] = atoi(portal->getData(1));
- par->lutg_[index] = atoi(portal->getData(2));
- par->lutb_[index] = atoi(portal->getData(3));
- }while (portal->fetchRow());
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::createSpatialIndex(const string& table, const string& columns, TeSpatialIndexType /*type*/, short /*level*/, short /*tile*/)
-{
- string idxName = "sp_idx_" + table;
- return createIndex(table, idxName, columns);
-}
-
-string TeDatabase::getSpatialIdxColumn(TeGeomRep rep)
-{
- string columns = "";
- switch(rep)
- {
- case TePOINTS:
- case TeNODES: columns = "x, y";
- break;
- case TeLINES:
- case TePOLYGONS:
- case TeCELLS:
- columns = "lower_x, lower_y, upper_x, upper_y";
- break;
- case TeRASTER:
- columns = " lower_x, lower_y, upper_x, upper_y, resolution_factor, subband ";
- break;
- default: columns = "";
- }
-
- return columns;
-}
-
-bool
-TeDatabase::loadLayer(TeLayer* layer, const bool& loadAttrList)
-{
- if (layer == 0)
- return false;
-
- string rest;
- if (layer->id() > 0)
- rest = " te_layer.layer_id = "+ Te2String(layer->id());
- else if (!layer->name().empty())
- rest = " te_layer.name = '"+ layer->name() + "'";
- else
- {
- this->errorMessage_ = "Layer procurado n�o possui nem id nem nome";
- return false;
- }
-
- string sql = " SELECT te_layer.*, "; // 0 - 8 (9 columns)
- sql += " te_projection.*, "; // 9 - 25 (17 columns)
- sql += " te_representation.*, "; // 26 - 40 (15 columns)
- sql += " te_layer_table.* "; // 41 - 52 (12 columns)
-
- sql += " FROM (((te_layer INNER JOIN te_projection ";
- sql += " ON te_layer.projection_id = te_projection.projection_id) ";
- sql += " LEFT JOIN te_representation ON ";
- sql += " te_layer.layer_id = te_representation.layer_id) ";
- sql += " LEFT JOIN te_layer_table ON ";
- sql += " te_layer.layer_id = te_layer_table.layer_id) ";
-
- sql += " WHERE "+ rest;
-
- sql += " ORDER BY te_representation.geom_type, te_layer_table.table_id ";
-
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return false;
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool hasNewRow = true;
- TeProjection* proj = 0;
- if(!portal->getProjection(&proj, 9)) //load projection
- {
- delete portal;
- return false;
- }
-
- if(!portal->getLayer(*layer, 0)) //load layer
- {
- delete portal;
- delete layer;
- return false;
- }
- if (proj != 0)
- layer->setProjection(proj);
-
- //load its representation and its tables
- bool hasRepsTablesToThisLayer = true;
- vector<int> loadedTableId;
- while(hasRepsTablesToThisLayer)
- {
- string repId = portal->getData(26);
- if(!repId.empty() && !layer->hasGeometry(TeGeomRep(portal->getInt(28))))
- {
- //load the geometry representation
- TeRepresentation* rep = new TeRepresentation();
- if(!portal->getRepresentation(*rep, 26))
- {
- delete rep;
- delete layer;
- delete portal;
- }
- layer->addVectRepres(rep);
- }
-
- //load tables
- if(find(loadedTableId.begin(), loadedTableId.end(), portal->getInt(41)) == loadedTableId.end())
- {
- TeTable attrTable;
- if(portal->getAttrTable(attrTable, 41))
- {
- TeAttributeList attrList;
- if(loadAttrList)
- getAttributeList(attrTable.name(), attrList);
- attrTable.setAttributeList(attrList);
- layer->addAttributeTable(attrTable);
- loadedTableId.push_back(attrTable.id());
- }
- }
-
- hasNewRow = portal->fetchRow();
- if(!hasNewRow || portal->getInt(0)!= layer->id())
- hasRepsTablesToThisLayer = false;
- }
- layer->setDatabase(this);
- metaModel_->layerMap()[layer->id()] = layer;
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::loadLayerTable(TeLayer* layer, const bool& loadAttrList)
-{
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- {
- this->errorMessage_ = "N�o foi poss�vel abrir portal para o banco";
- return false;
- }
-
- // Get layer tables
- string get = " SELECT * FROM te_layer_table";
- get += " WHERE layer_id = " + Te2String(layer->id());
- get += " ORDER BY attr_table_type, table_id";
-
- if (!portal->query (get))
- {
- delete portal;
- return false;
- }
-
- while (portal->fetchRow())
- {
- TeTable attTable;
- if(!portal->getAttrTable (attTable))
- {
- delete portal;
- return false;
- }
- TeAttributeList attrList;
- if(loadAttrList)
- getAttributeList(attTable.name(), attrList);
- attTable.setAttributeList(attrList);
- layer->addAttributeTable(attTable);
- }
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::layerExist(int layerId)
-{
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- string sql = "SELECT layer_id FROM te_layer WHERE layer_id = " + Te2String(layerId);
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
- if (!portal->fetchRow())
- {
- delete portal;
- return false;
- }
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::layerExist(string layerName)
-{
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- layerName = TeConvertToUpperCase(layerName);
-
- string sql = "SELECT name FROM te_layer";
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
- while (portal->fetchRow())
- {
- string name = portal->getData(0);
- name = TeConvertToUpperCase(name);
- if (layerName == name)
- {
- delete portal;
- return true;
- }
- }
- delete portal;
- return false;
-}
-
-string TeDatabase::getNewLayerName(const string& n)
-{
- bool changed;
- string invalidChar;
- string name = TeCheckName(n, changed, invalidChar);
- string newName = name;
-
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return "";
-
- bool flag = true;
- int count = 0;
- while(flag)
- {
- portal->freeResult();
- string q = "SELECT name FROM te_layer WHERE name = '" + newName + "'";
- if(portal->query(q) && portal->fetchRow())
- {
- // there is already this theme name
- newName = newName+"_"+Te2String(count);
- ++count;
- flag = true;
- }
- else
- flag = false; //found the new name
- }
- delete portal;
- return newName;
-}
-
-bool
-TeDatabase::deleteLayer(int layerId)
-{
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- string sql = "SELECT projection_id FROM te_layer WHERE layer_id = ";
- sql += Te2String(layerId);
-
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- if (!portal->fetchRow())
- {
- delete portal;
- return false;
- }
- string projId = portal->getData("projection_id");
- portal->freeResult();
-
- // Get all representations that are associated to this layer
- sql = "SELECT * FROM te_representation WHERE layer_id = "+ Te2String(layerId);
- if (!portal->query (sql))
- {
- delete portal;
- return false;
- }
-
- while (portal->fetchRow())
- {
- // Save the name of the geometry table
- string geomTable = portal->getData("geom_table");
-
- // Delete lut table
- TeGeomRep rep = TeGeomRep(portal->getInt("geom_type"));
- if (rep == TeRASTER || rep == TeRASTERFILE)
- {
- TeDatabasePortal* portal2 = this->getPortal();
- sql = "SELECT lut_table, raster_table FROM " + geomTable;
- string tabName;
- if (!portal2->query (sql))
- {
- delete portal2;
- continue;
- }
-
- while (portal2->fetchRow())
- {
- // remove lut table
- tabName = portal2->getData(0);
- if (!tabName.empty() && this->tableExist(tabName))
- {
- sql = "DROP TABLE " + tabName;
- this->execute(sql);
- }
- // remove raster table
- tabName = portal2->getData(1);
- if (!tabName.empty() && this->tableExist(tabName))
- {
- sql = "DROP TABLE " + tabName;
- this->execute(sql);
- }
- }
- delete portal2;
- // remove raster metadata table
- tabName = geomTable + "_metadata";
- if (!tabName.empty() && this->tableExist(tabName))
- {
- sql = "DROP TABLE " + tabName;
- this->execute(sql);
- }
- }
- if (this->tableExist(geomTable))
- {
- sql = "DROP TABLE " + geomTable;
- if (!this->execute(sql) )
- {
- delete portal;
- return false;
- }
- }
- }
- portal->freeResult();
-
- if (existRelation("te_representation","fk_rep_layer_id") != TeRICascadeDeletion)
- {
- // Delete entries into representations table
- sql = "DELETE FROM te_representation WHERE layer_id = " +Te2String(layerId);
- if (!this->execute(sql) )
- {
- delete portal;
- return false;
- }
- }
-
- // delete layer themes
- sql = "SELECT theme_id FROM te_theme WHERE layer_id=" + Te2String(layerId);
- if (!portal->query (sql))
- {
- delete portal;
- return false;
- }
-
- int themeId;
- while (portal->fetchRow())
- {
- themeId = portal->getInt("theme_id");
- this->deleteTheme(themeId);
- }
-
- //Delete attributes tables
- if(!deleteLayerTable(layerId))
- return false;
-
- sql = "DELETE FROM te_layer WHERE layer_id=" + Te2String(layerId);
- if (!this->execute(sql))
- {
- delete portal;
- return false;
- }
-
- // delete layer projection
- sql = "DELETE FROM te_projection WHERE projection_id = "+ projId;
- if (!this->execute(sql))
- {
- delete portal;
- return false;
- }
-
- // remove all the items� themes associated to the layer to be removed
- TeThemeMap::iterator it;
- for (it = metaModel_->themeMap().begin(); it != metaModel_->themeMap().end();)
- {
- if(it->second->getProductId() != TeTHEME)
- {
- ++it;
- continue;
- }
- TeTheme *theme = static_cast<TeTheme*> (it->second);
- ++it;
- if (theme && theme->layer() && (theme->layer()->id() == layerId))
- {
- metaModel_->themeMap().erase(theme->id());
- delete theme;
- }
- }
- // delete layer and its entry in the layer map
- TeLayer* layer = metaModel_->layerMap()[layerId];
- metaModel_->layerMap().erase(layerId);
- delete layer;
-
- delete portal;
- return true;
-}
-
-
-bool
-TeDatabase::deleteLayerTable (int layerId, TeAttrTableType ttype)
-{
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return false;
-
- //tables of the type 1 can be relationed with other layer ??? Conferir
- string query = "SELECT attr_table, table_id FROM te_layer_table WHERE layer_id = " + Te2String(layerId);
- query += " AND attr_table_type = " + Te2String(static_cast<int>(ttype));
- if(!portal->query(query))
- {
- delete portal;
- return false;
- }
-
- vector<int> tableIds;
- string attrTable;
- string tableId;
- string drop;
- while (portal->fetchRow())
- {
- attrTable = portal->getData(0);
- tableId = portal->getData(1);
- drop = "DROP TABLE " + attrTable;
- if(tableExist(attrTable))
- {
- if(!execute(drop))
- {
- delete portal;
- return false;
- }
- }
- tableIds.push_back(atoi(tableId.c_str()));
-
- string del = "DELETE FROM te_address_locator WHERE table_id = "+ tableId;
- execute(del);
- }
-
- delete portal;
- string del;
- if (existRelation("te_tables_relation","fk_tabrelation_laytable_id") != TeRICascadeDeletion)
- {
- for (unsigned int i=0; i<tableIds.size();i++)
- {
- del = "DELETE FROM te_tables_relation WHERE relation_id = " + Te2String(tableIds[i]);
- if (!execute (del))
- return false;
- }
- }
- del = "DELETE FROM te_layer_table WHERE layer_id = " + Te2String(layerId);
- if (!execute (del))
- return false;
- return true;
-}
-
-bool
-TeDatabase::updateRepresentation (int layerId, TeRepresentation& rep)
-{
- if (layerId <= 0)
- return false;
-
- string sql;
- sql = "UPDATE te_representation SET ";
- sql += " lower_x= " + Te2String(rep.box_.x1(),15);
- sql += ", lower_y= " + Te2String(rep.box_.y1(),15);
- sql += ", upper_x= " + Te2String(rep.box_.x2(),15);
- sql += ", upper_y= " + Te2String(rep.box_.y2(),15);
- sql += ", description= '" + rep.description_ + "'";
- sql += ", res_x= " + Te2String(rep.resX_,15);
- sql += ", res_y= " + Te2String(rep.resY_,15);
- sql += ", num_cols=" + Te2String(rep.nCols_);
- sql += ", num_rows=" + Te2String(rep.nLins_);
-
- if (rep.geomRep_ != TeTEXT)
- sql += ", geom_table='" + rep.tableName_ + "'";
-
- sql += " WHERE layer_id=" + Te2String(layerId);
- sql += " AND geom_type= " + Te2String(rep.geomRep_);
-
- if (rep.geomRep_ == TeTEXT)
- sql += " AND geom_table='" + rep.tableName_ + "'";
-
- return this->execute(sql);
-}
-
-bool
-TeDatabase::insertRasterGeometry(const string& tableName, TeRasterParams& par, const string& objectId)
-{
- if (tableName.empty())
- return false;
-
- string objId;
- if (objectId.empty())
- objId = "O1";
- else
- objId = objectId;
-
- //------ this check is made for compatibility reasons with old versions of TerraLib databases
- TeAttributeRep attrRep;
- attrRep.name_ = "tiling_type";
- attrRep.type_ = TeINT;
-
- TeAttribute att;
- if(!columnExist(tableName, attrRep.name_,att))
- {
- addColumn (tableName, attrRep);
- string sql = "UPDATE " + tableName + " SET tiling_type = " + Te2String(static_cast<int>(TeRasterParams::TeExpansible));
- this->execute(sql);
- }
- //------
-
- // finds the name of the raster geometry table
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return false;
-
- TeBox box = par.boundingBox();
-
- string ins = "INSERT INTO " + tableName + " (object_id, raster_table, lut_table, ";
- ins += "res_x, res_y, num_bands, num_cols, num_rows, block_height, block_width, ";
- ins += "lower_x, lower_y, upper_x, upper_y, tiling_type) ";
- ins += " VALUES ('" + objId + "', '" + par.fileName_+ "', '" + par.lutName_ + "', ";
- ins += Te2String(par.resx_) + ", " + Te2String(par.resy_) + ", ";
- ins += Te2String(par.nBands()) + ", " + Te2String(par.ncols_) + ", " + Te2String(par.nlines_) + ", ";
- ins += Te2String(par.blockHeight_) + ", " + Te2String(par.blockWidth_) + ", ";
- ins += Te2String(box.x1_,15) +", " + Te2String(box.y1_,15) + ", ";
- ins += Te2String(box.x2_,15) +", " + Te2String(box.y2_,15) + ", ";
- ins += Te2String(par.tiling_type_) + ")";
- if (!this->execute(ins))
- {
- delete portal;
- return false;
- }
-
- // save the pallete associated to the raster
- // if it doesn�t exist yet
- if (par.photometric_[0] == TeRasterParams::TePallete && !par.lutName_.empty())
- {
- if (!this->tableExist(par.lutName_))
- {
- if (this->createLUTTable(par.lutName_))
- {
- for (unsigned int i=0; i<par.lutb_.size(); i++)
- {
- string sql = "INSERT INTO " + par.lutName_ + " VALUES(";
- sql += Te2String(i) + ", ";
- sql += Te2String(par.lutr_[i]) + ", ";
- sql += Te2String(par.lutg_[i]) + ", ";
- sql += Te2String(par.lutb_[i]) + ")";
- this->execute(sql);
- }
- }
- }
- }
-
- ins = "SELECT geom_id FROM " + tableName + " WHERE object_id='" + objId + "'";
- ins += " AND raster_table='" + par.fileName_+ "'";
- if(!portal->query(ins) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- int geomId = atoi(portal->getData(0));
- delete portal;
- string metadataTableName = tableName+"_metadata";
- insertRasterMetadata(metadataTableName, geomId,par);
- return true;
-}
-
-bool
-TeDatabase::updateRasterRepresentation(int layerId, TeRasterParams& par, const string& objectId)
-{
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return false;
-
- string sql = "SELECT repres_id, lower_x, lower_y, upper_x, upper_y, geom_table ";
- sql += " FROM te_representation WHERE layer_id= " + Te2String(layerId);
- sql += " AND geom_type= " + Te2String(TeRASTER);
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- TeBox box (portal->getDouble(1),portal->getDouble(2),
- portal->getDouble(3),portal->getDouble(4));
- int represId = atoi(portal->getData(0));
- string rasterrep = portal->getData(5);
- portal->freeResult();
-
- updateBox(box,par.boundingBox());
- sql = "UPDATE te_representation SET lower_x = " + Te2String(box.x1_,15);
- sql += ", lower_y = " + Te2String(box.y1_,15) + ", upper_x = " + Te2String(box.x2_,15);
- sql += ", upper_y = " + Te2String(box.y2_,15) + " WHERE repres_id=" + Te2String(represId);
-
- if(!execute(sql))
- {
- delete portal;
- return false;
- }
-
- string objId;
- if (objectId.empty())
- objId = "O1";
- else
- objId = objectId;
-
- box = par.boundingBox();
-
- sql = "UPDATE " + rasterrep + " SET lut_table ='" + par.lutName_ + "'";
- sql += ", res_x= " + Te2String(par.resx_) + ", res_y=" + Te2String(par.resy_);
- sql += ", num_bands=" + Te2String(par.nBands()) + ", num_cols=" + Te2String(par.ncols_);
- sql += ", num_rows=" + Te2String(par.nlines_) + ", block_height=" + Te2String(par.blockHeight_);
- sql += ", block_width= " + Te2String(par.blockWidth_) + ", lower_x = " + Te2String(box.x1_,15);
- sql += ", lower_y = " + Te2String(box.y1_,15) + ", upper_x = " + Te2String(box.x2_,15);
- sql += ", upper_y = " + Te2String(box.y2_,15);
- sql += " WHERE object_id='" + objId + "' AND raster_table='" + par.fileName_ + "'";
- if (!this->execute(sql))
- {
- delete portal;
- return false;
- }
-
- sql = "SELECT geom_id FROM " + rasterrep + " WHERE object_id='" + objId + "'";
- sql+= " AND raster_table='" + par.fileName_+ "'";
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- // save the pallete associated to the raster
- // if it doesn�t exist yet
- if (par.photometric_[0] == TeRasterParams::TePallete && !par.lutName_.empty())
- {
-
- if (!this->tableExist(par.lutName_))
- {
- if (this->createLUTTable(par.lutName_))
- {
- for (unsigned int i=0; i<par.lutb_.size(); i++)
- {
- string sql = "INSERT INTO " + par.lutName_ + " VALUES(";
- sql += Te2String(i) + ", ";
- sql += Te2String(par.lutr_[i]) + ", ";
- sql += Te2String(par.lutg_[i]) + ", ";
- sql += Te2String(par.lutb_[i]) + ")";
- if (!this->execute(sql) )
- {
- delete portal;
- return false;
- }
- }
- }
- }
- }
-
- int geomId = atoi(portal->getData(0));
- delete portal;
- string metadatatabel = rasterrep + "_metadata";
- return updateRasterMetadata(metadatatabel,geomId,par);
-}
-
-bool
-TeDatabase::insertRasterMetadata (const string& tableName, int geomId, TeRasterParams& par)
-{
- if (geomId <= 0)
- return false;
-
- string ins;
- unsigned int i;
-
- unsigned int nb = par.nBands();
- ins = "INSERT INTO " + tableName + " (geom_id, band_id, min_value, max_value, ";
- ins += " num_bits, data_type, photometric_type, compression_type ) VALUES (";
- string vals;
- for (i=0; i<nb; i++)
- {
- vals = Te2String(geomId) + ", " + Te2String(i) + ", ";
- vals += Te2String(par.vmin_[i]) + ", " + Te2String(par.vmax_[i]) + ", ";
- vals += Te2String(par.nbitsperPixel_[i]) + ", " + Te2String(par.dataType_[i]) + ", " ;
- vals += Te2String(par.photometric_[i]) + ", " + Te2String(par.compression_[i]) + " )" ;
- string sql = ins + vals;
- if (!this->execute(sql))
- return false;
- }
-
- // update dummy value
- if (par.useDummy_)
- {
- ins = "UPDATE " + tableName + " SET dummy = ";
- for (i=0; i<nb; i++)
- {
- vals = Te2String(par.dummy_[i]) + " WHERE geom_id = " + Te2String(geomId);
- vals += " AND band_id=" + Te2String(i);
- string sql = ins + vals;
- if (!this->execute(sql))
- return false;
- }
- }
- return true;
-}
-
-bool
-TeDatabase::updateRasterMetadata (const string& tableName, int geomId, TeRasterParams& par)
-{
- if (geomId <= 0)
- return false;
-
- string sql = "DELETE FROM " + tableName + " WHERE geom_id = " + Te2String(geomId);
- if (!this->execute (sql))
- return false;
- return insertRasterMetadata(tableName,geomId,par);
-}
-
-bool
-TeDatabase::updateLegend (TeLegendEntry *legend)
-{
- if (!legend)
- return false;
-
- string sql;
- if (legend->id() > 0 )
- {
- sql = "UPDATE te_legend SET ";
- sql += " theme_id=" + Te2String (legend->theme());
- sql += ",group_id=" + Te2String (legend->group());
- sql += ",num_objs=" + Te2String (legend->count());
- sql += ",lower_value='" + escapeSequence(legend->from())+"'";
- sql += ",upper_value='" + escapeSequence(legend->to())+"'";
- sql += ",label='" + escapeSequence(legend->label())+"'";
- sql += " WHERE legend_id=" + Te2String (legend->id());
-
- if (execute(sql) == false)
- return false;
- }
- else
- {
- if (!insertLegend(legend))
- return false;
- }
- metaModel_->legendMap()[legend->id()] = legend;
-
- return updateVisual(legend);
-}
-
-bool
-TeDatabase::updateLegend (vector<TeLegendEntry>& legVec)
-{
- unsigned int i;
- for (i = 0; i < legVec.size(); ++i)
- {
- if(!updateLegend(&legVec[i]))
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::updateVisual(TeLegendEntry *legend)
-{
- if (!legend)
- return false;
-
- TeGeomRepVisualMap& mapVis = legend->getVisualMap();
- TeGeomRepVisualMap::iterator it = mapVis.begin();
- while ( it != mapVis.end())
- {
-
- TeGeomRep rep = it->first;
- TeVisual* vis = it->second;
-
- TeColor cor = vis->color(); // filling color
- TeColor contourCor = vis->contourColor();// contour color
-
- string update = "UPDATE te_visual SET ";
- update += "red = "+ Te2String(cor.red_) + ", ";
- update += "green =" + Te2String(cor.green_) + ", ";
- update += "blue =" + Te2String(cor.blue_) + ", ";
- update += "transparency =" + Te2String(vis->transparency()) + ", ";
- update += "contour_red=" + Te2String(contourCor.red_) + ", ";
- update += "contour_green=" + Te2String(contourCor.green_) + ", ";
- update += "contour_blue=" + Te2String(contourCor.blue_) + ", ";
- update += "contour_transp=" + Te2String(vis->contourTransparency()) + ", ";
- update += "contour_width=" + Te2String(vis->contourWidth()) + ", ";
-
- if(rep == TePOLYGONS)
- {
- update += "width=" + Te2String(vis->contourWidth()) + ", ";
- update += "contour_symb_id=" + Te2String(vis->contourStyle()) + ", ";
- update += "symb_id=" + Te2String(vis->style()) + ", ";
- }
- else if(rep == TeLINES)
- {
- update += "width=" + Te2String(vis->width()) + ", ";
- update += "symb_id=" + Te2String(vis->style()) + ", ";
- }
- else if(rep == TePOINTS)
- {
- update += "size_value=" + Te2String(vis->size()) + ", ";
- update += "symb_id=" + Te2String(vis->style ()) + ", ";
- }
- else if(rep == TeTEXT)
- {
- update += "size_value=" + Te2String(vis->size()) + ", ";
- update += "pt_angle=" + Te2String(vis->ptAngle()) + ", ";
- }
-
- update += "family='" + vis->family() + "', ";
- if (vis->bold())
- update += "bold=1, ";
- else
- update += "bold=0, ";
-
- if (vis->italic())
- update += "italic=1, ";
- else
- update += "italic=0, ";
-
- update += "fixed_size=" + Te2String(vis->fixedSize())+ ", ";
- update += "alignment_vert=" + Te2String(vis->alignmentVert())+ ", ";
- update += "alignment_horiz=" + Te2String(vis->alignmentHoriz())+ ", ";
- update += "tab_size=" + Te2String(vis->tabSize())+ ", ";
- update += "line_space=" + Te2String(vis->lineSpace());
-
- update += " WHERE legend_id= " + Te2String(legend->id()) ;
- update += " AND geom_type= " + Te2String(rep);
-
- if (!execute(update))
- return false;
- ++it;
- }
- return true;
-}
-
-bool
-TeDatabase::updateVisual(vector<TeLegendEntry>& legVec)
-{
- unsigned int i;
-
- // Update the te_visual table
- TeTable visualTable;
- selectTable("te_visual", "1=0", visualTable);
- TeAttributeList& visualAttrList = visualTable.attributeList();
- TeAttribute& visualAttr0 = visualAttrList[0]; // legend_id
- visualAttr0.rep_.isPrimaryKey_ = true;
- visualAttr0.rep_.isAutoNumber_ = false;
- TeAttribute& visualAttr1 = visualAttrList[1]; // geom_type
- visualAttr1.rep_.isPrimaryKey_ = true;
- visualAttr1.rep_.isAutoNumber_ = false;
-
- TeGeomRepVisualMap::iterator it;
- for (i = 0; i < legVec.size(); ++i)
- {
- TeLegendEntry& leg = legVec[i];
- for (it = leg.getVisualMap().begin(); it != leg.getVisualMap().end(); ++it)
- {
- string style, contourStyle, sizeValue, width;
- int geomRep = it->first;
- int legId = leg.id();
- TeVisual* visual = it->second;
- TeTableRow row;
-
- if(geomRep == TePOLYGONS || geomRep == TeCELLS)
- {
- sizeValue = Te2String(0);
- contourStyle = Te2String(visual->contourStyle());
- width = Te2String(0);
- style = Te2String(it->second->style());
- }
- else if(geomRep == TeLINES)
- {
- sizeValue = Te2String(0);
- contourStyle = Te2String(0);
- width = Te2String(visual->width());
- style = Te2String(visual->style());
- }
- else if(geomRep == TePOINTS)
- {
- sizeValue = Te2String(visual->size());
- contourStyle = Te2String(0);
- width = Te2String(0);
- style = Te2String(visual->style());
- }
- else if(geomRep == TeTEXT)
- {
- sizeValue = Te2String(visual->size());
- contourStyle = Te2String(0);
- width = Te2String(0);
- style = Te2String(0);
- }
-
- row.push_back(Te2String(legId)); // legend_id
- row.push_back(Te2String(geomRep)); // geom_type
- row.push_back(style); // symb_id
- row.push_back(Te2String(visual->color().red_)); // red
- row.push_back(Te2String(visual->color().green_)); // green
- row.push_back(Te2String(visual->color().blue_)); // blue
- row.push_back(Te2String(visual->transparency())); // transparency
- row.push_back(width); // width
- row.push_back(contourStyle); // contour_symb_id
- row.push_back(Te2String(visual->contourColor().red_)); // contour_red
- row.push_back(Te2String(visual->contourColor().green_)); // contour_green
- row.push_back(Te2String(visual->contourColor().blue_)); // contour_blue
- row.push_back(Te2String(visual->contourTransparency())); // contour_transp
- row.push_back(Te2String(visual->contourWidth())); // contour_width
- row.push_back(sizeValue); // size_value
- row.push_back(Te2String(visual->ptAngle())); // pt_angle
- row.push_back(visual->family()); // family
- if (visual->bold()) // bold
- row.push_back("1");
- else
- row.push_back("0");
- if (visual->italic()) // italic
- row.push_back("1");
- else
- row.push_back("0");
-
- row.push_back(Te2String(visual->alignmentVert())); // alignment_vert
- row.push_back(Te2String(visual->alignmentHoriz())); // alignment_horiz
- row.push_back(Te2String(visual->tabSize())); // tab_size
- row.push_back(Te2String(visual->lineSpace())); // line_space
-
- if (visual->fixedSize()) // fixed_size
- row.push_back("1");
- else
- row.push_back("0");
-
- visualTable.add(row);
- }
- }
- return insertTable(visualTable);
-}
-
-bool
-TeDatabase::loadLegend (TeAbstractTheme *theme, const string& visualType)
-{
- if (!theme)
- return false;
-
- theme->cleanLegend();
-
- string rest;
- if (theme->id() > 0)
- rest = " te_theme.theme_id = "+ Te2String(theme->id());
- else if (!theme->name().empty())
- rest = " te_theme.name = '"+ theme->name() + "'";
- else
- return false;
-
- //load legend and visual
- string sql = " SELECT ";
- sql += " te_legend.*, "; // 0 - 6 (7 columns)
- sql += " te_visual.* "; // 7 (24 columns)
- sql += " FROM ((te_theme LEFT JOIN te_legend ON te_theme.theme_id = te_legend.theme_id ) ";
- sql += " LEFT JOIN te_visual ON te_legend.legend_id = te_visual.legend_id ) ";
- sql += " WHERE "+ rest;
- sql += " ORDER BY te_legend.legend_id, te_legend.group_id, te_visual.geom_type ";
-
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- if (!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- //load all legends of this theme
- //and its visual
- bool hasLegsToThisTheme = true;
- bool hasNewRow = true;
- while(hasLegsToThisTheme)
- {
- //legend
- TeLegendEntry legend;
- if(!portal->getLegend(legend, 0))
- {
- delete portal;
- return false;
- }
-
- //visual
- bool hasVisualToThisLeg = true;
- while(hasVisualToThisLeg)
- {
- TeVisual* visual = TeVisualFactory::make(visualType);
- TeGeomRep geomRep;
- if(portal->getVisual(visual, geomRep, 7))
- legend.setVisual(visual, geomRep);
-
- hasNewRow = portal->fetchRow();
- if(!hasNewRow || portal->getInt(2)!= legend.group() || portal->getInt(0)!= legend.id())
- hasVisualToThisLeg = false;
- }
-
- //Set legend to this theme
- theme->legend(legend);
-
- //fill legend buffer
- if(legend.group() == -6)
- metaModel_->legendMap()[legend.id()] = &theme->queryAndPointingLegend();
- else if(legend.group() == -5)
- metaModel_->legendMap()[legend.id()] = &theme->queryLegend();
- else if (legend.group() == -4)
- metaModel_->legendMap()[legend.id()] = &theme->pointingLegend();
- else if (legend.group() == -3)
- metaModel_->legendMap()[legend.id()] = &theme->defaultLegend();
- else if (legend.group() == -2)
- metaModel_->legendMap()[legend.id()] = &theme->withoutDataConnectionLegend();
- else if (legend.group() == -1)
- metaModel_->legendMap()[legend.id()] = &theme->outOfCollectionLegend();
- else if (legend.group() == -10) //own legend
- {
- TeLegendEntry* legendTemp = new TeLegendEntry(legend);
- metaModel_->legendMap()[legend.id()] = legendTemp;
- }
-
- if(!hasNewRow || portal->getInt(0)!= theme->id())
- hasLegsToThisTheme = false;
- }
-
- for (unsigned int i = 0; i < theme->legend().size(); ++i)
- metaModel_->legendMap()[theme->legend()[i].id()] = &theme->legend()[i];
-
- delete portal;
- return true;
-}
-
-
-bool
-TeDatabase::updateProjection (TeProjection *proj)
-{
- if (proj->id() <= 0)
- return false;
- string sql;
- sql = "UPDATE te_projection SET ";
- sql += "name='" + proj->name() + "',";
- sql += " long0=" + Te2String(proj->params().lon0*TeCRD,15)+ ",";
- sql += " lat0=" + Te2String(proj->params().lat0*TeCRD,15) + ",";
- sql += " offx=" +Te2String(proj->params().offx,15) + ",";
- sql += " offy=" +Te2String(proj->params().offy,15) + ",";
- sql += " stlat1="+ Te2String(proj->params().stlat1*TeCRD,15) + ",";
- sql += " stlat2=" +Te2String(proj->params().stlat2*TeCRD,15) + ",";
- sql += " unit='" + proj->params().units + "',";
- sql += " scale=" + Te2String(proj->params().scale) + ",";
- sql += " hemis=" + Te2String(proj->params().hemisphere) + ",";
- sql += " datum='" + proj->datum().name() + "',";
- sql += " radius=" + Te2String(proj->datum().radius(),15) + ",";
- sql += " flattening=" + Te2String(proj->datum().flattening(),15) + ",";
- sql += " dx=" + Te2String(proj->datum().xShift(),15) + ",";
- sql += " dy=" + Te2String(proj->datum().yShift(),15) + ",";
- sql += " dz=" + Te2String(proj->datum().zShift(),15) ;
- sql += " WHERE projection_id = " + Te2String(proj->id());
- return this->execute(sql);
-}
-
-TeProjection*
-TeDatabase::loadProjection (int projId)
-{
- TeDatabasePortal* portal = this->getPortal();
-
- string sql ="SELECT * FROM te_projection WHERE projection_id = " + Te2String (projId);
-
- if (!portal->query(sql))
- {
- delete portal;
- return 0;
- }
-
- // Look for the projection
- if (!portal->fetchRow())
- {
- delete portal;
- return 0;
- }
-
- TeProjection* proj = 0;
- if(!portal->getProjection(&proj))
- {
- if(proj)
- delete proj;
- delete portal;
- return 0;
- }
-
- delete portal;
- return proj;
-}
-
-bool
-TeDatabase::insertPolygonSet(const string& table, TePolygonSet &ps)
-{
- if (!beginTransaction())
- return false;
- for (unsigned int i = 0; i < ps.size(); i++ )
- {
- TePolygon& poly = ps [i];
- if (!insertPolygon (table,poly))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::updatePolygonSet (const string& table, TePolygonSet &ps)
-{
- if (!beginTransaction())
- return false;
- for (unsigned int i = 0; i < ps.size(); i++ )
- {
- TePolygon& poly = ps [i];
- if (!updatePolygon (table,poly))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::selectPolygonSet (const string& table, const string& criteria, TePolygonSet &ps)
-{
- TeDatabasePortal *portal = this->getPortal();
- string sql ="SELECT * FROM " + table;
- if (!criteria.empty())
- sql += " WHERE " + criteria;
- sql += " ORDER BY object_id ASC, parent_id, num_holes DESC, ext_max ASC";
-
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
- if (!portal->fetchRow())
- {
- delete portal;
- return false;
- }
- bool flag = true;
- do
- {
- TePolygon poly;
- flag = portal->fetchGeometry(poly);
- ps.add(poly);
- }
- while (flag);
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::loadPointSet(TeTheme* theme, TePointSet &ps)
-{
- string collTable = theme->collectionTable();
- if (collTable.empty())
- return false;
-
- TeLayer* themeLayer = theme->layer();
- if (!themeLayer->hasGeometry(TePOINTS))
- return false;
-
- string pointTable = themeLayer->tableName(TePOINTS);
- if (pointTable.empty())
- return false;
-
- string sql = "SELECT * FROM (" + pointTable + " RIGHT JOIN " + collTable;
- sql = sql + " ON " + pointTable + ".object_id = " + collTable + ".object_id)";
-
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return false;
-
- if (!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do {
- TePoint pt;
- flag = portal->fetchGeometry(pt);
- ps.add(pt);
- }
- while (flag);
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::loadLineSet(TeTheme* theme, TeLineSet &ls)
-{
- string collTable = theme->collectionTable();
- if (collTable.empty())
- return false;
-
- TeLayer* themeLayer = theme->layer();
- if (!themeLayer->hasGeometry(TeLINES))
- return false;
-
- string lineTable = themeLayer->tableName(TeLINES);
- if (lineTable.empty())
- return false;
-
- string sql = "SELECT * FROM (" + lineTable + " RIGHT JOIN " + collTable;
- sql = sql + " ON " + lineTable + ".object_id = " + collTable + ".object_id)";
-
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return false;
-
- if (!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag;
- do
- {
- TeLine2D lin;
- flag = portal->fetchGeometry(lin);
- ls.add(lin);
- }while(flag);
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::loadPolygonSet (const string& table, const string& geoid, TePolygonSet &ps)
-{
- TeDatabasePortal *portal = this->getPortal();
- string q ="SELECT * FROM " + table;
-
- if (!geoid.empty())
- q += " WHERE object_id = '" + geoid +"'";
- q += " ORDER BY parent_id, num_holes DESC, ext_max ASC";
-
- if (!portal->query(q))
- {
- delete portal;
- return false;
- }
-
- if (!portal->fetchRow())
- {
- delete portal;
- return false;
- }
- bool flag = true;
- do
- {
- TePolygon poly;
- flag = portal->fetchGeometry(poly);
- ps.add(poly);
- }
- while (flag);
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::loadPolygonSet (const string& table, TeBox &bb, TePolygonSet &polSet)
-{
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return false;
-
- string q;
- q = "SELECT * FROM " + table + " WHERE ";
- q += this->getSQLBoxWhere (bb, TePOLYGONS);
- q += " ORDER BY parent_id, num_holes DESC, ext_max ASC";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- bool flag = true;
- do
- {
- TePolygon poly;
- flag = portal->fetchGeometry(poly);
- polSet.add(poly);
- }
- while (flag);
- delete portal;
- return true;
-}
-
-TeDatabasePortal*
-TeDatabase::loadPolygonSet(const string& table, TeBox &box)
-{
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return 0;
-
- string q;
- q = "SELECT * FROM " + table + " WHERE ";
- q += this->getSQLBoxWhere (box, TePOLYGONS);
- q += " ORDER BY parent_id, num_holes DESC, ext_max ASC";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return 0;
- }
- else
- return portal;
-}
-
-
-bool
-TeDatabase::locatePolygon (const string& table, TeCoord2D &pt, TePolygon &polygon, const double& tol)
-{
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return false;
-
- TeBox box (pt.x()-tol,pt.y()-tol,pt.x()+tol,pt.y()+tol);
-
- string q;
- q = "SELECT * FROM " + table + " WHERE lower_x < " + Te2String(box.x2(),15);
- q += " AND upper_x > " + Te2String(box.x1(),15);
- q += " AND lower_y < " + Te2String(box.y2(),15);
- q += " AND upper_y > " + Te2String(box.y1(),15);
- q += " ORDER BY parent_id, num_holes DESC, ext_max ASC";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TePolygon poly;
- flag = portal->fetchGeometry(poly);
- if (TeWithin (TePoint(pt), poly))
- {
- polygon = poly;
- delete portal;
- return true;
- }
- }
- while (flag);
- delete portal;
- return false;
-}
-
-
-bool
-TeDatabase::locatePolygonSet (const string& table, TeCoord2D &pt, double tol, TePolygonSet &polygons)
-{
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return false;
-
- TeBox box (pt.x()-tol,pt.y()-tol,pt.x()+tol,pt.y()+tol);
-
- string q;
- q = "SELECT * FROM " + table + " WHERE lower_x < " + Te2String(box.x2(),6);
- q += " AND upper_x > " + Te2String(box.x1(),6);
- q += " AND lower_y < " + Te2String(box.y2(),6);
- q += " AND upper_y > " + Te2String(box.y1(),6);
- q += " ORDER BY parent_id, num_holes DESC, ext_max ASC";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- bool flag = true;
- polygons.clear();
- do
- {
- TePolygon poly;
- flag = portal->fetchGeometry(poly);
- if (TeWithin (TePoint(pt), poly))
- polygons.add(poly);
- }
- while (flag);
- delete portal;
-
- if(polygons.size())
- return (true);
- return false;
-}
-
-bool
-TeDatabase::loadPolygonSet(TeTheme* theme, TePolygonSet &ps)
-{
- string collTable = theme->collectionTable();
- if (collTable.empty())
- return false;
-
- TeLayer* themeLayer = theme->layer();
- if (!themeLayer->hasGeometry(TePOLYGONS))
- return false;
-
- string polygonTable = themeLayer->tableName(TePOLYGONS);
- if (polygonTable.empty())
- return false;
-
- string sql = "SELECT * FROM (" + polygonTable + " RIGHT JOIN " + collTable;
- sql = sql + " ON " + polygonTable + ".object_id = " + collTable + ".object_id)";
- sql += " ORDER BY " + polygonTable + ".parent_id, ";
- sql += polygonTable + ".num_holes DESC, " + polygonTable + ".ext_max ASC";
-
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return false;
-
- if (!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TePolygon poly;
- flag = portal->fetchGeometry(poly);
- ps.add ( poly );
- }
- while (flag);
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::insertLineSet (const string& table, TeLineSet &ls)
-{
- if (!beginTransaction())
- return false;
-
- for (unsigned int i = 0; i < ls.size(); i++ )
- {
- TeLine2D& line = ls [i];
- if (!insertLine (table,line))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::updateLineSet (const string& table, TeLineSet &ls)
-{
- if (!beginTransaction())
- return false;
-
- for (unsigned int i = 0; i < ls.size(); i++ )
- {
- TeLine2D line = ls [i];
- if (!updateLine (table,line))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::loadLineSet (const string& table, const string& geoid, TeLineSet &ls)
-{
- TeDatabasePortal *portal = this->getPortal();
-
- string q ="SELECT * FROM " + table;
-
- if (!geoid.empty())
- q += " WHERE object_id = '" + geoid +"'";
-
- q += " ORDER BY ext_max DESC";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TeLine2D line;
- flag = portal->fetchGeometry(line);
- ls.add ( line );
- }while(flag);
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::loadLineSet (const string& table, TeBox &bb, TeLineSet &linSet)
-{
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return false;
-
- string q;
- q = "SELECT * FROM " + table + " WHERE ";
- q += this->getSQLBoxWhere (bb, TeLINES);
- q += " ORDER BY ext_max DESC";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- bool flag = true;
- do
- {
- TeLine2D lin;
- flag = portal->fetchGeometry(lin);
- linSet.add(lin);
- }
- while (flag);
- delete portal;
- return true;
-}
-
-TeDatabasePortal*
-TeDatabase::loadLineSet (const string& table, TeBox &box)
-{
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return 0;
-
- string q;
- q = "SELECT * FROM " + table + " WHERE ";
- q += this->getSQLBoxWhere (box, TeLINES);
- q += " ORDER BY ext_max DESC";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return 0;
- }
- return portal;
-}
-
-bool
-TeDatabase::selectLineSet (const string& table, const string& criteria, TeLineSet &ls)
-{
- TeDatabasePortal *portal = this->getPortal();
- string q ="SELECT * FROM " + table;
- if (!criteria.empty())
- q += " WHERE " + criteria;
- q += " ORDER BY object_id ASC, geom_id ASC";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TeLine2D line;
- flag = portal->fetchGeometry(line);
- ls.add ( line );
- }while(flag);
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::locateLine (const string& table, TeCoord2D &pt, TeLine2D &line, const double& tol)
-{
- TeDatabasePortal* portal = this->getPortal();
-
- TeBox box (pt.x()-tol,pt.y()-tol,pt.x()+tol,pt.y()+tol);
- string q ="SELECT * FROM " + table;
- char buf [1024];
- sprintf (buf," WHERE lower_x < %f AND upper_x > %f AND lower_y < %f AND upper_y > %f",
- box.x2(),box.x1(),box.y2(),box.y1());
- q += buf;
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- // Get all lines
- TeLineSet ls;
- int k;
- bool flag = true;
- do
- {
- TeLine2D l;
- flag = portal->fetchGeometry( l );
- ls.add ( l );
- } while (flag);
-
- delete portal;
-
- TeCoord2D paux;
-
- if (TeNearest (pt, ls, k, paux, tol))
- {
- line = ls[k];
- return true;
- }
- return false;
-}
-
-bool
-TeDatabase::insertPointSet (const string& table, TePointSet &ps)
-{
- if (!beginTransaction())
- return false;
-
- for (unsigned int i = 0; i < ps.size(); i++ )
- {
- TePoint& point = ps [i];
- if (!insertPoint (table,point))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::updatePointSet (const string& table, TePointSet &ps)
-{
- if (!beginTransaction())
- return false;
-
- for (unsigned int i = 0; i < ps.size(); i++ )
- {
- TePoint point = ps [i];
- if (!updatePoint (table,point))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::loadPointSet (const string& table, const string& geoid, TePointSet &ps)
-{
- TeDatabasePortal* portal = this->getPortal();
- string q ="SELECT * FROM " + table;
-
- if (!geoid.empty())
- q += " WHERE object_id = '" + geoid +"'";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TePoint point;
- flag = portal->fetchGeometry (point);
- ps.add ( point );
- }while (flag);
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::loadPointSet (const string& table, TeBox &bb, TePointSet &ps)
-{
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return false;
-
- string q;
- q = "SELECT * FROM " + table + " WHERE ";
- q += this->getSQLBoxWhere (bb, TePOINTS);
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- bool flag = true;
- do
- {
- TePoint pt;
- flag = portal->fetchGeometry(pt);
- ps.add(pt);
- }
- while (flag);
- delete portal;
- return true;
-}
-
-TeDatabasePortal*
-TeDatabase::loadPointSet(const string& table, TeBox &box)
-{
- TeDatabasePortal *portal = this->getPortal();
- if (!portal)
- return 0;
-
- string q;
- q = "SELECT * FROM " + table + " WHERE ";
- q += this->getSQLBoxWhere (box, TePOINTS);
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return 0;
- }
- return portal;
-}
-
-bool
-TeDatabase::selectPointSet (const string& table, const string& criteria, TePointSet &ps)
-{
- TeDatabasePortal* portal = this->getPortal();
- string q ="SELECT * FROM " + table;
- if (!criteria.empty())
- q += " WHERE " + criteria;
- q += " ORDER BY object_id ASC, geom_id ASC";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TePoint point;
- flag = portal->fetchGeometry (point);
- ps.add ( point );
- }while (flag);
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::locatePoint (const string& table, TeCoord2D &pt, TePoint &point, const double& tol)
-{
- TeDatabasePortal* portal = this->getPortal();
-
- TeBox box (pt.x()-tol,pt.y()-tol,pt.x()+tol,pt.y()+tol);
- string q ="SELECT * FROM " + table;
- char buf [1024];
- sprintf (buf," WHERE x < %f AND x > %f AND y < %f AND y > %f",
- box.x2(),box.x1(),box.y2(),box.y1());
- q += buf;
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- TePointSet ps;
- bool flag = true;
- do
- {
- TePoint point;
- flag = portal->fetchGeometry (point);
- ps.add ( point );
- }while (flag);
-
- delete portal;
- int k;
- if (TeNearest (pt, ps, k, tol))
- {
- point = ps[k];
- return true;
- }
- return false;
-}
-
-bool
-TeDatabase::insertTextSet (const string& table, TeTextSet &ts)
-{
- if (!beginTransaction())
- return false;
-
- for (unsigned int i = 0; i < ts.size(); i++ )
- {
- TeText& text = ts [i];
- if (!insertText (table,text))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::updateTextSet (const string& table, TeTextSet &ts)
-{
- if (!beginTransaction())
- return false;
- for ( unsigned int i = 0; i < ts.size(); i++ )
- {
- TeText text = ts [i];
- if (!updateText (table,text))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::loadTextSet (const string& table, const string& geoid, TeTextSet &ts)
-{
- TeDatabasePortal *portal = this->getPortal();
-
- string q ="SELECT * FROM " + table;
- if (!geoid.empty())
- q += " WHERE object_id = '" + geoid +"'";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- // Look for all texts
- bool flag = true;
- do
- {
- TeText p;
- flag = portal->fetchGeometry(p);
- ts.add ( p );
- } while (flag);
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::selectTextSet (const string& table, const string& criteria, TeTextSet &ts)
-{
- TeDatabasePortal* portal = this->getPortal();
- string q ="SELECT * FROM " + table;
- if (!criteria.empty())
- q += " WHERE " + criteria;
- q += " ORDER BY object_id ASC, geom_id ASC";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- // Look for all texts
- bool flag = true;
- do
- {
- TeText p;
- flag = portal->fetchGeometry(p);
- ts.add ( p );
- } while (flag);
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::updateText(const string& table, TeText &t)
-{
- string sql;
- sql = "UPDATE " + table + " SET ";
- sql += "x=" + Te2String(t.location().x(),15) + ", ";
- sql += "y=" + Te2String(t.location().y(),15) + ", ";
- sql += "text_value='" + t.textValue() + "', ";
- sql += "angle=" + Te2String(t.angle(),15) + ", ";
- sql += "height=" + Te2String(t.height(),15) + ",";
- sql += "alignment_vert=" + Te2String(t.alignmentVert(),15) + ",";
- sql += "alignment_horiz=" + Te2String(t.alignmentHoriz(),15);
- sql += " WHERE geom_id=" + Te2String(t.geomId());
- return (this->execute(sql));
-}
-
-bool
-TeDatabase::updateNode(const string& table, TeNode &node)
-{
- string sql;
- sql = "UPDATE " + table + " SET ";
- sql += "x=" + Te2String(node.location().x(),15) + ", ";
- sql += "y=" + Te2String(node.location().y(),15);
- sql += " WHERE geom_id = " + Te2String(node.geomId());
- return (this->execute(sql));
-}
-
-bool
-TeDatabase::updatePoint(const string& table, TePoint &p)
-{
- string sql;
- sql = "UPDATE " + table + " SET ";
- sql += "x=" + Te2String(p.location().x(),15) + ", ";
- sql += "y=" + Te2String(p.location().y(),15);
- sql += " WHERE geom_id = " + Te2String(p.geomId());
- return (this->execute(sql));
-}
-
-bool TeDatabase::locateText (const string& table, TeCoord2D &pt, TeText &text, const double& tol)
-{
- TeDatabasePortal* portal = this->getPortal();
-
- TeBox box (pt.x()-tol,pt.y()-tol,pt.x()+tol,pt.y()+tol);
- string q ="SELECT * FROM " + table;
- char buf [1024];
- sprintf (buf," WHERE x < %f AND x > %f AND y < %f AND y > %f",
- box.x2(),box.x1(),box.y2(),box.y1());
- q += buf;
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- // Look for all texts
- bool flag = true;
- TeTextSet ts;
- do
- {
- TeText p;
- flag = portal->fetchGeometry(p);
- ts.add ( p );
- } while (flag);
-
- delete portal;
-
- int k;
- if (TeNearest (pt, ts, k, tol))
- {
- text = ts[k];
- return true;
- }
- return false;
-}
-
-bool
-TeDatabase::insertArcSet (const string& table, TeArcSet &as)
-{
- if (!beginTransaction())
- return false;
-
- for (unsigned int i = 0; i < as.size(); i++ )
- {
- TeArc& arc = as [i];
- if (!insertArc (table,arc))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::updateArcSet (const string& table, TeArcSet &as)
-{
- if (!beginTransaction())
- return false;
-
- for ( unsigned int i = 0; i < as.size(); i++ )
- {
- TeArc arc = as [i];
- if (!updateArc (table,arc))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::loadArcSet (const string& table, const string& geoid, TeArcSet &as)
-{
-
- TeDatabasePortal* portal = this->getPortal();
- string q ="SELECT * FROM " + table;
- if (!geoid.empty())
- q += " WHERE object_id = " + geoid;
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- // Look for all nodes
- bool flag;
- do
- {
- TeArc arc;
- flag = portal->fetchGeometry(arc);
- as.add (arc);
- } while (flag);
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::updateArc(const string& table, TeArc &arc)
-{
- string sql;
- sql = "UPDATE"+ table +" SET ";
- sql += "from_node=" + Te2String(arc.fromNode().geomId()) + ", ";
- sql += "to_node=" + Te2String(arc.toNode().geomId());
- sql += " WHERE geom_id = " + Te2String(arc.geomId());
- return (this->execute(sql));
-}
-
-bool
-TeDatabase::insertNodeSet (const string& table, TeNodeSet &ns)
-{
- if (!beginTransaction())
- return false;
-
- for (unsigned int i = 0; i < ns.size(); i++ )
- {
- TeNode& no = ns [i];
- if (!insertNode (table,no))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::updateNodeSet (const string& table, TeNodeSet &ns)
-{
- if (!beginTransaction())
- return false;
-
- for (unsigned int i = 0; i < ns.size(); i++ )
- {
- TeNode no = ns [i];
- if (!updateNode (table,no))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::loadNodeSet (const string& table, const string& geoid, TeNodeSet &ns)
-{
- TeDatabasePortal* portal = this->getPortal();
- string q ="SELECT * FROM " + table;
- if (!geoid.empty())
- q += " WHERE object_id = " + geoid;
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TeNode n;
- flag = portal->fetchGeometry(n);
- ns.add ( n );
- }while (flag);
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::insertCellSet (const string& table, TeCellSet &cs)
-{
- if (!beginTransaction())
- return false;
-
- for (unsigned int i = 0; i < cs.size(); i++ )
- {
- TeCell& cell = cs [i];
- if (!insertCell (table,cell))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::updateCellSet (const string& table, TeCellSet &cs)
-{
- if (!beginTransaction())
- return false;
-
- for (unsigned int i = 0; i < cs.size(); i++ )
- {
- TeCell cell = cs [i];
- if (!updateCell (table,cell))
- {
- rollbackTransaction();
- return false;
- }
- }
- if (!commitTransaction())
- {
- rollbackTransaction();
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::loadCellSet (const int& layerId, const string& table, const string& geoid, TeCellSet &cs)
-{
-
- TeDatabasePortal *portal = this->getPortal();
-
- // Get the cell set resolution
- string q = "SELECT * FROM te_representation WHERE layer_id = " + Te2String(layerId);
- q += " AND geom_type = " + Te2String(TeCELLS);
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- cs.resX(portal->getDouble("res_x"));
- cs.resY(portal->getDouble("res_y"));
-
- portal->freeResult();
-
- q = "SELECT * FROM " + table;
- if (!geoid.empty())
- q += " WHERE object_id = '" + geoid +"'";
- q += " ";
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag;
- do
- {
- TeCell cell;
- flag = portal->fetchGeometry(cell);
- cs.add ( cell );
- } while (flag);
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::selectCellSet (const int& layerId, const string& table, const string& criteria, TeCellSet &cs)
-{
- TeDatabasePortal* portal = this->getPortal();
- string q = "SELECT * FROM te_representation WHERE layer_id = " ;
- q += Te2String(layerId) + " AND geom_type = " + Te2String(TeCELLS);
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- cs.resX(portal->getDouble("res_x"));
- cs.resY(portal->getDouble("res_y"));
- portal->freeResult();
-
- q ="SELECT * FROM " + table;
- if (!criteria.empty())
- q += " WHERE " + criteria;
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag;
- do
- {
- TeCell cell;
- flag = portal->fetchGeometry(cell);
- cs.add ( cell );
- } while (flag);
-
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::updateCell(const string& table, TeCell &c)
-{
- TeBox b = c.box();
-
- string sql;
- sql = "UPDATE "+ table +" SET ";
- sql += "lower_x=" + Te2String(b.lowerLeft().x(),15) + ", ";
- sql += "lower_y=" + Te2String(b.lowerLeft().y(),15) + ", ";
- sql += "upper_x=" + Te2String(b.upperRight().x(),15) + ", ";
- sql += "upper_y=" + Te2String(b.upperRight().y(),15) + ", ";
- sql += "col_number=" + Te2String(c.column()) + ", ";
- sql += "row_number=" + Te2String(c.line());
- sql += " WHERE geom_id = " + Te2String(c.geomId());
- return (this->execute(sql));
-}
-
-bool
-TeDatabase::locateCell (const string& table, TeCoord2D &pt, TeCell &cell, const double& /* tol */)
-{
- TeDatabasePortal* portal = this->getPortal();
- string q ="SELECT * FROM " + table;
- char buf [1024];
- sprintf (buf," WHERE lower_x < %f AND upper_x > %f AND lower_y < %f AND upper_y > %f",
- pt.x(),pt.x(),pt.y(),pt.y());
- q += buf;
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- portal->fetchGeometry(cell);
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::inClauseValues(const string& query, const string& /* attribute */, vector<string>& inClauseVector)
-{
- inClauseVector.push_back( "(" + query + ")" );
- return true;
-}
-
-//Spatial query
-//retornam um portal
-
-bool
-TeDatabase::spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, TeDatabasePortal *portal, int relate, const string& actCollTable)
-{
- return (TeTopologicalRelation(actGeomTable, actRep, actIdsIn, portal, relate, actCollTable));
-}
-
-bool
-TeDatabase::spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, const string& visGeomTable, TeGeomRep visRep, TeDatabasePortal *portal, int relate, const string& visCollTable)
-{
- return (TeTopologicalRelation(actGeomTable, actRep, actIdsIn, visGeomTable, visRep, portal, relate, visCollTable));
-}
-
-bool
-TeDatabase::spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeGeometry* geom, TeDatabasePortal *portal, int relate, const string& actCollTable)
-{
- return (TeTopologicalRelation(actGeomTable, actRep, geom, portal, relate, actCollTable));
-}
-
-//retornam um vetor de object_ids resultantes da consulta
-bool
-TeDatabase::spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, TeKeys& actIdsOut, int relate, const string& actCollTable)
-{
- return (TeTopologicalRelation(actGeomTable, actRep, actIdsIn, actIdsOut, this, relate, actCollTable));
-}
-
-bool
-TeDatabase::spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, const string& visGeomTable, TeGeomRep visRep, TeKeys& visIdsOut, int relate, const string& visCollTable, TeDatabase* dbVis)
-{
- return (TeTopologicalRelation(actGeomTable, actRep, actIdsIn, visGeomTable, visRep, visIdsOut, this, relate, visCollTable, dbVis));
-}
-
-bool
-TeDatabase::spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeGeometry* geom, TeKeys& actIdsOut, int relate, const string& actCollTable)
-{
- return (TeTopologicalRelation(actGeomTable, actRep, geom, actIdsOut, this, relate, actCollTable));
-}
-
-//metric functions
-bool
-TeDatabase::calculateArea(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, double &area)
-{
- return (TeGetArea(actGeomTable, actRep, actIdsIn, this, area));
-}
-
-bool
-TeDatabase::calculateLength(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn , double& length )
-{
- return (TeGetLength(actGeomTable, actRep, actIdsIn, this, length));
-}
-
-bool
-TeDatabase::calculateDistance(const string& actGeomTable, TeGeomRep actRep, TeKeys& Ids, double& distance)
-{
- return (TeGetDistance(actGeomTable, actRep, Ids, this, distance));
-}
-
-bool
-TeDatabase::calculateDistance(const string& /* actGeomTable */, TeGeomRep /*actRep */, const string& /* objId1 */, const string& /* visGeomTable */, TeGeomRep /* visRep */, const string& /* objId2 */, double& /* distance */)
-{
- return false;
-}
-
-bool
-TeDatabase::withinDistance(const string& actGeomTable, TeGeomRep actRep, const TeCoord2D& coord, TeKeysToDist& IdsDistOut, const double& max_distance, const string& actCollTable)
-{
- return (TeGetWithinDistance(actGeomTable, actRep, coord, IdsDistOut, this, max_distance, actCollTable));
-}
-
-// functions that generate new geometry
-bool
-TeDatabase::buffer(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TePolygonSet& bufferSet, double dist)
-{
- return (TeGetBuffer(actGeomTable, actRep, actIds, this, bufferSet, dist));
-}
-
-bool
-TeDatabase::centroid(const string& actGeomTable , TeGeomRep actRep, TePointSet& centroidSet, TeKeys actIds, const string& actCollTable)
-{
- return (TeGetCentroid(actGeomTable, actRep, this, centroidSet, actIds, actCollTable));
-}
-
-bool
-TeDatabase::convexHull(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TePolygonSet& convexHullSet)
-{
- return (TeGetConvexHull(actGeomTable, actRep, actIds, this, convexHullSet));
-}
-
-bool
-TeDatabase::nearestNeighbors(const string& /* actGeomTable */, const string& /* actCollTable */, TeGeomRep /* actRep */, const string& /* objId1 */, TeKeys& /* actIdsOut */, int /* numRes */)
-{
- return false;
-}
-
-bool
-TeDatabase::nearestNeighbors(const string& /* actGeomTable */, TeGeomRep /* actRep */, const string& /* objId1 */, const string& /* visGeomTable */, const string& /* visCollTable */, TeGeomRep /* visRep */, TeKeys& /* visIdsOut */, int /* numRes */)
-{
- return false;
-}
-
-bool
-TeDatabase::nearestNeighbors(const string& /* actGeomTable */, const string& /* actCollTable */, TeGeomRep /* actRep */, const string& /* objId1 */, TeDatabasePortal* /* portal */, int /* numRes */)
-{
- return false;
-}
-
-bool
-TeDatabase::nearestNeighbors(const string& /* actGeomTable */, TeGeomRep /* actRep */, const string& /* objId1 */, const string& /* visGeomTable */, const string& /* visCollTable */, TeGeomRep /* visRep */, TeDatabasePortal* /* portal */, int /* numRes */)
-{
- return false;
-}
-
-bool
-TeDatabase::geomIntersection(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TeGeometryVect& geomVect)
-{
- return (TeGetOverlay(actGeomTable, actRep, actIds, this, geomVect, TeINTERSECTION));
-}
-
-bool
-TeDatabase::geomIntersection(const string& /* actGeomTable */, TeGeomRep /* actRep */, const string& /* objId1 */, const string& /* visGeomTable */, TeGeomRep /* visRep */, const string& /* objId2 */, TeGeometryVect& /* geomVect */)
-{
- return false;
-}
-
-bool
-TeDatabase::geomDifference(const string& actGeomTable, TeGeomRep actRep, const string& objId1, const string& objId2, TeGeometryVect& geomVect)
-{
- TeKeys actIds;
- actIds.push_back(objId1);
- actIds.push_back(objId2);
-
- return (TeGetOverlay(actGeomTable, actRep, actIds, this, geomVect, TeDIFFERENCE));
-
-}
-
-bool
-TeDatabase::geomDifference(const string& /* actGeomTable */, TeGeomRep /* actRep */, const string& /* objId1 */, const string& /* visGeomTable */, TeGeomRep /* visRep */, const string& /* objId2 */, TeGeometryVect& /* geomVect */)
-{
- return false;
-}
-
-bool
-TeDatabase::geomUnion(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TeGeometryVect& geomVect)
-{
- return (TeGetOverlay(actGeomTable, actRep, actIds, this, geomVect, TeUNION));
-}
-
-bool
-TeDatabase::geomUnion(const string& /* actGeomTable */, TeGeomRep /* actRep */, const string& /* objId1 */, const string& /* visGeomTable */, TeGeomRep /* visRep */, const string& /* objId2 */, TeGeometryVect& /* geomVect */)
-{
- return false;
-}
-
-bool
-TeDatabase::geomXOr(const string& /* actGeomTable */, TeGeomRep /* actRep */, const string& /* objId1 */, const string& /* objId2 */, TeGeometryVect& /* geomVect */)
-{
- return false;
-}
-
-bool
-TeDatabase::geomXOr(const string& /* actGeomTable */, TeGeomRep /* actRep */, const string& /* objId1 */, const string& /* visGeomTable */, TeGeomRep /* visRep */, const string& /* objId2 */, TeGeometryVect& /* geomVect */)
-{
- return false;
-}
-
-// Operation with Image
-
-bool
-TeDatabase::zonal(const string& rasterTable, const string& actGeomTable, TeKeys& Ids, TeObjectStatistics& result)
-{
- TeDatabasePortal* portal=getPortal();
- if (!portal)
- return false;
-
- //recuperar o raster!!!
- string sql = "SELECT layer_id FROM te_representation";
- sql += " WHERE geom_table = '" + rasterTable +"'";
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- int layerId = atoi(portal->getData(0));
- TeRaster* raster = loadLayerRaster(layerId);
-
- //recuperar as geometrias
- portal->freeResult();
-
- string objIds = getStringIds(Ids);
- sql = "SELECT * FROM "+ actGeomTable;
- sql+= " WHERE object_id IN ("+ objIds +")";
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TePolygon poly;
- flag = portal->fetchGeometry(poly);
-
- TeStatisticsDimensionVect st;
-
- TeRaster::iteratorPoly itBegin = raster->begin(poly, TeBoxPixelIn);
- TeRaster::iteratorPoly itEnd = raster->end(poly, TeBoxPixelIn);
-
- if(!TeCalculateStatistics (itBegin, itEnd, st))
- {
- delete portal;
- return false;
- }
-
- result[poly.objectId()] = st;
-
- }while (flag);
-
-
- delete raster;
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::zonal(const string& rasterTable, const string& actGeomTable, const string& actCollTable, TeObjectStatistics& result)
-{
- TeDatabasePortal* portal=getPortal();
- if (!portal)
- return false;
-
- //recuperar o raster
- string sql = "SELECT layer_id FROM te_representation";
- sql += " WHERE geom_table = '" + rasterTable +"'";
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- int layerId = atoi(portal->getData(0));
- TeRaster* raster = loadLayerRaster(layerId);
-
- //recuperar as geometrias
- portal->freeResult();
-
- sql = "SELECT * FROM "+ actGeomTable;
-
- if(!actCollTable.empty())
- {
- sql += " ,"+ actCollTable;
- sql += " WHERE object_id = c_object_id ";
- }
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TePolygon poly;
- flag = portal->fetchGeometry(poly);
-
- TeStatisticsDimensionVect st;
-
- TeRaster::iteratorPoly itBegin = raster->begin(poly, TeBoxPixelIn);
- TeRaster::iteratorPoly itEnd = raster->end(poly, TeBoxPixelIn);
-
- if(!TeCalculateStatistics (itBegin, itEnd, st))
- {
- delete portal;
- return false;
- }
- result[poly.objectId()] = st;
-
- }while (flag);
-
-
- delete raster;
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::zonal(const string& rasterTable, TePolygon& poly, TeStatisticsDimensionVect& result)
-{
- TeDatabasePortal* portal=getPortal();
- if (!portal)
- return false;
-
- //recuperar o raster!!!
- string sql = "SELECT layer_id FROM te_representation";
- sql += " WHERE geom_table = '" + rasterTable +"'";
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- int layerId = atoi(portal->getData(0));
- TeRaster* raster = loadLayerRaster(layerId);
-
- delete portal;
-
- TeRaster::iteratorPoly itBegin = raster->begin(poly, TeBoxPixelIn);
- TeRaster::iteratorPoly itEnd = raster->end(poly, TeBoxPixelIn);
-
- if(!TeCalculateStatistics (itBegin, itEnd, result))
- return false;
-
- delete raster;
- return true;
-}
-
-
-bool
-TeDatabase::mask(const string& rasterTable, const string& actGeomTable, const string& objId, const string& nameLayerOut, TeStrategicIterator st)
-{
- TeDatabasePortal* portal=getPortal();
- if (!portal)
- return false;
-
- //recuperar o raster!!!
- string sql = "SELECT layer_id FROM te_representation";
- sql += " WHERE geom_table = '" + rasterTable +"'";
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- int layerId = atoi(portal->getData(0));
- TeRaster* raster = loadLayerRaster(layerId);
-
- //recuperar a geometria
- portal->freeResult();
-
- sql = "SELECT * FROM "+ actGeomTable;
- sql+= " WHERE object_id = '" + objId + "'";
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- TePolygon poly;
- portal->fetchGeometry(poly);
- delete portal;
-
- TeRaster* rasterOut = TeMask (raster, poly, st);
- if(!rasterOut)
- return false;
-
- TeLayer* res = TeImportRaster(nameLayerOut, rasterOut, this);
- delete raster;
- delete rasterOut;
- return (res != 0);
-}
-
-
-
-bool
-TeDatabase::mask(const string& rasterTable, TePolygon& poly, const string& nameLayerOut, TeStrategicIterator st)
-{
- TeDatabasePortal* portal=getPortal();
- if (!portal)
- return false;
-
- string sql = "SELECT layer_id FROM te_representation";
- sql += " WHERE geom_table = '" + rasterTable +"'";
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- TeRaster* raster = loadLayerRaster(atoi(portal->getData(0)));
- delete portal;
-
- TeRaster* rasterOut = TeMask (raster, poly, st);
- if(!rasterOut)
- return false;
-
- TeLayer* res = TeImportRaster(nameLayerOut, rasterOut, this);
- delete raster;
- delete rasterOut;
- return (res != 0);
-}
-
-
-string
-TeDatabase::getSQLBoxWhere (TeBox &box, TeGeomRep rep)
-{
- string wherebox;
- string lowerX, lowerY, upperX, upperY;
- if(rep == TePOLYGONS || rep == TeLINES || rep == TeCELLS || rep == TeRASTER || rep == TeRASTERFILE)
- {
- lowerX = "lower_x";
- lowerY = "lower_y";
- upperX = "upper_x";
- upperY = "upper_y";
- }
- else if(rep == TePOINTS || rep == TeTEXT)
- {
- lowerX = "x";
- lowerY = "y";
- upperX = "x";
- upperY = "y";
- }
- wherebox = "NOT("+ lowerX +" > " + Te2String(box.x2_, 12) + " OR ";
- wherebox += upperX +" < " + Te2String(box.x1_, 12) + " OR ";
- wherebox += lowerY +" > " + Te2String(box.y2_, 12) + " OR ";
- wherebox += upperY +" < " + Te2String(box.y1_, 12) + ")";
- return wherebox;
-}
-
-
-string
-TeDatabase::getSQLBoxWhere (const string& table1, const string& table2, TeGeomRep rep2, TeGeomRep /* rep1 */)
-{
- string wherebox;
-
- if(rep2 == TePOLYGONS || rep2 == TeLINES || rep2 == TeCELLS || rep2 == TeRASTER || rep2 == TeRASTERFILE)
- {
- wherebox = " NOT( ";
- wherebox += table2 +".lower_x > "+ table1 +".upper_x OR ";
- wherebox += table2 +".upper_x < "+ table1 +".lower_x OR ";
- wherebox += table2 +".lower_y > "+ table1 +".upper_y OR ";
- wherebox += table2 +".upper_y < "+ table1 +".lower_y )";
- }
- else if(rep2 == TePOINTS || rep2 == TeTEXT)
- {
- wherebox = " NOT( ";
- wherebox += table2 +".x > "+ table1 +".upper_x OR ";
- wherebox += table2 +".x < "+ table1 +".lower_x OR ";
- wherebox += table2 +".y > "+ table1 +".upper_y OR ";
- wherebox += table2 +".y < "+ table1 +".lower_y )";
- }
-
- return wherebox;
-}
-
-
-string
-TeDatabase::getSQLBoxSelect (const string& tableName, TeGeomRep /* rep */)
-{
- string sql = tableName +".* ";
- return sql;
-}
-
-
-string
-TeDatabase::getSQLStatistics (TeGroupingAttr& attrs)
-{
- string sql = "";
- string virg = "";
-
- TeGroupingAttr::iterator it = attrs.begin();
- int count = 0;
- while(it != attrs.end())
- {
- if(count>0)
- virg = ",";
-
- switch ((*it).second)
- {
- case TeSUM:
- sql += virg +" SUM( "+ (*it).first.name_ +") AS SUM_"+ Te2String(count);
- (*it).second = TeNOSTATISTIC;
- ++count;
- break;
- case TeMAXVALUE:
- sql += virg +" MAX( "+ (*it).first.name_ +") AS MAX_"+ Te2String(count);
- (*it).second = TeNOSTATISTIC;
- ++count;
- break;
- case TeMINVALUE:
- sql += virg +" MIN( "+ (*it).first.name_ +") AS MIN_"+ Te2String(count);
- (*it).second = TeNOSTATISTIC;
- ++count;
- break;
- case TeCOUNT:
- sql += virg +" COUNT( "+ (*it).first.name_ +") AS COUNT_"+ Te2String(count);
- (*it).second = TeNOSTATISTIC;
- ++count;
- break;
- case TeMEAN:
- sql += virg +" AVG( "+ (*it).first.name_ +") AS AVG_"+ Te2String(count);
- (*it).second = TeNOSTATISTIC;
- ++count;
- break;
- default:
- break;
- }
- ++it;
- }
- return sql;
-}
-
-string
-TeDatabase::getSQLAutoNumber(const string& /* table */)
-{
- return "";
-}
-
-string
-TeDatabase::getSQLTemporalWhere (TeTimeInterval& timeInterval, TeTemporalRelation timeOperator, const string& initialTime, const string& finalTime)
-{
- string sql;
- string t1 = getSQLTime(timeInterval.getT1());
- string t2 = getSQLTime(timeInterval.getT2());
-
- switch(timeOperator)
- {
- case TeTIMEBEFORE:
- sql = finalTime +" < "+ t1;
- break;
- case TeTIMEAFTER:
- sql = initialTime +" > "+ t2;
- break;
- case TeTIMEEQUAL:
- sql = "( "+ initialTime +" >= "+ t1;
- sql += " AND "+ initialTime +" <= "+ t2 +" )";
- if (initialTime != finalTime)
- {
- sql += " AND ";
- sql += "( "+ finalTime +" >= "+ t1;
- sql += " AND "+ finalTime +" <= "+ t2 +" )";
- }
- break;
-
- case TeTIMEMEETS:
- sql = finalTime +" = "+ t1;
- sql += " OR "+ initialTime +" = "+ t2;
- break;
-
- case TeTIMEDURING:
- sql = initialTime +" >= "+ t1;
- sql += " AND "+ initialTime +" <= "+ t2;
- if (initialTime != finalTime)
- {
- sql += " AND "+ finalTime +" >= "+ t1;
- sql += " AND "+ finalTime +" <= "+ t2;
- }
- break;
-
- case TeTIMEOVERLAPS:
- sql = "( "+ initialTime +" < "+ t1;
- sql += " AND "+ finalTime +" > "+ t1;
- sql += " AND "+ finalTime +" < "+ t2 +" )";
- sql += " OR ";
- sql += "( "+ initialTime +" > "+ t1;
- sql += " AND "+ initialTime +" < "+ t2;
- sql += " AND "+ finalTime +" > "+ t2 +" )";
- break;
-
- case TeTIMEENDS:
- sql = finalTime +" = "+ t2;
- break;
-
- case TeTIMESTARTS:
- sql = initialTime +" = "+ t1;
- break;
-
- default:
- break;
- }
-
- return sql;
-}
-
-string
-TeDatabase::getSQLTemporalWhere(int time1, int time2, TeChronon chr, TeTemporalRelation rel,
- const string& initialTime, const string& finalTime)
-{
- //rever os chronons definidos - alterar o parser para restri��o temporal
- string func, sql;
- switch(chr)
- {
- case TeSECONDOFMINUTE:
- func = " second";
- break;
-
- case TeMINUTEOFHOUR:
- func = " minute";
- break;
-
- case TeHOUROFDAY:
- func = " hour";
- break;
-
- case TeDAYOFMONTH:
- func = " day";
- break;
-
- case TeDAYOFWEEK:
- func = " weekday";
- break;
-
- case TeMONTHOFYEAR:
- func = " month";
- break;
-
- case TeYEAR:
- func = " year";
- break;
-
- default:
- return "";
- }
-
- switch(rel)
- {
- case TeTIMEBEFORE:
- sql = func +"("+ finalTime +") < "+ Te2String(time1);
- break;
-
- case TeTIMEAFTER:
- sql = func +"("+ initialTime +") > "+ Te2String(time2);
- break;
-
- case TeTIMEEQUAL:
- sql = func +"("+ initialTime +") = "+ Te2String(time1);
- sql += " AND "+ func +"(" + finalTime +") = "+ Te2String(time2);
- break;
-
- case TeTIMEMEETS:
- sql = func +"("+ finalTime +") = "+ Te2String(time1);
- sql += " OR "+ func +"(" + initialTime +") = "+ Te2String(time2);
- break;
-
- case TeTIMEDURING:
- sql = func +"("+ initialTime +") >= "+ Te2String(time1);
- sql += " AND "+ func +"("+ initialTime +") <= "+ Te2String(time2);
- sql += " AND "+ func +"("+ finalTime +") >= "+ Te2String(time1);
- sql += " AND "+ func +"("+ finalTime +") <= "+ Te2String(time2);
- break;
-
- case TeTIMEOVERLAPS:
- sql = "("+ func +"("+ initialTime +") <= "+ Te2String(time1);
- sql += " AND "+ func +"("+ finalTime +") >= "+ Te2String(time1);
- sql += " AND "+ func +"("+ finalTime +") <= "+ Te2String(time2) +")";
- sql += " OR ";
- sql += "("+ func +"("+ initialTime +") >= "+ Te2String(time1);
- sql += " AND "+ func +"("+ initialTime +") <= "+ Te2String(time2);
- sql += " AND "+ func +"("+ finalTime +") >= "+ Te2String(time2) +")";
- break;
-
- case TeTIMEENDS:
- sql = func +"("+ finalTime +") = "+ Te2String(time2);
- break;
-
- case TeTIMESTARTS:
- sql = func +"("+ initialTime +") = "+ Te2String(time1);
-
- default:
- break;
- }
-
- return sql;
-}
-
-string
-TeDatabase::getSQLTemporalWhere (const string& temporalRest)
-{
- string result, tableName, initialCol, finalCol, time1, time2, mask;
- TeTemporalRelation rel = TeTIMEUNDEFINED;
- TeChronon chronon = TeNOCHRONON;
-
- string temp = temporalRest;
- bool flag = true;
- int cont = 0;
-
- while(flag)
- {
- string element;
- int pos = temp.find (";");
- if(pos<0)
- {
- flag = false;
- element = temp;
- }
- else
- {
- element = temp.substr(0, pos);
- temp = temp.substr (pos+1);
- }
-
- if(cont==0) //table name
- tableName = element;
- else if(cont==1) //column name (initial time)
- initialCol = element;
- else if(cont==2) //column name (final time)
- finalCol = element;
- else if(cont==3) //TeTemporalRelation
- {
- if(element=="TeTIMEEQUAL")
- rel = TeTIMEEQUAL;
- else if (element=="TeTIMEBEFORE")
- rel = TeTIMEBEFORE;
- else if (element=="TeTIMEAFTER")
- rel = TeTIMEAFTER;
- else if (element=="TeTIMEMEETS")
- rel = TeTIMEMEETS;
- else if (element=="TeTIMEDURING")
- rel = TeTIMEDURING;
- else if (element=="TeTIMEOVERLAPS")
- rel = TeTIMEOVERLAPS;
- else if (element=="TeTIMEENDS")
- rel = TeTIMEENDS;
- else if (element=="TeTIMESTARTS")
- rel = TeTIMESTARTS;
- }
- else if(cont==4) //time 1
- time1 = element;
- else if(cont==5) //time 2
- {
- if(element.empty())
- time1 = time2;
- else
- time2 = element;
- }
- else if(cont==6)
- mask = element;
- else if(cont==7) //TeChronon
- {
- if (element=="TeSECOND")
- chronon = TeSECOND;
- else if (element=="TeMINUTE")
- chronon = TeMINUTE;
- else if (element=="TeHOUR")
- chronon = TeHOUR;
- else if (element=="TeDAY")
- chronon = TeDAY;
- else if (element=="TeMONTH")
- chronon = TeMONTH;
- else if (element=="TeYEAR")
- chronon = TeYEAR;
- else if (element=="TeDAYOFWEEK")
- chronon = TeDAYOFWEEK;
- else if (element=="TeMONTHOFYEAR")
- chronon = TeMONTHOFYEAR;
- else if (element=="TeSEASON")
- chronon = TeSEASON;
- else if (element=="TeWEEKOFYEAR")
- chronon = TeWEEKOFYEAR;
- }
-
- ++cont;
- }
-
- int posMask = mask.find ("s");
- if(posMask<0)
- {
- result = " "+ getSQLTemporalWhere(atoi(time1.c_str()), atoi(time2.c_str()), chronon, rel, (tableName+"."+initialCol), (tableName+"."+finalCol)) +" ";
- }
- else
- {
- TeTimeInterval interval(time1, time2, chronon, mask);
- result = " "+ getSQLTemporalWhere(interval, rel, (tableName+"."+initialCol), (tableName+"."+finalCol)) + " ";
- }
-
- return result;
-}
-
-
-string
-TeDatabase::getSQLTemporalFunction (TeChronon chr, const string& colName)
-{
- string func;
- switch(chr)
- {
- case TeYEAR:
- func = " year ("+ colName +")";
- break;
-
- case TeMONTH: // Fev/2003 != Fev/2004
- func = " year ("+ colName +"), month ("+ colName +") ";
- break;
-
- case TeMONTHOFYEAR: // Fev/2003 == Fev/2004
- func = " month ("+ colName +")";
- break;
-
- case TeDAY: // 01/01/2003 != 01/01/2004 != 01/02/2004
- func = " year ("+ colName +"), month ("+ colName +"), day("+ colName +") ";
- break;
-
- case TeDAYOFMONTH: // 01/01/2003 == 01/01/2004 == 01/02/2004
- func = " day("+ colName +") ";
- break;
-
- case TeDAYOFYEAR: // 01/01/2003 == 01/01/2004 != 01/02/2004
- func = " month ("+ colName +"), day("+ colName +") ";
- break;
-
- case TeDAYOFWEEK: // 01/01/2003 != 01/01/2004 != 01/02/2004
- func = " weekday ("+ colName +") ";
- break;
-
- case TeHOUR: // 01/01/2003 10:00 != 01/01/2004 10:00 != 01/02/2004 10:00
- func = " year ("+ colName +"), month ("+ colName +"), day("+ colName +"), hour("+ colName +") ";
- break;
-
- case TeHOUROFDAY: // 01/01/2003 10:00 == 01/01/2004 10:00 == 01/02/2004 10:00
- func = " hour ("+ colName +")";
- break;
-
- case TeMINUTE: // 01/01/2003 10:30 != 01/01/2004 10:30 != 01/02/2004 10:30
- func = " year ("+ colName +"), month ("+ colName +"), day("+ colName +"), hour("+ colName +"), minute("+ colName +") ";
- break;
-
- case TeMINUTEOFHOUR: // 01/01/2003 10:30 == 01/01/2004 10:30 == 01/02/2004 10:30 != 01/02/2004 10:31
- func = " minute("+ colName +") ";
- break;
-
- case TeSECOND: // 01/01/2003 10:30:04 != 01/01/2004 10:30:04 != 01/02/2004 10:30:04
- func = " year ("+ colName +"), month ("+ colName +"), day("+ colName +"), hour("+ colName +"), minute("+ colName +"), second("+ colName +") ";
- break;
-
- case TeSECONDOFMINUTE: // 01/01/2003 10:30:04 == 01/01/2004 10:30:04 == 01/02/2004 10:30:04 != 01/02/2004 10:30:07
- func = " second("+ colName +") ";
- break;
-
- default:
- return "";
- }
-
- return func;
-}
-
-
-bool
-TeDatabase::getMBRGeom(string tableGeom, string object_id, TeBox& box, string /* colGeom */)
-{
- double xmin = TeMAXFLOAT;
- double xmax = -TeMAXFLOAT;
- double ymin = TeMAXFLOAT;
- double ymax = -TeMAXFLOAT;
-
- TeDatabasePortal* portal = getPortal();
- if(!portal)
- return false;
-
- string sel = "SELECT lower_x, upper_x, lower_y, upper_y FROM " + tableGeom;
- sel += " WHERE object_id = '" + object_id + "'";
-
- if(!portal->query(sel))
- {
- delete portal;
- return false;
- }
-
- bool b = portal->fetchRow();
- if(!b)
- {
- delete portal;
- return false;
- }
-
- while(b)
- {
- xmin = MIN(xmin, portal->getDouble(0));
- xmax = MAX(xmax, portal->getDouble(1));
- ymin = MIN(ymin, portal->getDouble(2));
- ymax = MAX(ymax, portal->getDouble(3));
- b = portal->fetchRow();
- }
-
- TeBox bb(xmin, ymin, xmax, ymax);
- box = bb;
- delete portal;
- return true;
-}
-
-bool
-TeDatabase::getMBRSelectedObjects(string /* geomTable */,string /* colGeom */, string fromClause, string whereClause, string afterWhereClause, TeGeomRep repType,TeBox &bout, const double& tol)
-{
- string fields;
- string query;
- bool status = false;
-
- TeBox box;
- bout = box;
-
- TeDatabasePortal* portal = this->getPortal();
-
- switch(repType)
- {
- case TePOLYGONS:
- case TeLINES:
- case TeCELLS:
- fields = "MIN(lower_x), MIN(lower_y), MAX(upper_x), MAX(upper_y)";
- query = " SELECT " + fields;
- query += " FROM " + fromClause;
- if (!whereClause.empty())
- query += " WHERE " + whereClause;
- if (!afterWhereClause.empty())
- query += afterWhereClause;
-
- if (portal->query (query))
- {
- bool b = portal->fetchRow();
- while(b)
- {
- string vxmin = portal->getData(0);
- string vymin = portal->getData(1);
- string vxmax = portal->getData(2);
- string vymax = portal->getData(3);
- if(vxmin.empty() || vymin.empty() || vxmax.empty() || vymax.empty())
- {
- b = portal->fetchRow();
- continue;
- }
- double xmin = atof(vxmin.c_str());
- double ymin = atof(vymin.c_str());
- double xmax = atof(vxmax.c_str());
- double ymax = atof(vymax.c_str());
- TeBox ibox(xmin, ymin, xmax, ymax);
- updateBox (bout, ibox);
- b = portal->fetchRow();
- status = true;
- }
- }
- break;
-
- case TePOINTS:
- case TeTEXT:
- fields = "MIN(x), MIN(y), MAX(x), MAX(y)";
- query = " SELECT " + fields;
- query += " FROM " + fromClause;
- if (!whereClause.empty())
- query += " WHERE " + whereClause;
- if (!afterWhereClause.empty())
- query += afterWhereClause;
-
- if (portal->query (query))
- {
- bool b = portal->fetchRow();
- while(b)
- {
- string vxmin = portal->getData(0);
- string vymin = portal->getData(1);
- string vxmax = portal->getData(2);
- string vymax = portal->getData(3);
- if(vxmin.empty() || vymin.empty() || vxmax.empty() || vymax.empty())
- {
- b = portal->fetchRow();
- continue;
- }
- double xmin = atof(vxmin.c_str());
- double ymin = atof(vymin.c_str());
- double xmax = atof(vxmax.c_str());
- double ymax = atof(vymax.c_str());
-
- TeBox ibox;
- if (xmin == xmax) {
- ibox.x1_ = xmin - tol;
- ibox.x2_ = xmax + tol;
- }
- else{
- ibox.x1_ = xmin;
- ibox.x2_ = xmax;
- }
- if (ymin == ymax) {
- ibox.y1_ = ymin - tol;
- ibox.y2_ = ymax + tol;
- }
- else {
- ibox.y1_ = ymin;
- ibox.y2_ = ymax;
- }
- updateBox (bout, ibox);
- b = portal->fetchRow();
- status = true;
- }
- }
- break;
-
-
- default:
- status = false;
- break;
- }
- delete portal;
- return status;
-}
-
-bool
-TeDatabase::getAttributeList(const string& tableName,TeAttributeList& attList)
-{
- TeDatabasePortal* portal = this->getPortal();
- if (!portal)
- return false;
-
- string sql = "SELECT * FROM " + tableName + " WHERE 1=2";
- if (!portal->query(sql))
- {
- delete portal;
- return false;
- }
- else
- attList = portal->getAttributeList();
- delete portal;
- return true;
-}
-
-
-bool TeDatabase::insertRasterVisual (int themeId , TeRasterVisual* vis)
-{
- TeRasterTransform::TeRasterTransfFunctions tf = vis->getTransfFunction();
-
- if (tf == TeRasterTransform::TeNoTransf)
- return true;
-
- string sql = "DELETE FROM te_visual_raster WHERE theme_id = " + Te2String(themeId);
- if (!this->execute(sql))
- return false;
-
- if (tf == TeRasterTransform::TeMono2Three ||
- tf == TeRasterTransform::TePall2Three ||
- tf == TeRasterTransform::TeLUT2Three)
- {
- sql = "INSERT INTO te_visual_raster (theme_id, band_in, transf_type) VALUES (";
- sql += Te2String(themeId) + "," + Te2String(vis->getSrcBand()) + ",";
- sql += Te2String(static_cast<short>(tf)) + ")";
- if (!this->execute(sql))
- return false;
- return true;
- }
-
- if (tf == TeRasterTransform::TeExtractBand)
- {
- sql = "INSERT INTO te_visual_raster (theme_id, band_in, band_out, transf_type) VALUES (";
- sql += Te2String(themeId) + "," + Te2String(vis->getSrcBand()) + ",";
- sql += Te2String(vis->getDestBand()) + "," + Te2String(static_cast<short>(tf))+ ")";
- if (!this->execute(sql))
- return false;
- return true;
- }
-
- if (tf == TeRasterTransform::TeExtractBands || tf == TeRasterTransform::TeExtractRGB)
- {
- map<TeRasterTransform::TeRGBChannels,short>& RGBmap = vis->getRGBMap();
- map<TeRasterTransform::TeRGBChannels,short>::iterator it = RGBmap.begin();
- while (it != RGBmap.end())
- {
- sql = "INSERT INTO te_visual_raster (theme_id, band_in, band_out, transf_type) VALUES (";
- sql += Te2String(themeId) + "," + Te2String(static_cast<short>(it->second)) + ",";
- sql += Te2String(static_cast<short>(it->first)) + "," + Te2String(static_cast<short>(tf))+ ")";
- if (!this->execute(sql))
- return false;
- ++it;
- }
- return true;
- }
- return false;
-}
-
-
-bool
-TeDatabase::locateLineSet (const string& table, TeCoord2D &pt, TeLineSet &ls, const double& tol)
-{
- bool located=false;
- TeDatabasePortal* portal = this->getPortal();
-
- TeBox box (pt.x()-tol,pt.y()-tol,pt.x()+tol,pt.y()+tol);
- string q ="SELECT * FROM " + table;
- char buf [1024];
- sprintf (buf," WHERE lower_x < %f AND upper_x > %f AND lower_y < %f AND upper_y > %f",
- box.x2(),box.x1(),box.y2(),box.y1());
- q += buf;
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- // Get all lines
- bool flag = true;
- do
- {
- TeLine2D l;
- TeLineSet tmp;
- int index;
- double dist;
- TeCoord2D pout;
-
- flag = portal->fetchGeometry( l );
- tmp.add(l);
- if(TeNearest(pt,tmp,index,pout,dist,tol))
- {
- ls.add ( l );
- located=true;
- }
- } while (flag);
-
- delete portal;
- return located;
-}
-
-
-bool
-TeDatabase::locatePointSet (const string& table, TeCoord2D &pt, TePointSet &pointSet, const double& tol)
-{
- bool located=false;
-
- TeDatabasePortal* portal = this->getPortal();
-
- TeBox box (pt.x()-tol,pt.y()-tol,pt.x()+tol,pt.y()+tol);
- string q ="SELECT * FROM " + table;
- char buf [1024];
- sprintf (buf," WHERE x < %f AND x > %f AND y < %f AND y > %f",
- box.x2(),box.x1(),box.y2(),box.y1());
- q += buf;
-
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TePoint point;
- flag = portal->fetchGeometry (point);
- pointSet.add ( point );
- located=true;
- }while (flag);
-
- delete portal;
- return located;
-}
-
-
-bool
-TeDatabase::locateTextSet (const string& table, TeCoord2D &pt, TeTextSet& textSet, const double& tol)
-{
- bool located=false;
-
- TeDatabasePortal* portal = this->getPortal();
-
- TeBox box (pt.x()-tol,pt.y()-tol,pt.x()+tol,pt.y()+tol);
- string q ="SELECT * FROM " + table;
- char buf [1024];
- sprintf (buf," WHERE x < %f AND x > %f AND y < %f AND y > %f",
- box.x2(),box.x1(),box.y2(),box.y1());
- q += buf;
- if (!portal->query(q) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- // Look for all texts
- bool flag = true;
-
- do
- {
- TeText p;
- flag = portal->fetchGeometry(p);
- textSet.add ( p );
- located=true;
- } while (flag);
-
- delete portal;
- return located;
-}
-
-bool
-TeDatabase::updateVersionStamp(const string& DBversion )
-{
- TeTable versionTable;
- if( !loadTable( "te_database", versionTable ) )
- return false;
- if ( versionTable.size() ) //no empty
- {
- string deleteVersionTb = "DELETE FROM te_database";
- if( !execute( deleteVersionTb ) )
- return false;
- }
- //insert
- string insVersionTb = "INSERT INTO te_database (db_version) VALUES('" + DBversion + "')";
- if( !execute(insVersionTb) )
- return false;
- return true;
-}
-
-bool
-TeDatabase::loadVersionStamp(string& DBversion)
-{
- DBversion.clear();
- TeTable versionTable;
- if( !loadTable("te_database",versionTable) )
- return false;
- if ( versionTable.size() == 0 )
- return false;
- std::vector<std::string> attrs;
- versionTable.attributeNames( attrs );
- for (unsigned int i = 0; i < attrs.size(); i++ )
- {
- if ( TeStringCompare(attrs[i], "db_version", false ) )
- {
- DBversion = versionTable(0, i);
- break;
- }
- }
- return false;
-}
-
-bool
-TeDatabase::updateLayerBox(TeLayer* layer)
-{
- if (!layer)
- return false;
- TeBox box = layer->box();
- string sql = "UPDATE te_layer SET lower_x = " + Te2String(box.x1(),15);
- sql += ", lower_y = " + Te2String(box.y1(),15);
- sql += ", upper_x = " + Te2String(box.x2(),15);
- sql += ", upper_y = " + Te2String(box.y2(),15);
- sql += " WHERE layer_id=" + Te2String(layer->id());
- return execute(sql);
-}
-
-//! Load information about all projects stored in the database
-bool
-TeDatabase::loadProjectSet()
-{
- //clear map
- TeProjectMap::iterator projectIt;
- for (projectIt = metaModel_->projectMap().begin(); projectIt != metaModel_->projectMap().end(); ++projectIt)
- {
- if (projectIt->second)
- delete projectIt->second;
- }
- metaModel_->projectMap().clear();
-
- //sql
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return false;
-
- string get = " SELECT te_project.*, te_project_view.* ";
- get += " FROM te_project LEFT JOIN te_project_view ";
- get += " ON te_project.project_id = te_project_view.project_id ";
- get += " ORDER BY te_project.project_id, te_project_view.view_id";
-
- if (!portal->query(get))
- {
- delete portal;
- return false;
- }
-
- bool flag = portal->fetchRow();
- while (flag)
- {
- TeProject* project = new TeProject(portal->getInt(0), this);
- project->setName(string(portal->getData(1)));
- project->setDescription(string(portal->getData(2)));
-// project->setCurrentViewId(portal->getInt(3));
- int pId = portal->getInt(3);
-
- //load all views
- bool hasViews = true;
- while(hasViews)
- {
- project->addView(portal->getInt(5));
- flag = portal->fetchRow();
- if(!flag || (portal->getInt(0)!=project->id()))
- hasViews = false;
- }
-
- project->setCurrentViewId(pId);
- metaModel_->projectMap()[project->id()] = project;
- }
-
- delete portal;
- return true;
-
-}
-
-//! Load information about a particular project
-bool
-TeDatabase::loadProject(TeProject* project)
-{
- if(!project)
- return false;
-
- //sql
- string get = " SELECT te_project.*, te_project_view.* ";
- get += " FROM te_project LEFT JOIN te_project_view ";
- get += " ON te_project.project_id = te_project_view.project_id ";
-
- if(project->id()>0)
- get += " WHERE te_project.project_id = "+ Te2String(project->id());
- else if (!project->name().empty())
- get += " WHERE te_project.name = '"+ project->name() +"'";
- else
- return false;
-
- get += " ORDER BY te_project.project_id, te_project_view.view_id";
-
- TeDatabasePortal* portal = this->getPortal();
- if(!portal)
- return false;
- if (!portal->query(get) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- project->setId (portal->getInt(0));
- project->setDatabase(this);
- project->setName(string(portal->getData(1)));
- project->setDescription(string(portal->getData(2)));
- int currentViewId = portal->getInt(3);
-
- //load all views
- bool hasViews = true;
- while(hasViews)
- {
- project->addView(portal->getInt(5));
- bool flag = portal->fetchRow();
- if(!flag || (portal->getInt(0)!=project->id()))
- hasViews = false;
- }
- project->setCurrentViewId(currentViewId); //the views vector need be filled
-
- metaModel_->projectMap()[project->id()] = project;
- delete portal;
- return true;
-}
-
-//! Update information about a layer
-bool
-TeDatabase::updateProject(TeProject *project)
-{
- if (!project)
- return false;
- int projectId = project->id();
- if (projectId <= 0)
- return false;
-
- //update project information
- string sql = " UPDATE te_project SET ";
- sql += " name = '" + project->name() +"'";
- sql += ", description = '" + project->description() +"'";
- sql += ", current_view = "+ Te2String(project->getCurrentViewId());
- sql += " WHERE project_id = "+ Te2String(project->id());
- if (!this->execute (sql))
- {
- this->errorMessage_ = "\nError updating project information";
- return false;
- }
-
- //delete relation
- sql = "DELETE FROM te_project_view WHERE project_id =" + Te2String(project->id());
- if (!this->execute (sql))
- {
- this->errorMessage_ = "Error deleting project/view relation";
- return false;
- }
- const TeViewVector vv = project->getViewVector();
- for (unsigned int i=0; i<vv.size(); ++i)
- {
- sql = "INSERT INTO te_project_view VALUES(" + Te2String(projectId) + "," + Te2String(vv[i]) + ")";
- if (!this->execute (sql))
- {
- this->errorMessage_ = "Error inserting project/view relation";
- return false;
- }
- }
- return true;
-}
-
-//! Delete a project from the database
-bool
-TeDatabase::deleteProject(int projectId)
-{
- string sql = "DELETE FROM te_project_view WHERE project_id =" + Te2String(projectId);
- if (!this->execute (sql))
- {
- this->errorMessage_ = "Error deleting project/view relation";
- return false;
- }
- sql = "DELETE FROM te_project WHERE project_id =" + Te2String(projectId);
- if (!this->execute (sql))
- {
- this->errorMessage_ = "Error deleting te_project entry";
- return false;
- }
-
- // delete project and its entry in the project map
- TeProject* proj = metaModel_->projectMap()[projectId];
- metaModel_->projectMap().erase(projectId);
- if(proj)
- delete proj;
- return true;
-}
-
-//! Insert a project/view relation
-bool
-TeDatabase::insertProjectViewRel(int projectId, int viewId)
-{
- string sql = "INSERT INTO te_project_view VALUES(" + Te2String(projectId) + "," + Te2String(viewId) + ")";
- if (!this->execute (sql))
- {
- this->errorMessage_ = "Error inserting project/view relation";
- return false;
- }
- return true;
-}
-
-bool
-TeDatabase::deleteProjectViewRel(int projectId, int viewId)
-{
- string sql ="DELETE FROM te_project_view WHERE project_id = ";
- sql += Te2String(projectId);
- sql += " AND view_id = ";
- sql += Te2String(viewId);
- if (!this->execute (sql))
- {
- this->errorMessage_ = "Error removing project/view relation";
- return false;
- }
- return true;
-}
-
-bool TeDatabase::projectExist(const string& projectName)
-{
- TeDatabasePortal* portal = this->getPortal();
-
- if(!portal)
- return false;
-
- string sql = "SELECT name FROM te_project WHERE " + this->toUpper("name") + " = '" + TeConvertToUpperCase(projectName) + "'";
-
- if(!portal->query(sql))
- {
- portal->freeResult();
- delete portal;
- return false;
- }
-
- if(portal->fetchRow())
- {
- portal->freeResult();
- delete portal;
- return true;
- }
-
- portal->freeResult();
- delete portal;
- return false;
-}
-
-bool TeDatabase::createPolygonGeometry(const string& tableName)
-{
- if(tableName.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attGeomId;
- attGeomId.rep_.name_ = "geom_id";
- attGeomId.rep_.type_ = TeUNSIGNEDINT;
- attGeomId.rep_.isAutoNumber_ = true;
- attGeomId.rep_.isPrimaryKey_ = true;
- attGeomId.rep_.null_ = false;
- attList.push_back(attGeomId);}
-
- {TeAttribute attObjId;
- attObjId.rep_.name_ = "object_id";
- attObjId.rep_.type_ = TeSTRING;
- attObjId.rep_.numChar_ = 255;
- attObjId.rep_.null_ = false;
- attList.push_back(attObjId);}
-
- {TeAttribute attSpatial;
- attSpatial.rep_.name_ = "spatial_data";
- attSpatial.rep_.type_ = TePOLYGONTYPE;
- attList.push_back(attSpatial);}
-
- if(!createTable(tableName, attList))
- return false;
-
- string idxName = "te_idx_" + tableName + "_obj";
-
- return createIndex(tableName, idxName, "object_id");
-}
-
-bool TeDatabase::createLineGeometry(const string& tableName)
-{
- if(tableName.empty())
- return false;
-
- TeAttributeList attList;
-
- {TeAttribute attGeomId;
- attGeomId.rep_.name_ = "geom_id";
- attGeomId.rep_.type_ = TeUNSIGNEDINT;
- attGeomId.rep_.isAutoNumber_ = true;
- attGeomId.rep_.isPrimaryKey_ = true;
- attGeomId.rep_.null_ = false;
- attList.push_back(attGeomId);}
-
- {TeAttribute attObjId;
- attObjId.rep_.name_ = "object_id";
- attObjId.rep_.type_ = TeSTRING;
- attObjId.rep_.numChar_ = 255;
- attObjId.rep_.null_ = false;
- attList.push_back(attObjId);}
-
- {TeAttribute attSpatial;
- attSpatial.rep_.name_ = "spatial_data";
- attSpatial.rep_.type_ = TeLINE2DTYPE;
- attList.push_back(attSpatial);}
-
- if(!createTable(tableName, attList))
- return false;
-
- string idxName = "te_idx_" + tableName + "_obj";
-
- return createIndex(tableName, idxName, "object_id");
-}
-
-bool
-TeDatabase::deleteRelation(const string& name, const string& table)
-{
- string relation = "ALTER TABLE " + table + " DROP ";
- relation += " CONSTRAINT " + name;
- return execute(relation);
-}
-
-bool
-TeDatabase::dropDBView(const string& dbViewName)
-{
- string del = "DROP VIEW " + dbViewName;
- return (execute(del));
-}
-
-bool
-TeDatabase::updateBBox(const string& tableName, const string& keyColumnName, int keyValue, const TeBox& box)
-{
- string upd = "UPDATE "+tableName+" SET lower_x=" + Te2String(box.x1_,15);
- upd += ", lower_y=" + Te2String(box.y1_, 15);
- upd += ", upper_x=" + Te2String(box.x2_, 15);
- upd += ", upper_y=" + Te2String(box.y2_, 15);
- upd += " WHERE " + keyColumnName + "=" + Te2String(keyValue);
- return execute(upd);
-}
-bool
-TeDatabase::beginTransaction()
-{
- transactionCounter_++;
- return true;
-}
-
-bool
-TeDatabase::commitTransaction()
-{
- transactionCounter_ = max(transactionCounter_-1, 0);
- return true;
-}
-
-bool
-TeDatabase::rollbackTransaction()
-{
- transactionCounter_ = max(transactionCounter_-1, 0);
- return true;
-}
-
-TeBox
-TeDatabase::getThemeBox(TeTheme* theme)
-{
- TeBox bb;
- if (!theme)
- return bb;
-
- TeLayer* layer = theme->layer();
- if (layer->hasGeometry(TeRASTER))
- bb = layer->box();
-
- if (layer->hasGeometry(TeRASTERFILE))
- updateBox(bb,layer->getRepresentation(TeRASTERFILE)->box_);
-
- string colTabName = theme->collectionTable();
- if (colTabName.empty())
- return bb;
-
- string sqlfrom;
- string geomTable;
- if (layer->hasGeometry(TePOINTS))
- {
- geomTable = layer->tableName(TePOINTS);
- sqlfrom = colTabName + " LEFT JOIN " + geomTable;
- sqlfrom += " ON " + colTabName + ".c_object_id = " + geomTable + ".object_id";
- TeBox bpt;
- if (getMBRSelectedObjects(geomTable,"spatial_data", sqlfrom, "","",TePOINTS,bpt))
- updateBox(bb,bpt);
- }
- if (layer->hasGeometry(TeLINES))
- {
- geomTable = layer->tableName(TeLINES);
- sqlfrom = colTabName + " LEFT JOIN " + geomTable;
- sqlfrom += " ON " + colTabName + ".c_object_id = " + geomTable + ".object_id";
- TeBox bln;
- if (getMBRSelectedObjects(geomTable,"spatial_data", sqlfrom, "","",TeLINES,bln))
- updateBox(bb,bln);
- }
- if (layer->hasGeometry(TePOLYGONS))
- {
- geomTable = layer->tableName(TePOLYGONS);
- sqlfrom = colTabName + " LEFT JOIN " + geomTable;
- sqlfrom += " ON " + colTabName + ".c_object_id = " + geomTable + ".object_id";
- TeBox bpol;
- if (getMBRSelectedObjects(geomTable,"spatial_data", sqlfrom, "","",TePOLYGONS,bpol))
- updateBox(bb,bpol);
- }
-
- if (layer->hasGeometry(TeCELLS))
- {
- geomTable = layer->tableName(TeCELLS);
- sqlfrom = colTabName + " LEFT JOIN " + geomTable;
- sqlfrom += " ON " + colTabName + ".c_object_id = " + geomTable + ".object_id";
- TeBox bpol;
- if (getMBRSelectedObjects(geomTable,"spatial_data", sqlfrom, "","",TeCELLS,bpol))
- updateBox(bb,bpol);
- }
-
- if (layer->hasGeometry(TeTEXT))
- {
- geomTable = layer->tableName(TeTEXT);
- sqlfrom = colTabName + " LEFT JOIN " + geomTable;
- sqlfrom += " ON " + colTabName + ".c_object_id = " + geomTable + ".object_id";
- TeBox bpol;
- if (getMBRSelectedObjects(geomTable,"spatial_data", sqlfrom, "","",TeTEXT,bpol))
- updateBox(bb,bpol);
- }
-
- return bb;
-}
-
-// End TeDatabase Methods
-
-// Begin TeDatabasePortal Methods
-
-TeDatabasePortal::TeDatabasePortal():
- db_(0),
- numRows_(0),
- numFields_ (0),
- errorMessage_(""),
- errorNumber_(0)
- {}
-
-TeDatabasePortal::~TeDatabasePortal ()
-{
-}
-
-double
-TeDatabasePortal::getDouble (int i)
-{
- char* val = getData(i);
- return atof(val);
-}
-
-double
-TeDatabasePortal::getDouble (const string& s)
-{
- char* val = getData(s);
- return atof(val);
-}
-
-int
-TeDatabasePortal::getInt (int i)
-{
- char* val = getData(i);
- return atoi(val);
-}
-
-int
-TeDatabasePortal::getInt (const string& s)
-{
- char* val = getData(s);
- return atoi(val);
-}
-
-bool
-TeDatabasePortal::fetchGeometry (TePolygon& geom, const unsigned int&)
-{
- return fetchGeometry(geom);
-}
-
-bool
-TeDatabasePortal::fetchGeometry (TeLine2D& geom, const unsigned int&)
-{
- return fetchGeometry(geom);
-}
-
-bool
-TeDatabasePortal::fetchGeometry (TeNode& geom, const unsigned int&)
-{
- return fetchGeometry(geom);
-}
-
-bool
-TeDatabasePortal::fetchGeometry (TePoint& geom, const unsigned int&)
-{
- return fetchGeometry(geom);
-}
-
-bool
-TeDatabasePortal::fetchGeometry (TeCell& cell)
-{
- int index = atoi(getData("geom_id"));
- string object_id = getData("object_id");
- TeBox b (atof(getData("lower_x")),atof(getData("lower_y")),atof(getData("upper_x")),atof(getData("upper_y")));
- cell.geomId(index);
- cell.objectId(object_id);
- cell.setBox (b);
- cell.column(atoi(getData("col_number")));
- cell.line(atoi(getData("row_number")));
- return (fetchRow());
-}
-
-bool
-TeDatabasePortal::fetchGeometry (TeCell& cell, const unsigned int& initIndex)
-{
- int index = atoi(getData(initIndex));
- string object_id = getData(initIndex+1);
- TeBox b (atof(getData(initIndex+2)),atof(getData(initIndex+3)),atof(getData(initIndex+4)),atof(getData(initIndex+5)));
- cell.geomId(index);
- cell.objectId(object_id);
- cell.setBox (b);
- cell.column(atoi(getData(initIndex+6)));
- cell.line(atoi(getData(initIndex+7)));
- return (fetchRow());
-}
-
-TeAttribute TeDatabasePortal::getAttribute (int i)
-{
- TeAttributeList::iterator it = attList_.begin();
- int j = 0;
- while ( it != attList_.end() )
- {
- if (i == j)
- return (*it);
- ++it;
- j++;
- }
- return TeAttribute();
-}
-
-TeAttribute TeDatabasePortal::getAttribute (const string& s)
-{
- TeAttributeList::iterator it = attList_.begin();
- while ( it != attList_.end() )
- {
- if (TeConvertToUpperCase(s) == TeConvertToUpperCase((*it).rep_.name_))
- return (*it);
- ++it;
- }
- return TeAttribute();
-}
-
-int
-TeDatabasePortal::getColumnIndex (const string& s)
-{
- TeAttributeList::iterator it = attList_.begin();
- int j = 0;
- while ( it != attList_.end() )
- {
- if (TeConvertToUpperCase(s) == TeConvertToUpperCase((*it).rep_.name_))
- return j;
- ++it;
- j++;
- }
- return -1;
-}
-
-string
-TeDatabasePortal::getColumnName (int i)
-{
- TeAttributeList::iterator it = attList_.begin();
- int j=0;
- while ( it != attList_.end() )
- {
- if (j==i)
- return (*it).rep_.name_;
- ++it;
- j++;
- }
- return "";
-}
-
-
-TeViewTree*
-TeDatabasePortal::getViewTree ()
-{
- TeViewTree *tree = new TeViewTree();
- tree->id (atoi(getData("theme_id")));
- tree->name (getData("name"));
- tree->priority(atoi(getData("priority")));
- //Update the tree also with parent_id and node_type from te_theme table
- tree->parentId(atoi(getData("parent_id")));
- tree->type(atoi(getData("node_type")));
- //Is it necessary to set parent??
- return tree;
-}
-
-TeLegendEntry
-TeDatabasePortal::getLegend ()
-{
- TeLegendEntry leg;
- leg.id (atoi(getData("legend_id")));
- leg.theme (atoi(getData("theme_id")));
- leg.group (atoi(getData("group_id")));
-
- string data;
- data = getData("num_objs");
- leg.count(atoi(data.c_str()));
- data = getData("lower_value");
- leg.from(data);
- data = getData("upper_value");
- leg.to(data);
- data = getData("label");
- leg.label(data);
- return leg;
-}
-
-void
-TeDatabasePortal::getVisual(TeVisual* vis)
-{
- TeGeomRep rep = (TeGeomRep)atoi (getData("geom_type"));
-
- TeColor cor(atoi(getData("red")),atoi(getData("green")),atoi(getData("blue")));
- vis->color(cor);
- vis->transparency(atoi(getData("transparency")));
-
- TeColor ccor(atoi(getData("contour_red")),atoi(getData("contour_green")),atoi(getData("contour_blue")));
- vis->contourColor(ccor);
- vis->contourWidth(atoi(getData("contour_width")));
- vis->contourTransparency(atoi(getData("contour_transp")));
-
- if(rep == TePOLYGONS || rep == TeCELLS)
- {
- vis->contourWidth(atoi(getData("width")));
- vis->contourStyle(atoi(getData("contour_symb_id")));
- vis->style(atoi(getData("symb_id")));
- }
- else if(rep == TeLINES)
- {
- vis->width(atoi(getData("width")));
- vis->style(atoi(getData("symb_id")));
- }
- else if(rep == TePOINTS)
- {
- vis->size(atoi(getData("size_value")));
- vis->style(atoi(getData("symb_id")));
- }
- else if(rep == TeTEXT)
- vis->size(atoi(getData("size_value")));
-
- vis->family(getData("family"));
- vis->bold (getBool("bold"));
- vis->italic (getBool("italic"));
- vis->fixedSize (getBool("fixed_size"));
-
- vis->alignmentVert(getDouble("alignment_vert"));
- vis->alignmentHoriz(getDouble("alignment_horiz"));
-
- vis->tabSize(atoi(getData("tab_size")));
- vis->lineSpace(atoi(getData("line_space")));
-}
-
-bool
-TeDatabasePortal::fetchGeometry (TeText& t)
-{
- TeCoord2D c(getDouble("x"), getDouble("y"));
- string txt = getData ("text_value");
- TeText t2(c,txt);
- t2.geomId(atoi(getData("geom_id")));
- t2.objectId(string(getData("object_id")));
- t2.setAngle (getDouble("angle"));
- t2.setHeight (getDouble("height"));
- t2.setAlignmentVert(getDouble("alignment_vert"));
- t2.setAlignmentHoriz(getDouble("alignment_horiz"));
- t = t2;
- return (fetchRow());
-}
-
-bool
-TeDatabasePortal::fetchGeometry (TeText& t, const unsigned int& initIndex)
-{
- TeCoord2D c(getDouble(initIndex+2), getDouble(initIndex+3));
- string txt = getData(initIndex+4);
- TeText t2(c,txt);
- t2.geomId(atoi(getData(initIndex)));
- t2.objectId(string(getData(initIndex+1)));
- t2.setAngle (getDouble(initIndex+5));
- t2.setHeight (getDouble(initIndex+6));
- t2.setAlignmentVert(getDouble(initIndex+7));
- t2.setAlignmentHoriz(getDouble(initIndex+8));
- t = t2;
- return (fetchRow());
-}
-
-bool
-TeDatabasePortal::fetchGeometry (TeArc& arc)
-{
- arc.fromId(atoi(getData(2)));
- arc.toId(atoi(getData(3)));
- arc.geomId(atol(getData(0)));
- arc.objectId(string(getData(1)));
- return fetchRow();
-}
-
-bool
-TeDatabasePortal::fetchGeometry (TeArc& arc, const unsigned int& initIndex)
-{
- arc.fromId(atoi(getData(initIndex+2)));
- arc.toId(atoi(getData(initIndex+3)));
- arc.geomId(atol(getData(initIndex+0)));
- arc.objectId(string(getData(initIndex+1)));
- return fetchRow();
-}
-
-bool
-TeDatabasePortal::getVisual(TeVisual* vis, TeGeomRep& rep, const unsigned int& initIndex)
-{
- string legendId = this->getData(initIndex);
- if(legendId.empty())
- return false;
-
- rep = (TeGeomRep)atoi (getData(initIndex+1)); //geom_type = 1
-
- TeColor cor(atoi(getData(initIndex+3)),atoi(getData(initIndex+4)),atoi(getData(initIndex+5)));
- vis->color(cor);
- vis->transparency(atoi(getData(initIndex+6)));
-
- TeColor ccor(atoi(getData(initIndex+9)),atoi(getData(initIndex+10)),atoi(getData(initIndex+11)));
- vis->contourColor(ccor);
- vis->contourWidth(atoi(getData(initIndex+13)));
- vis->contourTransparency(atoi(getData(initIndex+12)));
-
- if(rep == TePOLYGONS || rep == TeCELLS)
- {
- vis->contourWidth(atoi(getData(initIndex+13)));
- vis->contourStyle(atoi(getData(initIndex+8)));
- vis->style(atoi(getData(initIndex+2)));
- }
- else if(rep == TeLINES)
- {
- vis->width(atoi(getData(initIndex+7)));
- vis->style(atoi(getData(initIndex+2)));
- }
- else if(rep == TePOINTS)
- {
- vis->size(atoi(getData(initIndex+14)));
- vis->style(atoi(getData(initIndex+2)));
- }
- else if(rep == TeTEXT)
- vis->size(atoi(getData(initIndex+14)));
-
- vis->family(getData(initIndex+16));
- vis->bold (getBool(initIndex+17));
- vis->italic (getBool(initIndex+18));
- vis->fixedSize (getBool(initIndex+23));
-
- vis->alignmentVert(getDouble(initIndex+19));
- vis->alignmentHoriz(getDouble(initIndex+20));
-
- vis->tabSize(atoi(getData(initIndex+21)));
- vis->lineSpace(atoi(getData(initIndex+22)));
- return true;
-}
-
-bool
-TeDatabasePortal::getRasterVisual(TeRasterVisual& vis, const unsigned int& initIndex)
-{
- string themeId = getData(initIndex);
- if(themeId.empty())
- return false;
-
- vis.setSrcBand(getInt(initIndex+1));
- vis.setDestBand(getInt(initIndex+2));
- vis.setTransfFunction(static_cast<TeRasterTransform::TeRasterTransfFunctions>(getInt(initIndex+3)));
- if (vis.getTransfFunction() == TeRasterTransform::TeExtractRGB ||
- vis.getTransfFunction() == TeRasterTransform::TeExtractBands)
- {
- vis.setBChannelMapping(getInt(initIndex+1),static_cast<TeRasterTransform::TeRGBChannels>(getInt(initIndex+2)));
- }
-
- return true;
-}
-
-
-TeColor
-TeDatabasePortal::getColor ()
-{
- TeColor c(atoi(getData("red")), atoi(getData("green")), atoi(getData("blue")));
- return c;
-}
-
-bool
-TeDatabasePortal::getView(TeView& view, const unsigned int& initIndex)
-{
- string viewId = getData(initIndex);
- if(viewId.empty())
- return false;
- view.id(atoi(viewId.c_str()));
- view.name(getData(initIndex+2));
- view.user(getData(initIndex+3));
- view.isVisible(getBool(initIndex+4));
- view.setCurrentBox(TeBox(getDouble(initIndex+5), getDouble(initIndex+6), getDouble(initIndex+7), getDouble(initIndex+8)));
- if(strncmp(getData(initIndex+9),"",1))
- view.setCurrentTheme(-1);
- else
- view.setCurrentTheme(getInt(initIndex+9));
- return true;
-}
-
-bool
-TeDatabasePortal::getProjection(TeProjection** proj, const unsigned int& initIndex)
-{
- string projId = getData(initIndex);
- if(projId.empty())
- return false;
-
- TeDatum datum ( getData(initIndex+11),
- getDouble(initIndex+12),
- getDouble(initIndex+13),
- getDouble(initIndex+14),
- getDouble(initIndex+15),
- getDouble(initIndex+16));
-
- TeProjectionParams mProjPars;
- mProjPars.datum = datum;
- mProjPars.name = getData(initIndex+1);
- mProjPars.lat0 = getDouble(initIndex+3)*TeCDR;
- mProjPars.lon0 = getDouble(initIndex+2)*TeCDR;
- mProjPars.offx = getDouble(initIndex+4);
- mProjPars.offy = getDouble(initIndex+5);
- mProjPars.stlat1 = getDouble(initIndex+6)*TeCDR;
- mProjPars.stlat2 = getDouble(initIndex+7)*TeCDR;
- mProjPars.units = getData(initIndex+8);
- mProjPars.scale = getDouble(initIndex+9);
- mProjPars.hemisphere = (TeHemisphere)getInt(initIndex+10);
-
- *proj = TeProjectionFactory::make(mProjPars);
- if(!*proj)
- return false;
-
- (*proj)->id(atoi(projId.c_str()));
- return true;
-}
-
-void
-TeDatabasePortal::getViewNodeParams (TeViewNodeParams& params, const unsigned int& initIndex)
-{
- params.name_ = string (this->getData(initIndex+3)); //name
- params.id_ = this->getInt(initIndex); // id
- params.viewId_ = this->getInt(initIndex+2); //view id
- params.nodeType_ = this->getInt(initIndex+6); //node type
- params.priority_ = this->getInt(initIndex+5); //priority
- params.myParentId_ = this->getInt(initIndex+4); //parent id
-}
-
-bool
-TeDatabasePortal::getTheme(TeAbstractTheme& theme, const unsigned int& initIndex)
-{
- string themeId = getData(initIndex);
- if(themeId.empty())
- return false;
-
- theme.id(atoi(themeId.c_str()));
- theme.view (atoi(this->getData (initIndex+2)));
- theme.name(string (this->getData(initIndex+3)));
- theme.parentId( atoi(this->getData (initIndex+4)));
- theme.type ((TeViewNodeType)this->getInt(initIndex+6));
- theme.priority(this->getInt(initIndex+5));
- theme.minScale (this->getDouble (initIndex+7));
- theme.maxScale (this->getDouble (initIndex+8));
- theme.attributeRest(string(this->getData (initIndex+9)));
- theme.spatialRest(string(this->getData (initIndex+10)));
- theme.temporalRest(string(this->getData (initIndex+11)));
- theme.visibleRep(atoi(this->getData (initIndex+13)));
- theme.visibility(atoi(this->getData (initIndex+14)));
- theme.setThemeBox(TeBox(getDouble(initIndex+15), getDouble(initIndex+16), getDouble(initIndex+17), getDouble(initIndex+18)));
-
- if(theme.type()==TeTHEME)
- {
- static_cast<TeTheme&>(theme).collectionTable(string(this->getData (initIndex+12)));
- static_cast<TeTheme&>(theme).collectionAuxTable(static_cast<TeTheme&>(theme).collectionTable() + "_aux");
- static_cast<TeTheme&>(theme).layerId (atoi(this->getData(initIndex+1)));
- }
- else if(theme.type()==TeEXTERNALTHEME)
- {
- static_cast<TeExternalTheme&>(theme).collectionTable(string(this->getData (initIndex+12)));
- static_cast<TeExternalTheme&>(theme).collectionAuxTable(static_cast<TeExternalTheme&>(theme).collectionTable() + "_aux");
- }
- else if(theme.type()==TeEXTERNALTHEME)
- {
- static_cast<TeTheme&>(theme).collectionTable(string(this->getData (initIndex+12)));
- static_cast<TeTheme&>(theme).collectionAuxTable(static_cast<TeTheme&>(theme).collectionTable() + "_aux");
- }
- return true;
-}
-
-bool
-TeDatabasePortal::getGrouping(TeGrouping& group, const unsigned int& initIndex)
-{
- string groupThemeId = getData(initIndex);
- if(groupThemeId.empty())
- return false;
-
- TeAttributeRep atRep;
- string attname = getData (initIndex+2);
- string norname = getData (initIndex+5);
- int f = attname.find("(");
- if(f >= 0)
- {
- string alias = attname;
- attname = attname.substr(0, f);
- alias = alias.substr(f+1);
- alias = alias.substr(0, alias.size()-1);
- map<string, string>& m = this->getDatabase()->mapThemeAlias()[atoi(groupThemeId.c_str())];
- m[attname] = alias;
- }
- f = norname.find("(");
- if(f >= 0)
- {
- string alias = norname;
- norname = norname.substr(0, f);
- alias = alias.substr(f+1);
- alias = alias.substr(0, alias.size()-1);
- map<string, string>& m = this->getDatabase()->mapThemeAlias()[atoi(groupThemeId.c_str())];
- m[norname] = alias;
- }
-
- if(attname=="NONE")
- attname = "";
-
- if(norname=="NONE")
- norname = "";
-
- atRep.name_ = attname;
- atRep.type_ = TeAttrDataType(atoi(getData(initIndex+3)));
- group.groupAttribute_ = atRep;
- group.groupNormAttribute_ = norname;
- group.groupMode_ = TeGroupingMode(getInt(initIndex+4));
- group.groupNumSlices_ = getInt(initIndex+1);
- group.groupPrecision_ = getInt(initIndex+7);
- group.groupStdDev_ = getDouble(initIndex+6);
- group.groupFunction_ = getData(initIndex+8);
- group.groupChronon_ = TeChronon(getInt(initIndex+9));
- return true;
-}
-
-bool
-TeDatabasePortal::getLegend (TeLegendEntry& leg, const unsigned int& initIndex)
-{
- string legId = getData(initIndex);
- if(legId.empty())
- return false;
-
- leg.id(atoi(getData(initIndex)));
- leg.theme (atoi(getData(initIndex+1)));
- leg.group (atoi(getData(initIndex+2)));
- leg.count (atoi(getData(initIndex+3)));
-
- std::string lower_value_str( getData(initIndex+4) );
- leg.from( lower_value_str );
-
- std::string upper_value_str( getData(initIndex+5) );
- leg.to( upper_value_str );
-
- std::string label_str( getData(initIndex+6) );
- leg.label( label_str );
-
- return true;
-}
-
-bool
-TeDatabasePortal::getAttrTable(TeTable& table, const unsigned int& initIndex)
-{
- string tableName = this->getData(initIndex+2);
- if(tableName.empty())
- return false;
-
- table.name (tableName);
- table.setId(this->getInt(initIndex+0));
- table.setLinkName(this->getData(initIndex+4));
- table.setUniqueName(this->getData(initIndex+3));
- table.attInitialTime(this->getData(initIndex+5));
- table.attFinalTime(this->getData(initIndex+6));
- table.attTimeUnit(TeChronon(this->getInt(initIndex+7)));
- table.setTableType((TeAttrTableType)this->getInt(initIndex+8));
- return true;
-}
-
-bool
-TeDatabasePortal::getLayer(TeLayer& layer, const unsigned int& initIndex)
-{
- string layerId = this->getData(initIndex);
- if(layerId.empty())
- return false;
-
- layer.id(atoi(layerId.c_str()));
- layer.name(string (this->getData(initIndex+2)));
-
- std::string x1 = this->getData("te_layer.lower_x");
- std::string y1 = this->getData("te_layer.lower_y");
- std::string x2 = this->getData("te_layer.upper_x");
- std::string y2 = this->getData("te_layer.upper_y");
-
- layer.setLayerBox(TeBox(this->getDouble(initIndex+3),
- this->getDouble(initIndex+4),
- this->getDouble(initIndex+5),
- this->getDouble(initIndex+6)));
- return true;
-}
-
-bool
-TeDatabasePortal::getRepresentation(TeRepresentation& rep, const unsigned int& initIndex)
-{
- string repId = this->getData(initIndex);
- if(repId.empty())
- return false;
-
- rep.id_ = atoi(repId.c_str());
- TeGeomRep g = (TeGeomRep)atoi(this->getData(initIndex+2));
- rep.geomRep_ = g;
- rep.tableName_ = this->getData(initIndex+3);
- rep.description_ = this->getData(initIndex+4);
- rep.box_ = TeBox(this->getDouble(initIndex+5),
- this->getDouble(initIndex+6),
- this->getDouble(initIndex+7),
- this->getDouble(initIndex+8));
- rep.resX_ = this->getDouble(initIndex+9);
- rep.resY_ = this->getDouble(initIndex+10);
- rep.nCols_ = this->getInt(initIndex+11);
- rep.nLins_ = this->getInt(initIndex+12);
- return true;
-}
-
-
-
-// End TeDatabasePortal Methods
-
-
diff --git a/src/terralib/kernel/TeDatabase.h b/src/terralib/kernel/TeDatabase.h
deleted file mode 100644
index 1eeddb2..0000000
--- a/src/terralib/kernel/TeDatabase.h
+++ /dev/null
@@ -1,1695 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDatabase.h
- \brief This file contains structures and definitions about database support in TerraLib
-*/
-#ifndef __TERRALIB_INTERNAL_DATABASE_H
-#define __TERRALIB_INTERNAL_DATABASE_H
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeDefines.h"
-
-#include "TeDefines.h"
-#include "TeDataTypes.h"
-#include "TeTable.h"
-#include "TeGeometry.h"
-#include "TeStatistics.h"
-#include "TeProject.h"
-#include "TeRaster.h"
-#include "TeView.h"
-#include "TeVisual.h"
-#include "TeMetaModelCache.h"
-#include "TeSharedPtr.h"
-
-class TeLayer;
-class TeDatabaseFactoryParams;
-class TeRasterParams;
-class TeTheme;
-class TeTime;
-class TeTimeInterval;
-
-#include <set>
-using namespace std;
-
-
-/*! \enum TeCursorLocation
- Location of a cursor on record set
- */
-enum TeCursorLocation { TeCLIENTESIDE, TeSERVERSIDE };
-
-/*! \enum TeCursorType
- Type of cursor on record set
- */
-enum TeCursorType { TeUNIDIRECTIONAL, TeBIDIRECTIONAL, TeRANDOMACCESS };
-
-/*! \enum TeCursorEditType
- Type of edition on record set cursor
- */
-enum TeCursorEditType { TeREADONLY, TeREADWRITE };
-
-/*! \enum TeCursorDataType
- Type of edition on record set cursor
- */
-enum TeCursorDataType { TeBINARYCURSOR, TeTEXTCURSOR };
-
-
-/*! \enum TeSpatialIndexType
- Type of spatial index
- */
-enum TeSpatialIndexType {TeRTREE, TeQUADTREE};
-
-//! A vector of objects identifications (object_id)
-typedef vector<string> TeKeys;
-
-//! A Map of objects identifications (object_id) to a distance value
-typedef map<string, double> TeKeysToDist;
-
-//! A Vector of pointers to TeGeometry
-typedef vector<TeGeometry*> TeGeometryVect;
-
-//! A Map of the objects identifications to a set of statistical values
-typedef map<string, TeStatisticsDimensionVect> TeObjectStatistics;
-
-
-class TeDatabasePortal;
-
-
-//! An abstract database class
-/*!
- Instances of this classes represent connections
- to a database server. It includes the host name,
- user name and password parameters of the connection.
- It should be implemented by the drivers to specific
- database servers as: MySQL, Ado, PostgreSQL or any
- other server to be used in TerraLib applications.
- When possible, default implementations using ANSI SQL
- are provided.
- Methods that rely on special features of the derived
- driver are left as purely virtual.
-
- \sa
- TeTheme, TeView, TeLayer, TeAttribute
-*/
-class TL_DLL TeDatabase
-{
-public:
- //! Empty constructor
- TeDatabase();
-
- //! Destructor
- virtual ~TeDatabase();
-
- //! Assignment operator
- virtual TeDatabase& operator=(const TeDatabase& other);
-
- //! Operator ==
- virtual bool operator== (const TeDatabase& other) const
- {
- if (dbmsName_ != other.dbmsName_ ||
- database_ != other.database_ ||
- host_ != other.host_ ||
- user_ != other.user_ )
- return false;
- return true;
- }
- /** @name Members
- * Methods to access class private members
- */
- //@{
- //! Returns the error message from the server
- virtual string errorMessage ()
- { return errorMessage_; }
-
- //! Returns the error number from the server
- virtual int errorNum ()
- { return errorNumber_; }
-
- //! Return the user name of the connection opened
- string user ()
- { return user_; }
-
- //! Set the current user name to view
- void user(string value) { user_=value;}
-
- //! Returns the host name of the connection opened
- string host ()
- { return host_; }
-
- //! Returns the user's password of the connection opened
- string password ()
- { return password_; }
-
- //! Returns the database name of the connection opened
- string databaseName ()
- { return database_; }
-
- //! Returns the Database Management System name
- string dbmsName ()
- { return dbmsName_; }
-
- //! Returns the port number of the connection opened
- int portNumber ()
- { return portNumber_; }
-
- //! Returns the map of layers in the database
- TeLayerMap& layerMap ()
- { return metaModel_->layerMap(); }
-
- //! Returns the map of views in the database
- TeViewMap& viewMap ()
- { return metaModel_->viewMap(); }
-
- //! Returns the map of themes in the database
- TeThemeMap& themeMap ()
- { return metaModel_->themeMap(); }
-
- //! Returns the map of invalid themes in the database
- TeThemeMap& invalidThemeMap()
- { return metaModel_->invalidThemeMap(); }
-
- //! Returns the map of projects in the database
- TeProjectMap& projectMap ()
- { return metaModel_->projectMap(); }
-
- //! Returns the map of legends in the database
- TeLegendEntryMap& legendMap ()
- { return metaModel_->legendMap(); }
-
- //! Returns the set of relations between tables
- multiset<int>& relationMSet ()
- { return metaModel_->relationMSet(); }
-
- //! Clears structures in memory (legendMap, layerMap, viewMap...) used to optimize database access
- virtual void clear();
-
- //@}
-
- /** @name Database
- * Methods related to database and connection creation.
- * These methods return TRUE when the operation was successfull.
- * Otherwise return FALSE and when possible an error message is captured.
- */
- //@{
- //! Creates a new database and open a connection to it
- virtual bool newDatabase(const string& database, const string& user, const string& password, const string& host, const int &port=-1, bool terralibModel=true) = 0;
-
- //! Opens a connection to a database server passing all parameters needed
- virtual bool connect (const string& host, const string& user, const string& password, const string& database, int port = -1) = 0;
-
- //! Show the server databases (only for MySQL, Oracle and PostgreSQL)
- virtual bool showDatabases (const string& /* host */, const string& /* user */, const string& /* password */, vector<string>& /* dbNames */ , int /* port */ = -1)
- { return true; }
-
- //! Opens a connection without parameters. When possible, should be implemented by the derived classes
- virtual bool connect (const string& = "") { return false; };
-
- //! Check if there is an opened connection
- bool isConnected ()
- { return isConnected_; }
-
- //! Closes the connection
- virtual void close() = 0;
-
- //! Returns a string that the describes the parameters of the database connected
- /*
- The expected return value is similar to: dbms_server;hostname;portnumber;databasename;user;password
- */
- virtual string getDatabaseDescription();
-
-
- /**
- * This is for TeFactory compatibility ( Invalid TeDatabaseFactory
- * requests will try to create an default object using this function ).
- */
- static TeDatabase* DefaultObject( const TeDatabaseFactoryParams& )
- {
- std::cout << std::endl << "TeDatabase::DefaultObject - " <<
- " - Trying to create an invalid TeDatabase default object." <<
- std::endl;
- throw;
-
- return 0;
- };
-
- //@}
-
- /** @name Tables
- Methods related to table manipulation.
- \note refer to data model documentation in order to understand the meanning of
- each tables and its fields
- */
- //@{
-
- //! Returns a list of tables in a database
- virtual bool listTables(vector<string>& /* tableList */) { return false; }
-
- //! Verifies if a table exist in the database
- virtual bool tableExist(const string& table) = 0;
-
- //! Verifies if a table has a column
- virtual bool columnExist(const string& table, const string& column, TeAttribute& attr) = 0;
-
- //! Update a column
- virtual bool allowEmptyString(const string& /* tableName */, const string& /* column */) { return false; }
-
- //! Verifies and modifies the column names of the table. It returns if the table was modified
- virtual bool validTable (TeTable& table);
-
- //! Return the name of an attribute table given its identifier
- string getTableName(int tableId);
-
- //! Return a valid name for a table from a initial one
- string getNewTableName(const string& n);
-
- //! Concatenate field values
- /*!
- \param fNamesVec vector containing the fields to be concatenated
- */
- virtual string getConcatFieldsExpression(const vector<string>& fNamesVec);
-
- //! Creates a table
- /*!
- \param table table name
- \param attr table list of attributes
- */
- virtual bool createTable(const string& table, TeAttributeList &attr) = 0;
-
- //! Deletes a table. Do not allow the deletion of model tables
- virtual bool deleteTable (const string& table);
-
- //! Adds a column to a table
- /*!
- \param table table name
- \param rep representation of the column being created
- */
- virtual bool addColumn (const string& table, TeAttributeRep &rep) = 0;
-
- //! Deletes a column to a table
- /*!
- \param table table name
- \param colName name of the column being deleted
- */
- virtual bool deleteColumn (const string& table, const string& colName);
-
- //! Creates a reationship between two tables
- /*!
- \param relName relationship name
- \param table table that will receive the foreign key
- \param fieldName column that will be foreign key
- \param relatedTable table that exports the foreign key
- \param relatedField field that will the exported foreign key
- \param cascadeDeletion flag that indicates if the deletion should be propagated
- */
- virtual bool createRelation (const string& relName, const string& table, const string& fieldName,
- const string& relatedTable, const string& relatedField, bool cascadeDeletion) = 0;
-
- //! Checks if a relation exist
- /*!
- \param tableName table where the relashionship exists
- \param relName relationship name
- */
- virtual TeDBRelationType existRelation(const string& tableName, const string& relName) = 0;
-
- //! Removes a relation exist
- /*!
- \param name relationship name
- \param table table where the relashionship exists
- \return TRUE if succeed and FALSE otherwise
- */
- virtual bool deleteRelation(const string& name, const string& table);
-
- //@}
-
- /** @name Query
- * Methods related to query the database
- */
- //@{
- //! Executes a SQL command that doesnt return a record set. Tipically a data definition comand
- virtual bool execute ( const string &sql) = 0;
-
- //! Returns a database portal.
- /*!
- A database portal is used to submit queries to the database and to navigate over the
- resulting record set
- */
- virtual TeDatabasePortal* getPortal () = 0;
-
- //! Get the values that satisfy the query
- virtual bool inClauseValues(const string& query , const string& attribute, vector<string>& inClauseVector);
-
- //@}
-
- /** @name Data Model
- Methods that create the database model suggested in TerraLib.
- Classes in TerraLib materialize the DataModel suggested.
- */
- //@{
- //! Creates the entire TerraLib conceptual model.
- /*
- \param withIntegrity flag that indicates that the referencial integrity should be implemented.
- \param createIndex flag that indicate that the indexes should be created
- */
- virtual bool createConceptualModel(bool withIntegrity = true, bool newDatabase = true, bool createIndex = true);
-
- //! Creates the referencial integrity of the conceptual model
- virtual bool defineIntegrity(void);
-
- //! Create the indexes for the tables in the conceptual model
- virtual bool createIndex(const string& tableName, const string& indexName, const string& columnsName);
-
- //! Creates a table to store version database information
- virtual bool createDatabaseTable();
-
- //! Creates a table to store projectinon information
- virtual bool createProjectionTable();
-
- //! Creates a table to store Layers information
- virtual bool createLayerTable ();
-
- //! Creates a table to store Representations information
- virtual bool createRepresentationTable ();
-
- //! Creates a table to store Views information
- virtual bool createViewTable ();
-
- //! Creates a table to store Themes information
- virtual bool createThemeTable ();
-
- //! Creates a table to store the groupings associated with a theme
- virtual bool createGroupingTable();
-
- //! Creates a table to store information about the attribute tables used by a theme
- virtual bool createThemeTablesTable();
-
- //! Creates a table to store legends
- virtual bool createLegendTable ();
-
- //! Creates a table to store visual definitions
- virtual bool createVisualTable();
-
- //! Creates a table to store raster visual definitions
- virtual bool createVisualRasterTable();
-
- //! Creates a table to store information about the non-spatial tables associated to this layer
- virtual bool createLayerTableTable();
-
- //! Creates a table to store information about the external tables related to non-spatial tables of layers
- virtual bool createTablesRelationTable();
-
- //! Creates a table to store information about projects: an structure that groups views
- virtual bool createProjectTable();
-
- //! Creates a table to store the relation between project/views information
- virtual bool createProjectViewTable();
- //@}
-
- /** @name Project
- Methods related to the manipulation of projects
- */
- //@{
- //! Load information about all projects stored in the database
- virtual bool loadProjectSet();
-
- //! Load information about a particular project
- virtual bool loadProject(TeProject* project);
-
- //! Insert information about a project
- virtual bool insertProject(TeProject *project) = 0;
-
- //! Update information about a project
- virtual bool updateProject(TeProject *project);
-
- //! Delete a project from the database
- virtual bool deleteProject(int projectId);
-
- //! Insert a project/view relation
- virtual bool insertProjectViewRel(int projectId, int viewId);
-
- //! Deletes a project/view relation
- virtual bool deleteProjectViewRel(int projectId, int viewId);
-
- //! Check whether a given project already exists in the database (it is not case sensitive).
- virtual bool projectExist(const string& projectName);
- //@}
-
- /** @name Geometries
- Methods that create tables that store the spatial data
- */
- //@{
-
- //! Creates a table for a polygon geometries
- virtual bool createPolygonGeometry (const string& tableName);
-
- //! Creates a table for line geometries
- virtual bool createLineGeometry (const string& tableName);
-
- //! Creates a table for point geometries
- virtual bool createPointGeometry (const string& tableName);
-
- //! Creates a table for cell geometries
- virtual bool createCellGeometry (const string& tableName);
-
- //! Creates a table for a text geometries
- virtual bool createTextGeometry (const string& tableName);
-
- //! Creates a table for a arc geometries
- virtual bool createArcGeometry (const string& tableName);
-
- //! Creates a table for a node geometries
- virtual bool createNodeGeometry (const string& tableName);
-
- //! Creates a table to store raster representations of objects
- virtual bool createRasterGeometry(const string& tableName);
-
- //! Creates a table to store information about raster representation
- virtual bool createRasterMetadataTable(const string& tableName);
-
- //! Creates a table for raster geometries
- virtual bool createRasterTable (const string& tableName);
-
- //! Creates a table to store information about objects in a theme
- virtual bool createCollectionTable(const string& tableName);
- //@}
-
- /** @name Non-spatial tables
- * Retrieving/Inserting/Modifying generic tables in the database.
- */
- //@{
- //! Retrieves information about some tables
- /*
- \param atts returning vector of tables information
- \param attType type of the tables that are being looked for (optional)
- \return TRUE if any table was found and FALSE otherwise
- */
- virtual bool getAttrTables(TeAttrTableVector& atts, TeAttrTableType attType = TeAllAttrTypes);
-
- //! Inserts information about a link to an external table
- /*
- \param tableId table identification (from te_layer_table)
- \param tField link column name of the static table
- \param eTable name of the external table
- \param eField name of the link column of the related table
- \param relId returns the identification of the relation
- */
- virtual bool insertRelationInfo(const int tableId, const string& tField,
- const string& rTable, const string& rField, int& relId) = 0;
-
- //! Inserts information about an attribute table
- virtual bool insertTableInfo (int layerId, TeTable &table, const string& user="") = 0;
-
- //! Updates information about an attribute table
- virtual bool updateTableInfo (int layerId, TeTable &table, const string user="");
-
- //! Retrieves the metainformation about an attribute table
- virtual bool loadTableInfo(TeTable& table);
-
- //! Saves a table and its contents in the database
- virtual bool insertTable(TeTable &table);
-
- //! Alter a property of a table
- virtual bool alterTable(const string& tableName, TeAttributeRep& rep, const string& oldColName="");
-
- //! Alter the table name
- virtual bool alterTable(const string& oldTableName, const string& newTablename);
-
- //! Saves a large binary objects (BLOB) in a row table
- virtual bool insertBlob (const string& tableName, const string& columnBlob, TeAttributeRep& columnId, const string& valueId, unsigned char* data, int size);
-
- //! Saves a large binary objects (BLOB) in a row table
- virtual bool insertBlob (const string& tableName, const string& columnBlob, TeAttributeRep& columnId, const string& valueId, const string& fileName);
-
- //! Saves a large binary objects (BLOB) in a row table
- virtual bool insertBlob (const string& tableName, const string& columnBlob, const string& whereClause, unsigned char* data, int size) = 0;
-
- //! Saves a large binary objects (BLOB) in a row table
- virtual bool insertBlob (const string& tableName, const string& columnBlob, const string& whereClause, const string& fileName);
-
- //! Updates a table and its contents in the database
- virtual bool updateTable (TeTable &table);
-
- //! Retrieves a table and its contents from the database
- virtual bool loadTable (const string& tableName, TeTable &table);
-
- //! Retrieves a table (or part of it) accordingly to a criteria written in SQL
- virtual bool selectTable (const string& tableName, const string& criteria, TeTable &table);
-
- //! Deletes all tables, of a particular type, associated to a layer
- virtual bool deleteLayerTable (int layerId, TeAttrTableType ttype = TeAttrStatic);
- //@}
-
- /** @name Projection
- * Accessing/Inserting/Modifying projection information into the database.
- */
- //@{
-
- //! Insert information about a geographical projection
- virtual bool insertProjection (TeProjection *proj) = 0;
-
- //! Updates information about a geographical projection
- virtual bool updateProjection (TeProjection *proj);
-
- //! Retrieves information about a geographical projection identified by its database id
- virtual TeProjection* loadProjection (int id);
- //@}
-
- /** @name Layers
- * Retrieving/Inserting/Modifying/Deleting layers in the database.
- */
- //@{
- //! Insert information about a layer
- virtual bool insertLayer (TeLayer *layer) = 0;
-
- //! Update information about a layer
- virtual bool updateLayer (TeLayer *layer);
-
- //! Load information about all layers stored in the database
- /*
- \param loadAttrList indicates if the attribute list of each attribute table should be loaded
- */
- virtual bool loadLayerSet (const bool& loadAttrList = true);
-
- //! Load information about a particular layer
- /*
- \param layer a pointer to a layer that will be loaded from database
- \param loadAttrList indicates if the attribute list of each attribute table should be loaded
- */
- virtual bool loadLayer (TeLayer* layer, const bool& loadAttrList = true);
-
- //! Load layer tables
- /*
- \param layer a pointer to a layer whose attribute table will be loaded from database
- \param loadAttrList indicates if the attribute list of each attribute table should be loaded
- */
- virtual bool loadLayerTable (TeLayer* layer, const bool& loadAttrList = true);
-
- //! Delete a particular layer passing its id
- virtual bool deleteLayer (int layerId);
-
- //! Check if a particular layer exists (passing its id)
- virtual bool layerExist (int id);
-
- //! Check if a particular layer exists (passing its name)
- virtual bool layerExist (string layerName);
-
- //! Checks whether a given layer name is valid or already exists in the database
- /*!
- \param n layer name to be checked
- \return the modified valid layer name
- */
- virtual string getNewLayerName(const string& n);
- //@}
-
- /** @name Representation
- * Retrieving/Inserting/Modifying/Deleting representations in the database.
- */
- //@{
- //! Inserts information about a geometrical representation
- virtual bool insertRepresentation (int layerId, TeRepresentation& rep) = 0;
-
- //! Updates information about a geometrical representation
- virtual bool updateRepresentation (int layerId, TeRepresentation& rep);
-
- //! Updates the box information of a layer in the corresponding metadata table
- virtual bool updateLayerBox(TeLayer* layer);
-
- //@}
-
- /** @name Raster Tables
- * Retrieving/Inserting/Modifying/Deleting raster representations in the database.
- */
- //@{
- //! Inserts information about a raster geometry associated to an object
- /*!
- \param tableName name of the table that stores the raster representation
- \param par raster parameters
- \param objectId identification of the object associated to the raster geometry
- */
- virtual bool insertRasterGeometry(const string& tableName, TeRasterParams& par, const string& objectId = "");
-
- //! Updates the information about the raster geometry associated to an object of a layer
- /*!
- \param layerId layer unique database identification
- \param par raster parameters
- \param objectId identification of the object associated to the raster geometry
- */
- virtual bool updateRasterRepresentation(int layerId, TeRasterParams& par, const string& objectId="");
-
- //! Returns the name of the table where the raster geometry associated to an object of a leyr
- /*!
- \param layerId layer unique database identification
- \param objectId identification of the object associated to the raster geometry
- */
- virtual string getRasterTable(int layerId, const string& objectId);
-
- //! Inserts metadata information about a particular raster geometry
- /*!
- \param tableName name of the table that stores the metadata
- \param geomId geometry unique database identification
- \param par raster parameters
- */
- virtual bool insertRasterMetadata (const string& tableName, int geomId, TeRasterParams& par);
-
- //! Updates metadata information about a particular raster geometry
- /*!
- \param tableName name of the table that stores the metadata
- \param geomId geometry unique database identification
- \param par raster parameters
-
- */
- virtual bool updateRasterMetadata (const string& tableName, int geomId, TeRasterParams& par);
- //@}
- /** @name Views
- * Retrieving/Inserting/Modifying/Deleting views in the database.
- */
- //@{
- //! Inserts a view
- virtual bool insertView (TeView *view) = 0;
-
- //! Updates a view
- virtual bool updateView (TeView *view);
-
- //! Loads a set of views belonging to a user
- /*
- \param user the user name
- \param loadAttrList indicates if the attribute list of each attribute table should be loaded
- \param visualClass identifies which concrete class od visual should be instantiated.
- The default is TerraLib basic visual.
- */
- virtual bool loadViewSet (const string& user, const bool& loadAttrList = true, const string& visualClass="tevisual");
-
- //! Load a view
- /*
- \param view a pointer to a view that will be loaded from database
- \param loadAttrList indicates if the attribute list of each attribute table should be loaded
- \param visualClass identifies which concrete class od visual should be instantiated.
- The default is TerraLib basic visual.
- */
- virtual bool loadView (TeView* view, const bool& loadAttrList = true, const string& visualClass="tevisual");
-
- //! Delete a view
- virtual bool deleteView (int viewId);
-
- //! Recursive inserting of a view tree.
- virtual bool insertViewTree (TeViewTree *tree) = 0;
-
- //! Recursive load view tree.
- /*
- \param view a pointer to a view that will be loaded from database
- \param id a specific theme or viewtree id of this view that will be loaded from database
- \param loadAttrList indicates if the attribute list of each attribute table should be loaded
- \param visualClass identifies which concrete class od visual should be instantiated.
- The default is TerraLib basic visual.
- */
- virtual TeViewTree* loadViewTree(TeView* view, int id, const bool& loadAttrList = true, const string& visualClass = "tevisual");
-
- //! Recusive updating of a view tree.
- virtual bool updateViewTree (TeViewTree *tree);
-
- //! Check whether a given view already exists in the database
- virtual bool viewExist(string viewName);
-
- //@}
-
- /** @name Themes
- * Retrieving/Inserting/Modifying/Deleting themes and group of themes in the database.
- */
- //@{
- //! Inserts a group of themes in the database
- virtual bool insertThemeGroup (TeViewTree* tree) = 0;
-
- //! Inserts an abstract theme in the database.
- virtual bool insertTheme (TeAbstractTheme *theme) = 0;
-
- //! Updates an asbtract theme in the database
- virtual bool updateTheme (TeAbstractTheme *theme);
-
- //! Loads a theme from the database
- virtual bool loadTheme (TeAbstractTheme *theme, const bool& loadAttrList = true, const string& visualClass = "tevisual");
-
- //! Loads all attribute tables of a theme
- virtual bool loadThemeTable (TeTheme* theme, const bool& loadAttrList = true);
-
- //! Erases the theme group identified by themeId
- virtual bool deleteThemeGroup (int themeId);
-
- //! Erases the theme identified by themeId
- virtual bool deleteTheme (int themeId);
-
- //! Erases the legends of a theme identified by themeId
- virtual bool deleteLegend (int themeId);
-
- //! Inserts information about a table used by a theme
- bool insertThemeTable(TeTheme *theme, TeTable& inputTable);
-
- //! Inserts information about a table used by a theme
- virtual bool insertThemeTable (int themeId, int tableId, int relationId, int tableOrder) = 0;
-
- //! Updates information about the tables used by a theme
- virtual bool updateThemeTable (TeTheme *theme);
-
- //! Removes a table from the theme
- bool removeThemeTable(TeTheme *theme, int tableOrder);
-
- //! Inserts information about a grouping used in a theme
- virtual bool insertGrouping (int themeId, const TeGrouping& grouping);
-
- //! Updates information about a grouping used in a theme
- virtual bool updateGrouping (int themeId, const TeGrouping& grouping);
-
- //! Generates the label position (x,y) to each object of a theme or of a particular object
- virtual bool generateLabelPositions(TeTheme *theme, const std::string& objectId = "");
-
- //! Check whether a given theme already exists in the database
- virtual bool themeExist(string themeName);
-
- //! Checks whether a given theme name is valid or already exists in the database
- /*!
- \param n theme name to be checked
- \return the modified valid theme name
- */
- virtual string getNewThemeName(const string& n);
-
- //@}
-
- /** @name Legend
- * Retrieving/Inserting/Modifying/Deleting legends in the database.
- */
- //@{
- //! Inserts legend in the database
- virtual bool insertLegend (TeLegendEntry *legend) = 0;
- //! Updates legend entries in the database
- virtual bool updateLegend (TeLegendEntry *legend);
-
- virtual bool updateLegend (vector<TeLegendEntry>& legVec);
- virtual bool loadLegend (TeAbstractTheme *theme, const string& visualClass = "tevisual");
- virtual bool updateVisual (TeLegendEntry *legend);
- virtual bool updateVisual (vector<TeLegendEntry>& legVec);
- //@}
-
- /** @name Polygon
- // Accessing/Inserting/Modifying polygon geometries into the database
- */
- //@{
- //! Inserts a polygon set in a geometry table
- virtual bool insertPolygonSet (const string& table, TePolygonSet &ps);
-
- //! Updates a polygon set in a geometry table
- virtual bool updatePolygonSet (const string& table, TePolygonSet &ps);
-
- //! Returns all polygons in a table given a criteria expressed as an SQL where statement
- virtual bool selectPolygonSet (const string& table, const string& criteria, TePolygonSet &ps);
-
- //! Returns all polygons that represents objects of a particular theme
- virtual bool loadPolygonSet (TeTheme* theme, TePolygonSet &ps);
-
- //! Returns all polygons that represents objects of a particular geoid
- virtual bool loadPolygonSet (const string& table, const string& geoid, TePolygonSet &ps);
-
- //! Returns all polygons inside a given box
- virtual bool loadPolygonSet (const string& table, TeBox &box, TePolygonSet &ps);
-
- //! Returns a database portal to iterate over the polygons that are inside a given box
- /*
- \return A database portal pointer if there is any polygons inside the box
- \return A null pointer if there isn't polygons to iterate
- \note The database portal pointer should be deleted by the application
- */
- virtual TeDatabasePortal* loadPolygonSet(const string& table, TeBox &box);
-
- //! Returns the first polygon that contais a given coordinate
- virtual bool locatePolygon (const string& table, TeCoord2D &pt, TePolygon &polygon, const double& tol = 0.0);
-
- //! Returns the polygons that contains a give coordinate
- virtual bool locatePolygonSet (const string& table, TeCoord2D &pt, double tol, TePolygonSet &polygons);
-
- //! Inserts a polygon in a geometry table
- virtual bool insertPolygon (const string& table, TePolygon &p) = 0;
-
- //! Updates a polygon in a geometry table
- virtual bool updatePolygon (const string& table, TePolygon &p) = 0;
- //@}
-
- /** @name Line
- * Accessing/Inserting/Modifying Line geometries into the database.
- */
- //@{
- // Accessing/Inserting line geometries into the database
- virtual bool insertLineSet (const string& table, TeLineSet &ls);
- virtual bool updateLineSet (const string& table,TeLineSet &ls);
- virtual bool loadLineSet (const string& table, const string& geoid, TeLineSet &ls);
- virtual bool loadLineSet (TeTheme* theme, TeLineSet &ls);
- virtual bool loadLineSet (const string& table, TeBox &box, TeLineSet &linSet);
- virtual TeDatabasePortal* loadLineSet (const string& table, TeBox &box);
- virtual bool selectLineSet (const string& table, const string& criteria, TeLineSet &ls);
-
- virtual bool insertLine (const string& table, TeLine2D &l) = 0;
- virtual bool updateLine (const string& table, TeLine2D &l) = 0;
- virtual bool locateLine (const string& table, TeCoord2D &pt, TeLine2D &line, const double& tol = 0.0);
- virtual bool locateLineSet (const string& table, TeCoord2D &pt, TeLineSet & ls, const double& tol = 0.0);
-
- //@}
-
- /** @name Point
- * Accessing/Inserting/Modifying Point geometries into the database.
- */
- //@{
- // Accessing/Inserting point geometries into the database
- virtual bool insertPointSet (const string& table, TePointSet &ps);
- virtual bool updatePointSet (const string& table, TePointSet &ps);
- virtual bool loadPointSet (const string& table, TeBox &box, TePointSet &ps);
- virtual TeDatabasePortal* loadPointSet (const string& table, TeBox &box);
- virtual bool loadPointSet (const string& table, const string& geoid, TePointSet &ps);
- virtual bool loadPointSet (TeTheme* theme, TePointSet &ps);
- virtual bool selectPointSet (const string& table, const string& criteria, TePointSet &ps);
-
- virtual bool insertPoint (const string& table, TePoint &p) = 0;
- virtual bool updatePoint (const string& table, TePoint &p);
- virtual bool locatePoint (const string& table, TeCoord2D &pt, TePoint &point, const double& tol = 0.0);
- virtual bool locatePointSet (const string& table, TeCoord2D &pt, TePointSet &pointSet, const double& tol=0.0);
- //@}
-
- /** @name Text
- * Accessing/Inserting/Modifying Text geometries into the database.
- */
- //@{
- // Accessing/Inserting text geometries into the database
- virtual bool insertTextSet (const string& table, TeTextSet &ts);
- virtual bool updateTextSet (const string& table, TeTextSet &ts);
- virtual bool loadTextSet (const string& table, const string& geoid, TeTextSet &ts);
- virtual bool selectTextSet (const string& table, const string& criteria, TeTextSet &ts);
-
- virtual bool insertText (const string& table, TeText &t) = 0;
- virtual bool updateText (const string& table, TeText &t);
- virtual bool locateText (const string& table, TeCoord2D &pt, TeText &text, const double& tol = 0.0);
- virtual bool locateTextSet (const string& table, TeCoord2D &pt, TeTextSet &textSet, const double& tol = 0.0);
- //@}
-
- /** @name Arc
- * Accessing/Inserting/Modifying Arc geometries into the database.
- */
- //@{
- //! Inserts an arc set geometry in the database.
- virtual bool insertArcSet (const string& table, TeArcSet &as);
-
- //! Updates arc set geometry in the database.
- virtual bool updateArcSet (const string& table, TeArcSet &as);
-
- //! Loads an arc geometry from the database that has the specified object id (geoid).
- virtual bool loadArcSet (const string& table, const string& geoid, TeArcSet &as);
-
- //! Inserts an arc geometry in the database.
- virtual bool insertArc (const string& table,TeArc &arc) = 0;
-
- //! Updates an arc geometry in the database.
- virtual bool updateArc (const string& table,TeArc &arc);
- //@}
-
- /** @name Node
- * Accessing/Inserting/Modifying Node geometries into the database.
- */
- //@{
- // Accessing/Inserting node geometries into the database
- virtual bool insertNodeSet (const string& table, TeNodeSet &ns);
- virtual bool updateNodeSet (const string& table, TeNodeSet &ns);
- virtual bool loadNodeSet (const string& table, const string& geoid, TeNodeSet &ps);
-
- virtual bool insertNode (const string& table, TeNode &node) = 0;
- virtual bool updateNode (const string& table, TeNode &node);
- //@}
-
- /** @name Cell
- * Accessing/Inserting/Modifying Cell geometries into the database.
- */
- //@{
- // Accessing/Inserting cell geometries into the database
- virtual bool insertCellSet (const string& table, TeCellSet &cs);
- virtual bool updateCellSet (const string& table, TeCellSet &cs);
- virtual bool loadCellSet (const int& layerId, const string& table, const string& geoid, TeCellSet &cs);
- virtual bool selectCellSet (const int& layerId, const string& table, const string& criteria, TeCellSet &cs);
-
- virtual bool insertCell (const string& table, TeCell &c) = 0;
- virtual bool updateCell (const string& table, TeCell &c);
- virtual bool locateCell (const string& table, TeCoord2D &pt, TeCell &c, const double& tol = 0.0);
- //@}
-
- //! Insert a raster block into the database
- /*!
- \param table table name
- \param blockId block unique identifier
- \param ll block lower left coordinate
- \param ur block upper right coordinate
- \param buf block binary data
- \param size block size
- \param band block band
- \param res block resolution factor
- \param subband sub band definitiion
- */
- virtual bool insertRasterBlock(const string& table, const string& blockId, const TeCoord2D& ll, const TeCoord2D& ur, unsigned char *buf,unsigned long size, int band=0, unsigned int res=1, unsigned int subband=0) = 0;
-
- //! Inserts the entire visual of a Legend
- virtual bool insertVisual (TeLegendEntry *legend);
-
- //! Insert raster visual
- virtual bool insertRasterVisual (int themeId , TeRasterVisual* rasterVisual);
-
- //! Returns the raster associated to a layer
- virtual TeRaster* loadLayerRaster(int layerId, const string& objectId="", const char& mode = 'r');
-
- //! Creates a lookup table (used for pallete raster representations)
- virtual bool createLUTTable(const string& name);
-
- //! Loads a look up table associated to a raster and fills its parameters
- virtual bool loadRasterLUT(TeRasterParams* par);
-
- //! Creates a spatial index for a spatial table. In order to get correct column names to index, see getSpatialIdxColumn method.
- virtual bool createSpatialIndex(const string& table, const string& columns, TeSpatialIndexType /*type*/ = TeRTREE,short /* level */ =0,short /* tile */ =0);
-
- //! Creates a spatial metadata for a spatial table. It is implemented only in spatial databases.
- virtual bool insertMetadata(const string& /* table */, const string& /* column */, double /* tolx */, double /* toly */,TeBox &/* box */,short /* srid */ =0) { return true; };
-
- //! Returns the name of the column that wiil be the spatially indexed, for a given type of geometry table
- virtual string getSpatialIdxColumn(TeGeomRep rep);
-
- //! Update box information in a table that has a set of columns to store a box value
- /*
- This method gives to the drivers the ability to update box columns, considering precision issues
- that are particular to the driver. The box should be stored in 4 columns (lower_x, lower_y, upper_x, upper_y)
- \param tableName table name
- \param keyColumnName name of the column that is primary key
- \param idValue key value of the row that should be updated
- \param box new box value
- */
- virtual bool updateBBox(const string& tableName, const string& keyColumnName, int keyValue, const TeBox& box);
-
-
- /** @name Spatial Operations with vector data
- * spatial operations over geometries into the database.
- */
- //@{
-
- /** @name topologic relation query
- * topologic relation query over geometries into the database.
- */
- //@{
- /*!
- \brief Returns the geometries of a geometric table (actGeomTable) that have a specific spatial relation (relate) with a subset of geometries of this table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the geometric table
- \param actIdsIn identifiers of a geometry subset of the actGeomTable table
- \param portal a pointer to a database portal that will contain the resulted geometries
- \param relate spatial relation
- \param actCollTable collection table name
- */
- virtual bool spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- TeDatabasePortal *portal, int relate, const string& actCollTable="");
-
- /*!
- \brief Returns the geometries of a geometric table (visGeomTable) that have a specific spatial relation (relate) with a subset of geometries of other geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param actIdsIn identifiers of a geometry subset of the actGeomTable table
- \param visGeomTable geometric table name
- \param visRep geometric representation of the visGeomTable table
- \param portal a pointer to a database portal that will contain the resulted geometries
- \param relate spatial relation
- \param visCollTable collection table name associated with the visGeomTable table
- */
- virtual bool spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- const string& visGeomTable, TeGeomRep visRep, TeDatabasePortal *portal,
- int relate, const string& visCollTable="");
-
- /*!
- \brief Returns the geometries of a geometric table (actGeomTable) that have a specific spatial relation (relate) with a geometry in memory (geom)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param geom a pointer to a geometry in memory
- \param portal a pointer to a database portal that will contain the resulted geometries
- \param relate spatial relation
- \param actCollTable collection table name associated with the actGeomTable table
- */
- virtual bool spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeGeometry* geom,
- TeDatabasePortal *portal, int relate, const string& actCollTable="");
-
- /*!
- \brief Returns the geometries of a geometric table (actGeomTable) that have a specific spatial relation (relate) with a subset of geometries of this table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the geometric table
- \param actIdsIn identifiers of a geometry subset of the actGeomTable table
- \param actIdsOut structure that will contain the identifiers of the resulted geometries
- \param relate spatial relation
- \param actCollTable collection table name
- */
- virtual bool spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- TeKeys& actIdsOut, int relate, const string& actCollTable="");
-
- /*!
- \brief Returns the geometries of a geometric table (visGeomTable) that have a specific spatial relation (relate) with a subset of geometries of other geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param actIdsIn identifiers of a geometry subset of the actGeomTable table
- \param visGeomTable geometric table name
- \param visRep geometric representation of the visGeomTable table
- \param visIdsOut structure that will contain the identifiers of the resulted geometries
- \param relate spatial relation
- \param visCollTable collection table name associated with the visGeomTable table
- */
- virtual bool spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- const string& visGeomTable, TeGeomRep visRep, TeKeys& visIdsOut, int relate,
- const string& visCollTable="", TeDatabase* = 0);
-
- /*!
- \brief Returns the geometries of a geometric table (actGeomTable) that have a specific spatial relation (relate) with a geometry in memory (geom)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param geom a pointer to a geometry in memory
- \param actIdsOut structure that will contain the identifiers of the resulted geometries
- \param relate spatial relation
- \param actCollTable collection table name associated with the actGeomTable table
- */
- virtual bool spatialRelation(const string& actGeomTable, TeGeomRep actRep, TeGeometry* geom,
- TeKeys& actIdsOut, int relate, const string& actCollTable="");
- //@}
-
- /** @name metric functions
- * metric functions over geometries into the database.
- */
- //@{
- /*!
- \brief Calculates the area of a geometry set of the geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the geometric table
- \param actIdsIn identifiers of the geometry set of the actGeomTable table
- \param area the returned area value
- */
- virtual bool calculateArea(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, double &area);
-
- /*!
- \brief Calculates the length of a geometry set of the actGeomTable table
- \param actGeomTable geometric table name
- \param actRep geometric representation of the geometric table
- \param actIdsIn identifiers of the geometry set of the actGeomTable table
- \param length the returned length value
- */
- virtual bool calculateLength(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, double &length);
-
- /*!
- \brief Calculates the distance between two geometries of the actGeomTable table
- \param actGeomTable geometric table name
- \param actRep geometric representation of the geometric table
- \param Ids identifiers of the two geometries of the actGeomTable table
- \param distance the returned distance value
- */
- virtual bool calculateDistance(const string& actGeomTable, TeGeomRep actRep, TeKeys& Ids, double& distance);
-
- /*!
- \brief Calculates the distance between a geometry of a geometric table (actGeomTable) and a geometry of other geometric table (visGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param objId1 identifier of the geometry of the actGeomTable table
- \param visGeomTable geometric table name
- \param visRep geometric representation of the visGeomTable table
- \param objId2 identifier of the geometry of the visGeomTable table
- \param distance the returned distance value
- */
- virtual bool calculateDistance(const string& actGeomTable, TeGeomRep actRep, const string& objId1,
- const string& visGeomTable, TeGeomRep visRep, const string& objId2, double& distance);
-
- /*!
- \brief Returns the geometries of a geometric table (actGeomTable) that are within a specific distance from a point in memory
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param point a point in memory
- \param IdsDistOut structure that will contain the identifiers of the resulted geometries and their distances
- \param max_distance maximum distance
- \param actCollTable collection table name associated with the actGeomTable table
- */
- virtual bool withinDistance(const string& actGeomTable, TeGeomRep actRep, const TeCoord2D& point,
- TeKeysToDist& IdsDistOut, const double& max_distance, const string& actCollTable="");
- //@}
-
-
- /** @name functions that generate new geometries
- * functions that generate new geometries over geometries into the database.
- */
- //@{
- /*!
- \brief Returns the buffers with a specific distance of a geometry set of a geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the geometric table
- \param actIds identifiers of the geometry set of the actGeomTable table
- \param bufferSet the returned buffers
- \param dist the distance of the buffers
- */
- virtual bool buffer(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TePolygonSet& bufferSet, double dist);
-
- /*!
- \brief Returns the centroids of a geometry set of a geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the geometric table
- \param centroidSet the returned centroids
- \param actIds identifiers of the geometry set of the actGeomTable table
- \param actCollTable collection table name associated with the actGeomTable table
- */
- virtual bool centroid(const string& actGeomTable, TeGeomRep actRep, TePointSet& centroidSet, TeKeys actIds = vector<string>(), const string& actCollTable = "");
-
- /*!
- \brief Returns the convex geometries of a geometries set of a geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the geometric table
- \param actIds identifiers of the geometry set of the actGeomTable table
- \param convexHullSet the returned convex geometries
- */
- virtual bool convexHull(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TePolygonSet& convexHullSet);
- //@}
-
- /*!
- \brief Returns the nearest neighbors of a specific geometry of a geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actCollTable collection table name associated with the actGeomTable table
- \param actRep geometric representation of the geometric table
- \param objId1 identifier of the geometry of the actGeomTable table
- \param actIdsOut structure that will contain the identifiers of the nearest neighbors
- \param numRes the number of nearest neighbors that will be returned
- */
- virtual bool nearestNeighbors(const string& actGeomTable, const string& actCollTable,
- TeGeomRep actRep, const string& objId1, TeKeys& actIdsOut, int numRes=1);
-
- /*!
- \brief Returns the nearest neighbors of a geometric table (visGeomTable) of a specific geometry of other geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param objId1 identifier of the geometry of the actGeomTable table
- \param visGeomTable geometric table name
- \param visCollTable collection table name associated with the visGeomTable table
- \param visRep geometric representation of the visGeomTable table
- \param visIdsOut structure that will contain the identifiers of the nearest neighbors
- \param numRes the number of nearest neighbors that will be returned
- */
- virtual bool nearestNeighbors(const string& actGeomTable, TeGeomRep actRep, const string& objId1,
- const string& visGeomTable, const string& visCollTable,
- TeGeomRep visRep, TeKeys& visIdsOut, int numRes=1);
-
- /*!
- \brief Returns the nearest neighbors of a specific geometry of a geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actCollTable collection table name associated with the actGeomTable table
- \param actRep geometric representation of the geometric table
- \param objId1 identifier of the geometry of the actGeomTable table
- \param portal a pointer to a database portal that will contain the identifiers of the nearest neighbors
- \param numRes the number of nearest neighbors that will be returned
- */
- virtual bool nearestNeighbors(const string& actGeomTable, const string& actCollTable,
- TeGeomRep actRep, const string& objId1, TeDatabasePortal* portal, int numRes=1);
-
- /*!
- \brief Returns the nearest neighbors of a geometric table (visGeomTable) of a specific geometry of other geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param objId1 identifier of the geometry of the actGeomTable table
- \param visGeomTable geometric table name
- \param visCollTable collection table name associated with the visGeomTable table
- \param visRep geometric representation of the visGeomTable table
- \param portal a pointer to a database portal that will contain the identifiers of the nearest neighbors
- \param numRes the number of nearest neighbors that will be returned
- */
- virtual bool nearestNeighbors(const string& actGeomTable, TeGeomRep actRep,
- const string& objId1, const string& visGeomTable, const string& visCollTable,
- TeGeomRep visRep, TeDatabasePortal* portal, int numRes=1);
-
- /** @name set functions
- * functions of set: union, intersection, difference and symmetrical difference.
- */
- //@{
-
- /*!
- \brief Returns the intersection between two geometries of a geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param actIds identifiers of the geometry set of the actGeomTable table
- \param geomVect the returned intersection
- */
- virtual bool geomIntersection(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TeGeometryVect& geomVect);
-
- /*!
- \brief Returns the intersection between a geometry of a geometric table (actGeomTable) and a geometry of other geometric table (visGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param objId1 identifier of a geometry of the actGeomTable table
- \param visGeomTable geometric table name
- \param visRep geometric representation of the visGeomTable table
- \param objId2 identifier of other geometry of the visGeomTable table
- \param geomVect the returned intersection
- */
- virtual bool geomIntersection(const string& actGeomTable, TeGeomRep actRep, const string& objId1,
- const string& visGeomTable, TeGeomRep visRep, const string& objId2, TeGeometryVect& geomVect);
-
- /*!
- \brief Returns the difference between two geometries of a geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param objId1 identifier of a geometry of the actGeomTable table
- \param objId2 identifier of other geometry of the actGeomTable table
- \param geomVect the returned difference
- */
- virtual bool geomDifference(const string& actGeomTable, TeGeomRep actRep, const string& objId1,
- const string& objId2, TeGeometryVect& geomVect);
-
- /*!
- \brief Returns the difference between a geometry of a geometric table (actGeomTable) and a geometry of other geometric table (visGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param objId1 identifier of a geometry of the actGeomTable table
- \param visGeomTable geometric table name
- \param visRep geometric representation of the visGeomTable table
- \param objId2 identifier of other geometry of the visGeomTable table
- \param geomVect the returned difference
- */
- virtual bool geomDifference(const string& actGeomTable, TeGeomRep actRep, const string& objId1,
- const string& visGeomTable, TeGeomRep visRep, const string& objId2, TeGeometryVect& geomVect);
-
- /*!
- \brief Returns the union between geometries of a geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param actIds identifiers of the geometry set of the actGeomTable table
- \param geomVect the returned union
- */
- virtual bool geomUnion(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TeGeometryVect& geomVect);
-
- /*!
- \brief Returns the union between a geometry of a geometric table (actGeomTable) and a geometry of other geometric table (visGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param objId1 identifier of a geometry of the actGeomTable table
- \param visGeomTable geometric table name
- \param visRep geometric representation of the visGeomTable table
- \param objId2 identifier of other geometry of the visGeomTable table
- \param geomVect the returned union
- */
- virtual bool geomUnion(const string& actGeomTable, TeGeomRep actRep, const string& objId1,
- const string& visGeomTable, TeGeomRep visRep, const string& objId2, TeGeometryVect& geomVect);
-
- /*!
- \brief Returns the symmetrical difference between two geometries of a geometric table (actGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param objId1 identifier of a geometry of the actGeomTable table
- \param objId2 identifier of other geometry of the actGeomTable table
- \param geomVect the returned symmetrical difference
- */
- virtual bool geomXOr(const string& actGeomTable, TeGeomRep actRep, const string& objId1,
- const string& objId2, TeGeometryVect& geomVect);
-
- /*!
- \brief Returns the symmetrical difference between a geometry of a geometric table (actGeomTable) and a geometry of other geometric table (visGeomTable)
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param objId1 identifier of a geometry of the actGeomTable table
- \param visGeomTable geometric table name
- \param visRep geometric representation of the visGeomTable table
- \param objId2 identifier of other geometry of the visGeomTable table
- \param geomVect the returned symmetrical difference
- */
- virtual bool geomXOr(const string& actGeomTable, TeGeomRep actRep, const string& objId1,
- const string& visGeomTable, TeGeomRep visRep, const string& objId2, TeGeometryVect& geomVect);
- //@}
-
- /** @name Spatial Operations with raster data
- * spatial operations over raster data into the database.
- */
- //@{
- /*!
- \brief Returns the statistics of raster data regions inside a geometry set of a geometric table (actGeomTable)
- \param rasterTable raster table name
- \param actGeomTable geometric table name that contains polygons
- \param Ids identifiers of the geometries of the actGeomTable table that define the regions in the raster data
- \param result structure that will contain the resulted statistics
- */
- virtual bool zonal(const string& rasterTable, const string& actGeomTable, TeKeys& Ids, TeObjectStatistics& result);
-
- /*!
- \brief Returns the statistics of raster data regions inside a geometry set of a geometric table (actGeomTable)
- \param rasterTable raster table name
- \param actGeomTable geometric table name that contains polygons
- \param actCollTable collection table that contains the identifiers of the geometries of the actGeomTable table that define the regions in the raster data
- \param result structure that will contain the resulted statistics
- */
- virtual bool zonal(const string& rasterTable, const string& actGeomTable, const string& actCollTable, TeObjectStatistics& result);
-
- /*!
- \brief Returns the statistics of a raster data region inside a geometry in memory
- \param rasterTable raster table name
- \param poly the geometry in memory that define a region in the raster data
- \param result structure that will contain the resulted statistics
- */
- virtual bool zonal(const string& rasterTable, TePolygon& poly, TeStatisticsDimensionVect& result);
-
- /*!
- \brief Clips a raster data from a geometry of a geometric table (actGeomTable)
- \param rasterTable raster table name
- \param actGeomTable geometric table name that contains polygons
- \param objId identifier of the geometry of the actGeomTable table
- \param nameLayerOut the layer name that will contain the result
- \param st the strategy used in the clipping of the raster data
- */
- virtual bool mask(const string& rasterTable, const string& actGeomTable, const string& objId, const string& nameLayerOut, TeStrategicIterator st);
-
- /*!
- \brief Clips a raster data from a geometry in memory (poly)
- \param rasterTable raster table name
- \param poly a geometry in memory
- \param nameLayerOut the layer name that will contain the result
- \param st the strategy used in the clipping of the raster data
- */
- virtual bool mask(const string& rasterTable, TePolygon& poly, const string& nameLayerOut, TeStrategicIterator st);
- //@}
-
- /** @name specifics SQLs
- * return SQL strings
- */
- //@{
- //! Return a string that describes a where clause in SQL to return the geometries inside the box
- virtual string getSQLBoxWhere (TeBox &box, TeGeomRep rep);
-
- //! Return a string that describes a where clause in SQL to return the geometries of the table2 that are
- //! inside the geometries box of the table1 (table1 must have lower_x, lower_y...)
- virtual string getSQLBoxWhere (const string& table1, const string& table2, TeGeomRep rep2, TeGeomRep rep1 = TePOLYGONS);
-
- //! Return a string SQL to be used in the clause SELECT to select the box (lower_x, lower_y, upper_x, upper_y)
- virtual string getSQLBoxSelect (const string& tableName, TeGeomRep rep);
-
- //! Return a string SQL to calculate the statistics of some attributes
- virtual string getSQLStatistics (TeGroupingAttr& attrs);
-
- //! Return the database function in SQL to generate autonumber values
- virtual string getSQLAutoNumber(const string& table);
-
- //! Return a string SQL to temporal where
- virtual string getSQLTemporalWhere (TeTimeInterval& /* timeInterval */, TeTemporalRelation /* timeOperator */, const string& /* initialTime */, const string& /* finalTime */ );
-
- //! Return a string SQL to temporal where
- virtual string getSQLTemporalWhere (const string& temporalRest);
-
- //! Return a string SQL to temporal where
- virtual string getSQLTemporalWhere(int /* time1 */, int /* time2 */, TeChronon /* chr */, TeTemporalRelation /* rel */, const string& /* initialTime */, const string& /* finalTime */);
-
- //! Returns a valid SQL time string
- virtual string getSQLTime(TeTime& /* time */) { return ""; };
-
- //! Returns a SQL temporal expression applied to a column
- virtual string getSQLTemporalFunction (TeChronon chr, const string& colName);
- //@}
-
- //! Return the box of a specific geometry (object_id)
- virtual bool getMBRGeom(string tableGeom, string object_id, TeBox& box, string colGeom);
-
- //! Return the box of a select objects set
- virtual bool getMBRSelectedObjects(string geomTable,string colGeom, string fromClause,
- string whereClause, string afterWhereClause, TeGeomRep repType,TeBox &bout, const double& tol = 0.0);
-
- //! Gets the list of attributes of a table
- virtual bool getAttributeList(const string& tableName,TeAttributeList& attList);
-
- //! Escape special characters in a string to be used in a SQL statement
- virtual string escapeSequence(const string& from) = 0;
-
- //! Returns theme box
- virtual TeBox getThemeBox(TeTheme* theme);
-
- //! Returns the container of legend title alias
- map<int, map<string, string> >& mapThemeAlias() {return metaModel_->mapThemeAlias();}
-
- //! Concat values in a vector using unionString as the join between each value
- virtual string concatValues(vector<string>& values, const string& unionString) = 0;
-
- //! Returns the SQL function for upper case
- virtual string toUpper(const string& value) = 0;
-
- //! Returns the SQL function for substring that starts from left to right with informed length.
- virtual string leftString(const string& /*name*/, const int& /*length*/){return "";}
-
- //! Write the given version as the terralib version in the database
- virtual bool updateVersionStamp(const string& version );
-
- //! Read and returns the terralib version from the database
- virtual bool loadVersionStamp( string& version );
-
- /** @name Transaction control methods
- \Note should be implemented by the drivers that has it. Default implementation
- is DO NOTHING.
- */
- //@{
- //! Begins a transaction
- virtual bool beginTransaction();
-
- //! Commits a transaction
- virtual bool commitTransaction();
-
- //! Rollbacks a transaction
- virtual bool rollbackTransaction();
- //@}
-
- //! Drops a database view
- virtual bool dropDBView(const string& dbViewName);
-
-protected :
-
- bool isConnected_; //!< indicates if the connection is open
- string host_; //!< host name of the database server
- string user_; //!< user name
- string password_; //!< user password
- string database_; //!< database name
- int portNumber_; //!< port number
- int errorNumber_; //!< error number
- string errorMessage_; //!< error message
- string dbmsName_; //!< DBMS name (Ado, MySQL, Postgres, OracleSpatial)
- TeSharedPtr<TeMetaModelCache> metaModel_; //!< Meta model: Layers, Themes, Views...
-
- //! Update metadata about an attribute table that had its name or columns changed
- void alterTableInfoInMemory(const string& updatedTableName, string oldTableName="");
-
- int transactionCounter_;//!< counts how many nested transactions have been opened
-
-private:
-
- TeDatabase(const TeDatabase& other);
-};
-
-//! An abstract access portal to a database
-/*! A portal has a concept of a record set, that is generated by a selection (query) on
- the data accessible through a connection to a database server.
- \sa TeDatabase, TeGeometry, TeTable, TeTheme, TeView, TeLayer
-
- */
-class TL_DLL TeDatabasePortal {
-protected:
-
-
- TeDatabase* db_; //!< the database associated to this portal
- TeAttributeList attList_; //!< the list of attributes associated to this portal
- int numRows_; //!< the number of rows in this portal
- int numFields_; //!< the number of fields in this portal
- string errorMessage_; //!< error message
- int errorNumber_; //!< error number
-
-public :
-
- //!Constructor
- TeDatabasePortal ();
-
- //! Destructor
- virtual ~TeDatabasePortal ();
-
- //! Returns the database associated to this portal
- TeDatabase* getDatabase()
- { return db_; }
-
- //! Executes a SQL query that opens a record set
- virtual bool query ( const string &qry, TeCursorLocation l = TeSERVERSIDE, TeCursorType t = TeUNIDIRECTIONAL, TeCursorEditType e = TeREADONLY, TeCursorDataType dt = TeTEXTCURSOR ) = 0;
-
- //! Fetchs the next row in a record set that shouldve been previously opened
- virtual bool fetchRow () = 0;
-
- //! Fetchs a particular row
- virtual bool fetchRow (int i) = 0;
-
- //! Frees the current record set
- virtual void freeResult () = 0;
-
- //! Gets the last error message
- virtual string errorMessage ()
- { return errorMessage_; }
-
- //! Gets the number of the last error message
- virtual int errorNum ()
- { return errorNumber_; }
-
-// virtual bool loadNetwork (TeLayer *layer) = 0;
-
-// specific SQL SELECT command methods
-
- /*! \brief Retrieves the number of rows in a portal. Some drivers
- (like PostgreSQL and PostGIS) brings to the client only
- a part of the row, and then this number can be less than
- the number of rows returned by query.
- */
- int numRows ()
- { return numRows_;}
-
- //! Retrieves the number of fields in this portal
- int numFields ()
- { return numFields_; }
-
- //! Retrieves attribute list in this portal
- TeAttributeList& getAttributeList()
- { return attList_; }
-
- //! Retrieves the i-th attribute in this portal
- TeAttribute getAttribute (int i);
-
- //! Retrieves an attribute by name
- TeAttribute getAttribute (const string& s);
-
- //! Gets the value of the i-th attribute as a literal
- virtual char* getData (int i) = 0;
-
- //! Gets the value of a named attribute as a literal
- virtual char* getData (const string& s) = 0;
-
- //! Gets the value of the i-th attribute as a double
- virtual double getDouble (int i);
-
- //! Gets the value of a named attribute as a double
- virtual double getDouble (const string& s);
-
- //! Gets the value of the i-th attribute as an integer
- virtual int getInt (int i);
-
- //! Gets the value of a named attribute as an integer
- virtual int getInt (const string& s);
-
- //! Gets the value of a named attribute as a boolean
- virtual bool getBool (const string& s) = 0;
-
- //! Gets the value of the i-th attribute as a boolean
- virtual bool getBool (int i) = 0;
-
- //! Gets the value of the i-th attribute as a date
- virtual TeTime getDate (int i) = 0;
-
- //! Gets the value of a named attribute as a date
- virtual TeTime getDate (const string& s) = 0;
-
- //! Gets the of a date/time attribute as a string formatted as accepted in further SQL statements
- virtual string getDateAsString(int i) = 0;
-
- //! Gets the of a date/time attribute as a string formatted as accepted in further SQL statements
- virtual string getDateAsString(const string& s) = 0;
-
- //! Gets the value of a named BLOB attribute
- virtual bool getBlob(const string& s, unsigned char* &data, long& size) = 0;
-
- //! Gets the index of a named attribute
- int getColumnIndex (const string& s);
-
- //! Gets the name of the i-th attribute
- string getColumnName (int i);
-
- /** @name Data Model
- The following methods decodify structures as stored
- in the database according to the data model proposed in TerraLib.
- */
- //@{
- virtual TeViewTree* getViewTree ();
- virtual TeLegendEntry getLegend();
- virtual void getVisual(TeVisual*);
- virtual bool getVisual(TeVisual* vis, TeGeomRep& rep, const unsigned int& initIndex);
- virtual bool getRasterVisual(TeRasterVisual& vis, const unsigned int& initIndex=0);
- virtual TeColor getColor();
- virtual bool getRasterBlock(unsigned long& size, unsigned char* ptData)=0;
- virtual bool getView(TeView& view, const unsigned int& initIndex=0);
- virtual bool getProjection(TeProjection** proj, const unsigned int& initIndex=0);
- virtual void getViewNodeParams (TeViewNodeParams& params, const unsigned int& initIndex=0);
- virtual bool getTheme(TeAbstractTheme& theme, const unsigned int& initIndex=0);
- virtual bool getGrouping(TeGrouping& group, const unsigned int& initIndex=0);
- virtual bool getLegend(TeLegendEntry& leg, const unsigned int& initIndex=0);
- virtual bool getAttrTable(TeTable& table, const unsigned int& initIndex=0);
- virtual bool getLayer(TeLayer& layer, const unsigned int& initIndex=0);
- virtual bool getRepresentation(TeRepresentation& rep, const unsigned int& initIndex=0);
-
- //@}
-
- /** @name Fetch Geometry
- The following methods decodify geometries as stored
- in the database according to the data model proposed in TerraLib.
- \param geom the geometry that will be filled from portal
- \param initIndex the position index in the portal where begins the geometry information
- \return The fetchGeometry methods advance the portal to the next record and
- they return TRUE if there are more records to be read and FALSE otherwise.
- */
- //@{
- virtual bool fetchGeometry (TePolygon& geom) = 0;
- virtual bool fetchGeometry (TePolygon& geom, const unsigned int& initIndex);
- virtual bool fetchGeometry (TeLine2D& geom) = 0;
- virtual bool fetchGeometry (TeLine2D& geom, const unsigned int& initIndex);
- virtual bool fetchGeometry (TeNode& geom) = 0;
- virtual bool fetchGeometry (TeNode& geom, const unsigned int& initIndex);
- virtual bool fetchGeometry (TePoint& geom) = 0;
- virtual bool fetchGeometry (TePoint& geom, const unsigned int& initIndex);
- virtual bool fetchGeometry (TeCell& geom);
- virtual bool fetchGeometry (TeCell& geom, const unsigned int& initIndex);
- virtual bool fetchGeometry (TeArc& geom);
- virtual bool fetchGeometry (TeArc& geom, const unsigned int& initIndex);
- virtual bool fetchGeometry (TeText& geom);
- virtual bool fetchGeometry (TeText& geom, const unsigned int& initIndex);
- //@}
-};
-
-
-/*! \example createDatabase.cpp
- Shows how to create a TerraLib database.
- */
-
-/*! \example databaseQuery.cpp
- Shows how to retrieve an existing layer from a TerraLib database,
- and execute some queries on its polygon geometry table.
- */
-
-/*! \example databaseSQLQuery.cpp
- Shows how retrieve geometries (polygons) using an SQL query.
- */
-
-/*! \example spatialQuery.cpp
- Shows how to use the database interface to do some spatial queries
- involving objects with points, lines and polygon geometries.
- */
-
-/*! \example spatialQueryAndBuffer.cpp
- Shows to use the database interface to do some spatial queries involving
- objects with points, lines and polygon geometries, and to generate a buffer operation.
- */
-#endif
-
diff --git a/src/terralib/kernel/TeDatabaseFactory.h b/src/terralib/kernel/TeDatabaseFactory.h
deleted file mode 100644
index b4eb3ee..0000000
--- a/src/terralib/kernel/TeDatabaseFactory.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDatabaseFactory.h
- \brief This file implements a factory of TerraLib database handlers
-*/
-
-#ifndef TEDATABASEFACTORY_H
- #define TEDATABASEFACTORY_H
-
- #include <TeDatabaseFactoryParams.h>
- #include <TeDatabase.h>
-
- /**
- * @brief This is the class for TeDatabase factory.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup DatabaseUtils
- */
- class TL_DLL TeDatabaseFactory :
- public TeFactory< TeDatabase, TeDatabaseFactoryParams >
- {
- public :
-
- /**
- * @brief Default Destructor
- */
- virtual ~TeDatabaseFactory() {};
-
- protected :
-
- /**
- * @brief Default constructor
- *
- * @param factoryName Factory name.
- */
- TeDatabaseFactory( const std::string& factoryName )
- : TeFactory< TeDatabase, TeDatabaseFactoryParams >( factoryName ) {};
- };
-
-#endif
diff --git a/src/terralib/kernel/TeDatabaseFactoryParams.cpp b/src/terralib/kernel/TeDatabaseFactoryParams.cpp
deleted file mode 100644
index 2c78166..0000000
--- a/src/terralib/kernel/TeDatabaseFactoryParams.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeDatabaseFactoryParams.h"
-
-
-TeDatabaseFactoryParams::TeDatabaseFactoryParams()
-{
- dbms_name_ = "";
- host_ = "";
- user_ = "";
- password_ = "";
- database_ = "";
- port_ = 0;
-}
-
-
-TeDatabaseFactoryParams::~TeDatabaseFactoryParams()
-{
-}
-
-
-bool TeDatabaseFactoryParams::operator==(
- const TeDatabaseFactoryParams& external ) const
-{
- if( ( dbms_name_ == external.dbms_name_ ) &&
- ( host_ == external.host_ ) &&
- ( user_ == external.user_ ) &&
- ( password_ == external.password_ ) &&
- ( database_ == external.database_ ) &&
- ( port_ == external.port_ ) ) {
-
- return true;
- } else {
- return false;
- }
-}
-
-
-const TeDatabaseFactoryParams& TeDatabaseFactoryParams::operator=(
- const TeDatabaseFactoryParams& external )
-{
- dbms_name_ = external.dbms_name_;
- host_ = external.host_;
- user_ = external.user_;
- password_ = external.password_;
- database_ = external.database_;
- port_ = external.port_;
-
- return external;
-}
-
-
-std::string TeDatabaseFactoryParams::decName() const
-{
- return dbms_name_;
-}
diff --git a/src/terralib/kernel/TeDatabaseFactoryParams.h b/src/terralib/kernel/TeDatabaseFactoryParams.h
deleted file mode 100644
index 82ecb4c..0000000
--- a/src/terralib/kernel/TeDatabaseFactoryParams.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDatabaseFactoryParams.h
- \brief This file contains the definition of parameters necessary to build a TeDatabase
-*/
-
-#ifndef TEDATABASEFACTORYPARAMS_H
- #define TEDATABASEFACTORYPARAMS_H
-
- #include "TeDefines.h"
- #include <string>
-
- /**
- * @brief This is the class for TeDatabase factory parameters .
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup DatabaseUtils
- */
- class TL_DLL TeDatabaseFactoryParams
- {
- public :
-
- std::string dbms_name_; //!< DBMS name (like PostgreSQL, PostGIS, MySQL and others).
- std::string host_; //!< Host name.
- std::string user_; //!< User name in order to stabilish a connection.
- std::string password_; //!< User password.
- std::string database_; //!< Database name.
- int port_; //!< Port number for network connection.
-
- //! Default constructor
- TeDatabaseFactoryParams();
-
- //! Default Destructor
- virtual ~TeDatabaseFactoryParams();
-
- //! operator== implementation.
- /*! \param external External reference.
- \return true if both instances are equal, false if not.
- */
- bool operator==( const TeDatabaseFactoryParams& external ) const;
-
- //! operator= implementation.
- /*! \param external External reference.
- \return A const reference to the external object instance.
- */
- const TeDatabaseFactoryParams& operator=(
- const TeDatabaseFactoryParams& external );
-
- //! This is for TeFactory compatibility.
- std::string decName() const;
- };
-#endif
diff --git a/src/terralib/kernel/TeDatum.cpp b/src/terralib/kernel/TeDatum.cpp
index d5ec863..d0c0c33 100644
--- a/src/terralib/kernel/TeDatum.cpp
+++ b/src/terralib/kernel/TeDatum.cpp
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#ifdef WIN32
#pragma warning ( disable: 4786 )
diff --git a/src/terralib/kernel/TeDatum.h b/src/terralib/kernel/TeDatum.h
index 06768ea..0e91adf 100644
--- a/src/terralib/kernel/TeDatum.h
+++ b/src/terralib/kernel/TeDatum.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeDatum.h
\brief This file contains structures and definitions to support the concept of a planimetric datum
*/
diff --git a/src/terralib/kernel/TeDecoder.h b/src/terralib/kernel/TeDecoder.h
deleted file mode 100644
index bc1bd79..0000000
--- a/src/terralib/kernel/TeDecoder.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2005 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoder.h
- \brief This file deals with decoding of raster structures
-*/
-#ifndef __TERRALIB_INTERNAL_DECODER_H
-#define __TERRALIB_INTERNAL_DECODER_H
-
-#include "TeDefines.h"
-#include "TeFactory.h"
-#include "TeCoord2D.h"
-#include "TeRasterParams.h"
-
-using namespace std;
-#include <string>
-#include <list>
-#include <map>
-
-class TeRaster;
-class TeDecoderMemory;
-class TeProjection;
-struct TeBox;
-
-//! An abstract class to decode raster data
-/*
- A decoder keeps its own copy of the parameters associated
- to the raster being decoded.
-*/
-class TL_DLL TeDecoder {
-
-public:
- //! Empty constructor
- TeDecoder() {}
-
- //! Constructor from raster parameters
- /*!
- \param par raster parameters
- */
- TeDecoder(const TeRasterParams& par) : params_(par) {}
-
- //! Virtual destructor
- virtual ~TeDecoder() {}
-
- //! Returns the raster parameters
- TeRasterParams& params()
- { return params_; }
-
- //! Updates the raster parameters
- void updateParams(TeRasterParams& par)
- { params_ = par; }
-
- //! Sets the value of a specific raster element
- /*!
- \param col element column identifier
- \param lin element line identifier
- \param val element value being inserted
- \param band element band identifier
- */
- virtual bool setElement(int col, int lin, double val, int band=0 ) = 0;
-
- //! An optimizated method to set values raster images
- /*
- This method should be used only to set the values of images with 3 bands associated
- to the three colour channes: RGB
- \param col column of the image
- \param lin line of the image
- \param Rval the value associated to the band 0 (associated to the R colour Channel)
- \param Gval the value associated to the band 1 (associated to the G colour Channel)
- \param Bval the value associated to the band 2 (associated to the B colour Channel)
- \param transp an optional transparency degree, with a range of 0 (totally transparent) to 255 (totally opaque)
- \return true if if succeed and false otherwise
- */
- virtual bool setElementRGB(int col, int lin, double Rval, double Gval, double Bval, unsigned int /*transp*/ = 255)
- {
- if (!setElement(col,lin,Rval,0))
- return false;
- if (!setElement(col,lin,Gval,1))
- return false;
- if (!setElement(col,lin,Bval,2))
- return false;
- return true;
- }
-
- //! Gets an specific element (col, lin, band) of a raster data
- /*!
- \param col element column identifier
- \param lin element line identifier
- \param val element value being retrieved
- \param band element band identifier
- */
- virtual bool getElement(int col, int lin, double& val, int band=0 ) = 0;
-
- //! Transforms a geographical coordinate to an index (lin, col) coordinate
- virtual TeCoord2D coord2Index (TeCoord2D &pt)
- { return params_.coord2Index(pt); }
-
- //! Transforms an index (lin, col) coordinate to a geographical coordinate
- virtual TeCoord2D index2Coord (TeCoord2D &pt)
- { return params_.index2Coord(pt); }
-
- //! Initializes the internal structures of the decoder from a raster parameters structure
- /*
- \param par the raster parameters structure
- */
- virtual void init( TeRasterParams& par )
- { params_= par; init();}
-
- //! Initializes the internal structures of the decoder
- virtual void init() = 0;
-
- //! Clears its internal structures
- virtual bool clear() = 0;
-
- //! Returns a default object - for compatibility reasons with TeDecoderFactory
- static TeDecoder* DefaultObject( const TeRasterParams& /* par */)
- { return 0; }
-
-/** @name Selection
- These routines are used to implement a selection of blocks or tiles
- that intercept a given bounding box, and provide sequential access to them.
- These routines should be implemented by concrete decoders to formats that support tilling.
-*/
-//@{
- //! Returns TRUE if it there are raster blocks that intersect a given box
- /*
- \param bb box that represents the interest region
- \param resFac resolution factor
- \param parBlock to return the common parameters of the blocks that are selected
- \returns TRUE if could select at least one block and FALSE otherwise
- */
- virtual bool selectBlocks(TeBox& /* bb */, int /* resFac */, TeRasterParams& /*parBlock*/)
- { return false; }
-
- //! Returns the number of blocks selected in the last block selection
- virtual int numberOfSelectedBlocks()
- { return 0; }
-
- //! Gets a decoder to the current selected block
- virtual bool getSelectedRasterBlock(TeDecoderMemory* /* memDec */)
- { return false; }
-
- //! Clear a previous block selection
- virtual void clearBlockSelection() {}
-
- //! Returns the raster best resolution level available to fill a given bounding box with a given number of lines and columns in a given projection
- /*
- \param bb box that represents the interest region
- \param ncols number of columns in the box
- \param nlines number of lines in the box
- \param proj pointer to the projection of the box
- */
- virtual int bestResolution(TeBox& /*bb*/, int /*ncols*/, int /*nlines*/, TeProjection* /*proj*/)
- { return 1; }
-
- //! Returns the raster resolution level available that is more similiar to a given desired resolution
- virtual int bestResolution(double /*res*/)
- { return 1; }
-
-
-//@}
-
-protected:
-
-//! The parameters that describes a raster data
- TeRasterParams params_;
-};
-
-//! A decoder abstract factory
-/*!
- Implements an abstract factory that builds appropriate decoders
- according to a string identifier.
-*/
-class TL_DLL TeDecoderFactory: public TeFactory<TeDecoder,TeRasterParams>
-{
-public:
-
- //! Maps synonyms to decoders identifiers (example "TIFF" or "tif" to a decoder to TIFF format)
- typedef map<string,string> TeNames2Decoders;
-
- //! Unique instance instance of map from synonyms to decoder identifiers
- static TeNames2Decoders& instanceName2Dec ()
- {
- static TeNames2Decoders names2dec_;
- return names2dec_;
- }
-
- //! Builds an appropriate decoder from a identifier
- TeDecoderFactory(const string& name) : TeFactory<TeDecoder,TeRasterParams>(name) { }
-
- //! Virtual destructor
- virtual ~TeDecoderFactory() {}
-};
-
-#endif
diff --git a/src/terralib/kernel/TeDecoderASCIIGrid.cpp b/src/terralib/kernel/TeDecoderASCIIGrid.cpp
deleted file mode 100644
index 0128b95..0000000
--- a/src/terralib/kernel/TeDecoderASCIIGrid.cpp
+++ /dev/null
@@ -1,416 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeException.h"
-#include "TeDecoderASCIIGrid.h"
-#include "TeAsciiFile.h"
-#include "TeUtils.h"
-
-#include <cstring>
-#include <fstream>
-using std::ifstream;
-using std::ofstream;
-
-/*
-Expected format for ESRI ASCII GRID Files (Copied from the ArcWorkstation 8.3 Help File):
-
-<NCOLS xxx>
-<NROWS xxx>
-<XLLCENTER xxx | XLLCORNER xxx>
-<YLLCENTER xxx | YLLCORNER xxx>
-<CELLSIZE xxx>
-{NODATA_VALUE xxx}
-row 1
-row 2
-.
-.
-.
-row n
-*/
-
-TeDecoderASCIIGrid::TeDecoderASCIIGrid (const TeRasterParams& par) :
- isModified_(false),
- size_(0),
- myData_(0)
-{
- params_.errorMessage_.clear();
- if (par.fileName_.empty())
- return;
- params_ = par;
- params_.decoderIdentifier_ = "ASCIIGRID";
- if (params_.mode_ == 'w' || params_.mode_ == 'r')
- readParameters();
-}
-
-TeDecoderASCIIGrid::~TeDecoderASCIIGrid ()
-{
- if ( isModified_ && (params_.mode_ == 'w' || params_.mode_ == 'c'))
- { // save contents to disk
- try
- {
- TeAsciiFile sFile(params_.fileName_,"w+");
- if (writeParameters(sFile))
- saveData(sFile);
- }
- catch (...)
- {
- }
- }
- delete [] myData_;
-}
-
-bool
-TeDecoderASCIIGrid::clear()
-{
- if ( isModified_ && (params_.mode_ == 'w' || params_.mode_ == 'c'))
- { // save contents to disk
- try
- {
- TeAsciiFile sFile(params_.fileName_,"w+");
- if (writeParameters(sFile))
- saveData(sFile);
- }
- catch (...)
- {
- }
- isModified_ = false;
- }
- if (myData_)
- delete [] myData_;
- myData_ = 0;
- return true;
-}
-
-bool
-TeDecoderASCIIGrid::readParameters()
-{
- try
- {
- TeAsciiFile pFile (params_.fileName_);
- string name;
- while (pFile.isNotAtEOF())
- {
- name = pFile.readString();
- if (TeStringCompare(name,"NCOLS"))
- break;
- }
- if (!pFile.isNotAtEOF()) // unexpected end of file
- return false;
- params_.ncols_ = pFile.readInt();
- pFile.findNewLine();
-
- while (pFile.isNotAtEOF())
- {
- name = pFile.readString();
- if (TeStringCompare(name,"NROWS"))
- break;
- }
- if (!pFile.isNotAtEOF()) // unexpected end of file
- return false;
- params_.nlines_ = pFile.readInt();
- pFile.findNewLine();
-
- bool isCenter = false;
- while (pFile.isNotAtEOF())
- {
- name = pFile.readString();
- if (TeStringCompare(name,"XLLCENTER"))
- {
- isCenter = true;
- break;
- }
- else if (TeStringCompare(name,"XLLCORNER"))
- break;
- }
- if (!pFile.isNotAtEOF()) // unexpected end of file
- return false;
- double llx = pFile.readFloat();
- pFile.findNewLine();
-
- while (pFile.isNotAtEOF())
- {
- name = pFile.readString();
- if (TeStringCompare(name,"YLLCENTER"))
- {
- isCenter = true;
- break;
- }
- else if (TeStringCompare(name,"YLLCORNER"))
- break;
- }
- if (!pFile.isNotAtEOF()) // unexpected end of file
- return false;
- double lly = pFile.readFloat();
- pFile.findNewLine();
-
- while (pFile.isNotAtEOF())
- {
- name = pFile.readString();
- if (TeStringCompare(name,"CELLSIZE"))
- break;
- }
- if (!pFile.isNotAtEOF()) // unexpected end of file
- return false;
- params_.resx_ = params_.resy_ = pFile.readFloat();
- pFile.findNewLine();
-
- while (pFile.isNotAtEOF())
- {
- name = pFile.readString();
- if (TeStringCompare(name,"NODATA_VALUE"))
- break;
- }
- double dummy = -9999.0;
- if (pFile.isNotAtEOF()) // unexpected end of file: NODATA statment is not present
- dummy = pFile.readFloat();
- params_.nBands(1);
- params_.setDataType(TeFLOAT);
- params_.setDummy(dummy);
- params_.setPhotometric(TeRasterParams::TeMultiBand);
- params_.lowerLeftResolutionSize(llx,lly,params_.resx_,params_.resy_,
- params_.ncols_,params_.nlines_,isCenter);
- TeProjection* pp = new TeNoProjection();
- params_.projection(pp);
- delete pp;
- }
- catch(...)
- {
- params_.errorMessage_ = "Fail to read the parameters from the raster the file.";
- return false;
- }
- return true;
-}
-
-bool
-TeDecoderASCIIGrid::readFile(const string& filename)
-{
- string valstring;
- try
- {
- TeAsciiFile pFile (filename);
- string name;
- while (pFile.isNotAtEOF() && !TeStringCompare(name,"NODATA_VALUE"))
- name = pFile.readString();
- if (!pFile.isNotAtEOF()) // unexpected end of file
- return false;
- pFile.findNewLine();
- double val;
- for (int lin = 0; lin < params_.nlines_; ++lin)
- {
- for (int col = 0; col < params_.ncols_; ++col)
- {
- val = pFile.readFloat();
- if (val != params_.dummy_[0])
- {
- setElement(col,lin,val);
- if (val < params_.vmin_[0])
- params_.vmin_[0] = val;
- if (val > params_.vmax_[0])
- params_.vmax_[0] = val;
- }
- }
- }
- }
- catch(...)
- {
- params_.errorMessage_ = "Fail to read the data from the raster the file.";
- return false;
- }
- return true;
-}
-
-void
-TeDecoderASCIIGrid::init()
-{
- params_.status_= TeRasterParams::TeNotReady;
- int nb = params_.nBands();
- if (nb != 1 )
- {
- params_.errorMessage_ = "Ascii-GRID can store raster with only 1 band.";
- return;
- }
-
- // try to allocate enough memory to hold the data
- if (size_ != params_.nlines_*params_.ncols_*params_.nBands())
- {
- size_ = params_.nlines_*params_.ncols_*params_.nBands();
- if (myData_)
- delete [] myData_;
- myData_ = new float [size_];
- }
- if (!myData_)
- return;
-
- for (long i=0; i<size_; myData_[i]=static_cast<float>(params_.dummy_[0]),++i);
-
- if (params_.mode_ == 'c') // creating a new file
- {
- ofstream dataFile(params_.fileName_.c_str()); // try to (re)create the file
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to (re)create the raster the file:" + params_.fileName_;
- return;
- }
- dataFile.close();
- try
- {
- TeAsciiFile sFile(params_.fileName_,"w+");
- if (!writeParameters(sFile) || !saveData(sFile))
- {
- params_.errorMessage_ = "Fail to write the raster to file";
- return;
- }
- else
- {
- params_.status_ = TeRasterParams::TeReadyToWrite;
- }
- }
- catch (...)
- {
- params_.errorMessage_ = "Fail to write the raster to file";
- return;
- }
- }
- else if (params_.mode_ == 'w')
- {
- ifstream dataFile(params_.fileName_.c_str()); // check if file exists
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to open the raster the file:" + params_.fileName_;
- return;
- }
- dataFile.close();
- if (!readFile(params_.fileName_))
- {
- params_.errorMessage_ = "Fail to read the raster the file:" + params_.fileName_;
- return;
- }
- params_.status_ = TeRasterParams::TeReadyToWrite;
- }
- else if (params_.mode_ == 'r')
- {
- ifstream dataFile(params_.fileName_.c_str()); // check if file exists
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to open the raster the file:" + params_.fileName_;
- return;
- }
- dataFile.close();
- if (!readFile(params_.fileName_))
- {
- params_.errorMessage_ = "Fail to read the raster the file:" + params_.fileName_;
- return;
- }
- params_.status_ = TeRasterParams::TeReadyToRead;
- }
-}
-
-bool
-TeDecoderASCIIGrid::writeParameters(TeAsciiFile& pFile)
-{
- string name;
- try
- {
- TeBox box = params_.box();
- name = "NCOLS " + Te2String(params_.ncols_) + "\n";
- pFile.writeString(name);
- name = "NROWS " + Te2String(params_.nlines_) + "\n";
- pFile.writeString(name);
- name = "XLLCENTER " + Te2String(box.x1_,6) + "\n";
- pFile.writeString(name);
- name = "YLLCENTER " + Te2String(box.y2_,6) + "\n";
- pFile.writeString(name);
- name = "CELLSIZE " + Te2String(params_.resx_,6) + "\n";
- pFile.writeString(name);
- name = "NODATA_VALUE " + Te2String(params_.dummy_[0],6) + "\n";
- pFile.writeString(name);
- }
- catch (...)
- {
- params_.errorMessage_ = "Fail to write raster parameters to the file";
- return false;
- }
- return true;
-}
-
-bool
-TeDecoderASCIIGrid::saveData(TeAsciiFile& pFile)
-{
- bool isi = (params_.dataType_[0] != TeDOUBLE) && (params_.dataType_[0] != TeFLOAT);
-
- FILE* fp = pFile.FilePtr();
- char fmt[100];
- if (isi)
- strcpy(fmt,"%.0f ");
- else
- strcpy(fmt,"%f ");
- try
- {
- double d;
- for (int l=0; l<params_.nlines_; ++l)
- {
- for (int c=0; c<params_.ncols_; ++c)
- {
- getElement(c,l,d);
- fprintf(fp,fmt,d);
- }
- pFile.writeNewLine();
- }
- }
- catch(...)
- {
- params_.errorMessage_ = "Fail to write raster data to the file";
- return false;
- }
- return true;
-}
-
-bool
-TeDecoderASCIIGrid::getElement (int col,int lin, double& val,int band)
-{
- if (col < 0 || lin < 0 || col >= params_.ncols_ || lin >= params_.nlines_)
- return false;
-
- int position = params_.nBands()*(params_.ncols_*lin+col)+band;
- val = myData_[position];
- return true;
-}
-
-bool
-TeDecoderASCIIGrid::setElement (int col, int lin, double val,int band)
-{
- if (col < 0 || lin < 0 || col >= params_.ncols_ || lin >= params_.nlines_)
- return false;
- int position = params_.nBands()*(params_.ncols_*lin+col)+band;
- myData_[position] = static_cast<float>(val);
- isModified_ = true;
- return true;
-}
-
-TeDecoderASCIIGridFactory::TeDecoderASCIIGridFactory(const string& name):
- TeDecoderFactory(name)
-{
- TeDecoderFactory::instanceName2Dec()["GRD"] = "ASCIIGRID";
- TeDecoderFactory::instanceName2Dec()["ASC"] = "ASCIIGRID";
- TeDecoderFactory::instanceName2Dec()["TXT"] = "ASCIIGRID";
-}
diff --git a/src/terralib/kernel/TeDecoderASCIIGrid.h b/src/terralib/kernel/TeDecoderASCIIGrid.h
deleted file mode 100644
index fcd2637..0000000
--- a/src/terralib/kernel/TeDecoderASCIIGrid.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoderASCIIGrid.h
- \brief This file deals with decoding of raster data in a ASCII SPRING format
-*/
-#ifndef __TERRALIB_INTERNAL_DECODERASCIIGrid_H
-#define __TERRALIB_INTERNAL_DECODERASCIIGrid_H
-
-#include "TeDecoder.h"
-
-class TeAsciiFile;
-
-//! Implements a decoder for rasters in ESRI, Inc.'s ASCII Grid format
-/*!
- The default file extension associated to this decoder ".grd", ".asc" and ".txt".
-*/
-class TL_DLL TeDecoderASCIIGrid : public TeDecoder
-{
-public:
- //! Empty constructor
- TeDecoderASCIIGrid();
-
- //! Constructor from some parameters
- TeDecoderASCIIGrid(const TeRasterParams& par);
-
- //! Destructor
- ~TeDecoderASCIIGrid();
-
- //! Initializes the internal structures of the decoder.
- void init();
-
- //! Clears its internal structures.
- bool clear();
-
- //! Writes an element
- bool setElement(int col,int lin, double val, int band=0);
-
- //! Reads an element
- bool getElement(int col,int lin, double &val,int band=0);
-
-private:
-
- bool isModified_;
- long size_;
- float* myData_;
-
- //! Reads the data from a raster file.
- bool readFile(const string& filename);
-
- //! Reads raster file header information.
- bool readParameters();
-
- //! Writes header information to raster file.
- bool writeParameters(TeAsciiFile& pFile);
-
- //! Saves data to raster file.
- bool saveData(TeAsciiFile& pFile);
-
-};
-
-//! Implements a factory to build decoders for ESRI's ASCII Grid raster format
-class TL_DLL TeDecoderASCIIGridFactory : public TeDecoderFactory
-{
-public:
- //! Constructor
- TeDecoderASCIIGridFactory(const string& name);
-
- //! Implementation for the abstract TeFactory::build.
- /*!
- \param arg A const reference to the used parameters.
- \return A pointer to the new generated instance.
- */
- TeDecoder* build (const TeRasterParams& arg)
- { return new TeDecoderASCIIGrid(arg); }
-
-};
-#endif
diff --git a/src/terralib/kernel/TeDecoderDatabase.cpp b/src/terralib/kernel/TeDecoderDatabase.cpp
deleted file mode 100644
index 21fc6b4..0000000
--- a/src/terralib/kernel/TeDecoderDatabase.cpp
+++ /dev/null
@@ -1,534 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeDecoderDatabase.h"
-#include "TeDecoderMemory.h"
-#include "TeRasterRemap.h"
-#include "TeVectorRemap.h"
-#include "TeDataTypes.h"
-#include "TeProgress.h"
-
-#include <zlib.h>
-
-#ifdef TEJPEG //FAMI
-#include "TeLibJpegWrapper.h"
-#endif
-
-TeDecoderDatabase::TeDecoderDatabase(const TeRasterParams& par ):
- TeDecoderVirtualMemory(par),
- db_(par.database_),
- blockPortal_(0),
- memAux_(0),
- nSelectedBlocks_(0)
-{
- params_ = par;
- params_.decoderIdentifier_ = "DB";
- params_.errorMessage_.clear();
-}
-
-TeDecoderDatabase::~TeDecoderDatabase()
-{
- if (blockPortal_)
- {
- delete blockPortal_;
- blockPortal_ = 0;
- }
- clear();
-}
-
-bool
-TeDecoderDatabase::create()
-{
- if (db_ == 0)
- return false;
-
- // Create raster table in database
- if (!db_->createRasterTable(params_.fileName_))
- return false;
- return true;
-}
-
-void
-TeDecoderDatabase::init()
-{
- if (blockPortal_)
- {
- blockPortal_->freeResult();
- delete blockPortal_;
- blockPortal_ = 0;
- }
- clear();
- params_.status_= TeRasterParams::TeNotReady;
- if (db_ == 0) // there is not valid database connection
- {
- params_.errorMessage_ = "There is no database pointer associated to raster.";
- return;
- }
-
- if (params_.mode_ == 'c')
- {
- if (db_->tableExist(params_.fileName_))
- {
- string sql = "DROP TABLE " + params_.fileName_;
- db_->execute(sql);
- }
- if (!db_->createRasterTable(params_.fileName_))
- {
- params_.errorMessage_ = "Fail to create the raster table: " + params_.fileName_;
- return;
- }
- else
- params_.status_ = TeRasterParams::TeReadyToWrite;
- }
- else if (params_.mode_ == 'w')
- {
- if (db_->tableExist(params_.fileName_))
- params_.status_ = TeRasterParams::TeReadyToWrite;
- }
- else if (params_.mode_ == 'r')
- {
- if (db_->tableExist(params_.fileName_))
- params_.status_ = TeRasterParams::TeReadyToRead;
- }
- TeDecoderVirtualMemory::init();
-}
-
-bool
-TeDecoderDatabase::clear()
-{
- if (db_ == 0)
- return false;
- TeDecoderVirtualMemory::clear();
- if (blockPortal_)
- {
- blockPortal_->freeResult();
- }
- if (memAux_)
- delete []memAux_;
- memAux_ = 0;
- params_.status_ = TeRasterParams::TeNotReady;
- if ( ( (params_.mode_ == 'c') || (params_.mode_ == 'w') ) &&
- ( !params_.objectId_.empty() && (params_.layerId_ > 0) ))
- {
- TeDatabasePortal* portal = db_->getPortal();
- string sql = "SELECT geom_table FROM te_representation WHERE geom_type = 512";
- sql += " AND layer_id = " + Te2String(params_.layerId_);
- if (portal->query(sql) && portal->fetchRow())
- {
- string tName = portal->getData(0);
- portal->freeResult();
- sql = "SELECT geom_id FROM " + tName + " WHERE object_id = '" + params_.objectId_ + "'";
- if (portal->query(sql) && portal->fetchRow())
- {
- tName += "_metadata";
- db_->updateRasterMetadata(tName,portal->getInt(0),params_);
- }
- }
- delete portal;
- }
- return true;
-}
-
-string
-TeDecoderDatabase::codifyId(int col, int lin, int band, int res, int subb)
-{
- return codifyId(blockIndex(col, lin, band), res, subb);
-}
-
-string TeDecoderDatabase::codifyId(const TeBlockIndex& idx, int res, int subb)
-{
- char id[32];
- sprintf(id, "X%dY%dB%dR%dS%d", idx.col_, idx.lin_, idx.band_, res, subb);
- return string(id);
-}
-
-
-TeBlockIndex
-TeDecoderDatabase::blockIndex(int col, int lin, int band)
-{
- if (params_.tiling_type_ != TeRasterParams::TeExpansible)
- return TeDecoderVirtualMemory::blockIndex(col, lin, band);
-
- TeBlockIndex bl_idx;
- bl_idx.band_ = band;
-
- TeCoord2D tmpCoord = TeCoord2D(col,lin);
- TeCoord2D xy = params_.index2Coord(tmpCoord);
-
- double bXSize = params_.blockWidth_*params_.resx_;
- double bYSize = params_.blockHeight_*params_.resy_;
-
- if ( xy.x() < 0)
- bl_idx.col_ = (int)(xy.x()/bXSize - 1);
- else
- bl_idx.col_ = (int)(xy.x()/bXSize);
-
- if (xy.y() < 0)
- bl_idx.lin_ = (int) (xy.y()/bYSize-1);
- else
- bl_idx.lin_ = (int) (xy.y()/bYSize);
-
- return bl_idx;
-}
-
-void
-TeDecoderDatabase::decodifyId(const string& id, int& col,int& lin, int& band, int& res, int& subb)
-{
- int r, s;
- TeBlockIndex bl_idx;
- sscanf(id.c_str(),"%*c%d%*c%d%*c%d%*c%d%*c%d",
- &bl_idx.col_, &bl_idx.lin_, &bl_idx.band_, &r, &s);
- blockIndexPos(bl_idx, col, lin, band);
- res = r;
- subb = s;
-}
-
-void TeDecoderDatabase::blockIndexPos( const TeBlockIndex& index, int& ulCol, int& ulLin, int& band)
-{
- if (params_.tiling_type_ != TeRasterParams::TeExpansible)
- return TeDecoderVirtualMemory::blockIndexPos(index, ulCol, ulLin, band);
-
- band = index.band();
-
- double bXSize = params_.blockWidth_*params_.resx_;
- double bYSize = params_.blockHeight_*params_.resy_;
-
- TeCoord2D xy(index.column()*bXSize+params_.resx_/2,index.line()*bYSize+params_.resy_/2);
- xy = params_.coord2Index(xy);
- ulLin = TeRound(xy.y())-params_.blockHeight_+1;
- ulCol = TeRound(xy.x());
-}
-
-
-bool TeDecoderDatabase::getRasterBlock(const TeBlockIndex& index, void *block)
-{
- string index_str;
- index_str = codifyId(index, params_.resolution_);
- return getRasterBlock(index_str, block);
-}
-
-bool
-TeDecoderDatabase::getRasterBlock(const string& index, void *block)
-{
- TeDatabasePortal* portal = db_->getPortal();
- if (!portal)
- return false;
-
- string q; // try to get the tile from databatase
- q ="SELECT * FROM " + params_.fileName_ + " WHERE block_id='" + index + "'";
-
- if (!portal->query(q)) // error submting query
- {
- delete portal;
- return 0;
- }
- int band=0;
- if (!portal->fetchRow()) // tile is not in the database
- {
- delete portal;
- return 0;
- }
-
- unsigned char* memread_ptr = 0;
- if(params_.compression_[band] != TeRasterParams::TeNoCompression)
- {
- if(!memAux_)
- {
- long size = params_.blockHeight_ * params_.blockWidth_ * params_.elementSize();
- memAux_ = new unsigned char[size];
- }
- memread_ptr = memAux_;
- }
- else
- memread_ptr = reinterpret_cast<unsigned char*>(block);
-
- // tile is already in the database
- unsigned long blobLen;
- if (!portal->getRasterBlock(blobLen,memread_ptr))
- {
- delete portal;
- return false;
- }
-
- // decompress blob into a tile (previously allocated)
- if (params_.compression_[band] == TeRasterParams::TeZLib) // zlib compression
- {
- unsigned long blockLen = params_.blockHeight_ * params_.blockWidth_ * params_.elementSize(); // size after decompression
- uncompress (reinterpret_cast<unsigned char*>(block),&blockLen,memread_ptr,blobLen);
- }
-#ifdef TEJPEG //FAMI
- else if (params_.compression_[band] == TeRasterParams::TeJpeg) //jpeg compression
- {
- int nb;
- if (!Jpeg::DecompressBuffer(memAux_,blobLen,reinterpret_cast<unsigned char*>(block),params_.blockWidth_,params_.blockHeight_,nb))
- {
- delete portal;
- return false;
- }
- }
-#endif
- delete portal;
- return true;
-}
-
-bool
-TeDecoderDatabase::putRasterBlock(const TeBlockIndex& index, void *block, long bsize)
-{
- string index_str;
- index_str = codifyId(index, params_.resolution_);
- return putRasterBlock(index_str, block, bsize);
-}
-
-bool
-TeDecoderDatabase::putRasterBlock(const string& index, void *block, long bsize)
-{
- if (db_ == 0 || index.empty())
- return false;
-
- // decodify tile parameters from index
- int res, subb, band, blin, bcol;
- decodifyId(index,bcol,blin,band,res, subb);
-
- // calculates the box coordinates of the tile
- TeCoord2D llt(bcol, blin+params_.blockHeight_-1);
- TeCoord2D urt(bcol+params_.blockWidth_-1, blin);
- TeCoord2D ll = params_.index2Coord(llt);
- TeCoord2D ur = params_.index2Coord(urt);
-
- TeBox blockbb(ll.x()-params_.resx_/2.,ll.y()-params_.resy_/2.,ur.x()+params_.resx_/2.,ur.y()+params_.resy_/2.);
- bool status;
-
- // verify compression option
- if (params_.compression_[band] == TeRasterParams::TeNoCompression)
- {
- status = db_->insertRasterBlock(params_.fileName_,index,blockbb.lowerLeft(),blockbb.upperRight(),reinterpret_cast<unsigned char*>(block),bsize,band,res,subb);
- return status;
- }
- unsigned long finalsize = bsize; // final size after compression
- if (!memAux_)
- {
- long size = params_.blockHeight_ * params_.blockWidth_ * params_.elementSize();
- memAux_ = new unsigned char[int(size*1.1 + 12.)];
- }
- if (params_.compression_[band] == TeRasterParams::TeZLib) // ZLib compression
- {
- // zlib needs some more space)
- finalsize = (unsigned long)(bsize*1.1 + 12.);
- compress (memAux_, &finalsize,reinterpret_cast<unsigned char*>(block),bsize);
- return db_->insertRasterBlock(params_.fileName_,index,blockbb.lowerLeft(),blockbb.upperRight(),memAux_,finalsize,band,res,subb);
- }
-#ifdef TEJPEG //FAMI
- else if (params_.compression_[band] == TeRasterParams::TeJpeg) // JPEG compression
- {
- int sizec = int(bsize*1.1 + 12.);
- if (!Jpeg::CompressToBuffer(reinterpret_cast<unsigned char*>(block),params_.blockWidth_,params_.blockHeight_,1,memAux_,sizec,75))
- return false;
- finalsize = sizec;
- return db_->insertRasterBlock(params_.fileName_,index,blockbb.lowerLeft(),blockbb.upperRight(),memAux_,finalsize,band,res,subb);
- }
-#endif
- return false;
-}
-
-bool
-TeDecoderDatabase::saveLUTTable()
-{
- if (params_.lutName_.empty())
- return false;
- if (!db_ || !db_->createLUTTable(params_.lutName_))
- return false;
- for (unsigned int i=0; i<params_.lutb_.size(); i++)
- {
- string sql = "INSERT INTO " + params_.lutName_ + " VALUES(";
- sql += Te2String(i) + ", ";
- sql += Te2String(params_.lutr_[i]) + ", ";
- sql += Te2String(params_.lutg_[i]) + ", ";
- sql += Te2String(params_.lutb_[i]) + ")";
- if (!db_->execute(sql))
- return false;
- }
- return true;
-}
-
-bool
-TeDecoderDatabase::selectBlocks(TeBox& bb, int resFac, TeRasterParams& parBlock)
-{
- if (!db_)
- return false;
-
- if (blockPortal_)
- delete blockPortal_;
-
- blockPortal_ = db_->getPortal();
- if (!blockPortal_)
- return false;
-
- string sql;
- string sel = db_->getSQLBoxSelect(params_.fileName_, TeRASTER);
- string where = db_->getSQLBoxWhere (bb, TeRASTER);
-
- sql = "SELECT "+ sel;
- sql += " FROM " + params_.fileName_;
- sql += " WHERE " + where + " AND resolution_factor = " + Te2String(resFac);
- sql += " ORDER BY lower_x, lower_y, upper_x, upper_y, block_id";
-
- if (!blockPortal_->query(sql))
- {
- delete blockPortal_;
- blockPortal_ = 0;
- return false;
- }
- nSelectedBlocks_ = blockPortal_->numRows();
- parBlock.projection(params_.projection());
- parBlock.resx_ = params_.resx_*resFac;
- parBlock.resy_ = params_.resy_*resFac;
- parBlock.nlines_ = params_.blockHeight_;
- parBlock.ncols_= params_.blockWidth_;
- parBlock.nBands(params_.nBands());
- parBlock.dataType_ = params_.dataType_;
- parBlock.dummy_ = params_.dummy_;
- parBlock.useDummy_ = params_.useDummy_;
- parBlock.photometric_ = params_.photometric_;
- parBlock.vmax_ = params_.vmax_;
- parBlock.vmin_ = params_.vmin_;
- parBlock.lutr_ = params_.lutr_;
- parBlock.lutg_ = params_.lutg_;
- parBlock.lutb_ = params_.lutb_;
- parBlock.interleaving_ = TeRasterParams::TePerBand;
- return blockPortal_->fetchRow();
-}
-
-bool
-TeDecoderDatabase::getSelectedRasterBlock(TeDecoderMemory* memDec)
-{
- if (!blockPortal_)
- return 0;
- unsigned long srcLen;
- int i = 0;
-
- if (!memAux_ )
- {
- long size = params_.blockHeight_ * params_.blockWidth_ * params_.elementSize();
- memAux_ = new unsigned char[size];
- }
- int res;
- TeBox bbBlock;
- string blockId;
- do
- {
- double lx = 0;
- double ly = 0;
- double ux = 0;
- double uy = 0;
- lx = blockPortal_->getDouble("lower_x");
- ly = blockPortal_->getDouble("lower_y");
- ux = blockPortal_->getDouble("upper_x");
- uy = blockPortal_->getDouble("upper_y");
-
- bbBlock = TeBox(lx, ly, ux, uy);
-
- blockId = blockPortal_->getData("block_id");
- res = blockPortal_->getInt("resolution_factor");
-
- int banda;
- if(params_.nBands() > 1)
- {
- int col, lin, res, subb;
- this->decodifyId(blockId, col, lin, banda, res, subb);
- }
- else
- banda = 0;
-
- if (params_.compression_[banda] == TeRasterParams::TeNoCompression)
- blockPortal_->getRasterBlock(srcLen, reinterpret_cast<unsigned char*>(memDec->data(banda)));
- else
- {
- blockPortal_->getRasterBlock(srcLen,memAux_);
-
- if (params_.compression_[banda] == TeRasterParams::TeZLib)
- {
- TeRasterParams& par = memDec->params();
- unsigned long destLen = par.ncols_ * par.nlines_ * par.elementSize();
- int status;
- status = uncompress (reinterpret_cast<unsigned char*>(memDec->data(banda)),&destLen,memAux_,srcLen);
- }
-#ifdef TEJPEG //FAMI
- else if (params_.compression_[banda] == TeRasterParams::TeJpeg)
- {
- int nb = 1;
- Jpeg::DecompressBuffer(memAux_,srcLen,reinterpret_cast<unsigned char*>(memDec->data(banda)),params_.blockWidth_,params_.blockHeight_,nb);
- }
-#endif
- }
- i++;
- }while (i<params_.nBands() && blockPortal_->fetchRow());
-
- memDec->params().boundingBoxResolution(bbBlock.x1(),bbBlock.y1(),bbBlock.x2(),bbBlock.y2(),
- params_.resx_*res,params_.resy_*res);
- memDec->params().blockId_ = blockId;
- return blockPortal_->fetchRow();
-}
-
-void
-TeDecoderDatabase::clearBlockSelection()
-{
- if (blockPortal_)
- delete blockPortal_;
- blockPortal_ = 0;
- nSelectedBlocks_ = 0;
-}
-
-int
-TeDecoderDatabase::bestResolution(TeBox& bb, int ncols, int nlines, TeProjection* proj)
-{
- TeBox box = bb;
- if (proj)
- box = TeRemapBox(bb, proj, params_.projection());
-
- double resx = box.width()/ncols;
- double resy = box.height()/nlines;
-
- double auxx = resx/params_.resx_;
- double auxy = resy/params_.resy_;
-
- int aux = (int) (min(auxx,auxy));
-
- string sql = "SELECT resolution_factor FROM " + params_.fileName_;
- sql += " WHERE resolution_factor <= " + Te2String(aux) + " ORDER BY resolution_factor DESC";
-
- TeDatabasePortal* portal = params_.database_->getPortal();
- if (!portal)
- return 1;
-
- if (!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return 1;
- }
-
- int res = atoi(portal->getData(0));
- delete portal;
- return res;
-}
-
-
diff --git a/src/terralib/kernel/TeDecoderDatabase.h b/src/terralib/kernel/TeDecoderDatabase.h
deleted file mode 100644
index fe96ea9..0000000
--- a/src/terralib/kernel/TeDecoderDatabase.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoderDatabase.h
- \brief This file deals with decoding of raster structures stored in a TerraLib database
-*/
-
-#ifndef __TERRALIB_INTERNAL_DECODERDATABASE_H
-#define __TERRALIB_INTERNAL_DECODERDATABASE_H
-
-#include "TeDefines.h"
-#include "TeDecoderVirtualMemory.h"
-#include "TeDatabase.h"
-
-//! A concrete class to manipulate raster data stored in a TerraLib database
-/*
- TeDecoderDatabase uses a virtual memory, to handle the raster blocks
- (as proposed by the TerraLib data model to store raster data) traffic from
- memory to database and vice versa.
-
- \sa TeDatabase TeDecoderVirtualMemory
-*/
-class TL_DLL TeDecoderDatabase: public TeDecoderVirtualMemory
-{
-public:
- //! Empty constructor
- TeDecoderDatabase() :
- db_(0),
- blockPortal_(0),
- memAux_(0),
- nSelectedBlocks_(0)
- { params_.decoderIdentifier_ = "DB"; }
-
- //! Constructor from parameters
- TeDecoderDatabase( const TeRasterParams& par );
-
- //! Destructor
- ~TeDecoderDatabase();
-
- //! Sets the database pointer associated to this decoder
- void setDB (TeDatabase* db)
- { db_ = db; }
-
- //! Initializes the decoder
- virtual void init();
-
- //! Creates the decoder
- virtual bool create();
-
- //! Clears the decoder
- virtual bool clear();
-
- //! Gets the raster block with index identifier
- /*!
- \param index tile unique identifier
- \param buf pointer to a raster tile in memory
- */
- bool getRasterBlock(const string& index, void *buf);
-
- //! Saves a raster tile from a virtual memory to permanent storage
- /*!
- \param index tile unique identifier
- \param buf pointer to a raster tile in memory
- \param bsize size of the block in bytes
- */
- bool putRasterBlock(const string& index, void *buf, long bsize);
-
- //! Codifiy the index for the block that contains an element
- string codifyId(int col, int lin, int band, int res, int subb);
-
- //! Decodify the parameters of the block that has an index
- void decodifyId(const string& id, int& col,int& lin, int& band, int& res, int& subb);
-
-
- //! Saves the lut table of the raster associated to this decoder
- bool saveLUTTable();
-
- //! Search for tiles of image that intersects a certain bounding box in a given resolution
- /*
- \param bb bounding box that should be filled
- \param resFac resolution factor that identify a level of resolution
- \param parBlock returns the basic parameters of the selected tiles
- \note Resolution factor in decoder database is a multiplier of the original resolution
- and assume integer multiples of two. Smaller resolution has resolution factor
- of 1 and the higher resolution have multiple of two values (2,4,8, 16...)
- */
- int bestResolution(TeBox& bb, int ncols, int nlines, TeProjection* proj);
-
- //! Select the stored raster blocks with a certain resolution to fill a given bounding box
- /*
- \param bb bounding box that should be filled
- \param the resolution factor desired
- \param parBlock common parameters of the blocks selected
- \returns TRUE if could select at least one block and FALSE otherwise
- */
- bool selectBlocks(TeBox& bb, int resFac, TeRasterParams& parBlock);
-
- //! Gets current raster block an outputs it in a memory decoder
- bool getSelectedRasterBlock(TeDecoderMemory* memDec);
-
- //! Clears selected blocks portal
- void clearBlockSelection();
-
- //! Returns the number of selectd raster blocks
- int numberOfSelectedBlocks()
- { return nSelectedBlocks_; }
-
- //! Decodifies the position of a block within the raster from its index
- virtual void blockIndexPos( const TeBlockIndex& index, int& ulCol, int& ulLin, int& band);
-
-protected:
-
- virtual TeBlockIndex blockIndex(int col, int lin, int band);
- virtual string codifyId(const TeBlockIndex& idx, int res = 1, int subb = 0);
-
- bool getRasterBlock(const TeBlockIndex& index, void *buf);
- bool putRasterBlock(const TeBlockIndex& index, void *buf, long bsize);
-
-private:
- TeDatabase *db_;
- TeDatabasePortal *blockPortal_;
- unsigned char *memAux_;
- int nSelectedBlocks_;
-};
-
-//! Implements a factory to build database decoders
-class TL_DLL TeDecoderDatabaseFactory : public TeDecoderFactory
-{
-public:
-
- //! Constructor
- TeDecoderDatabaseFactory(const string& name) : TeDecoderFactory(name) {}
-
- //! Builds a database decoder
- virtual TeDecoder* build (const TeRasterParams& arg)
- { return new TeDecoderDatabase(arg); }
-};
-#endif
-
diff --git a/src/terralib/kernel/TeDecoderFile.cpp b/src/terralib/kernel/TeDecoderFile.cpp
deleted file mode 100644
index 326b851..0000000
--- a/src/terralib/kernel/TeDecoderFile.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include <TeDecoderFile.h>
-
-#ifdef WIN32
-
-TeDecoderFile::TeDecoderFile ( const TeRasterParams& par )
-{
- params_ = par;
- dataInitPos_ = 0;
- dataInitPos_ = par.offset_;
- m_dwPosition = 0;
- m_dwWordSize = params_.elementSize();
- params_.blockHeight_ = 1;
- params_.blockWidth_ = params_.ncols_;
- params_.decoderIdentifier_ = "RAW";
-}
-
-TeDecoderFile::~TeDecoderFile ()
-{
- if (m_hFile != NULL)
- clear();
-}
-
-void
-TeDecoderFile::init()
-{
- clear();
-
- // First open the file
- m_hFile = CreateFileA(
- params_.fileName_.c_str(), // File name
- GENERIC_READ | GENERIC_WRITE, // Read-write
- FILE_SHARE_READ
- | FILE_SHARE_WRITE, // Allow sharing-- we're only doing a quick scan
- NULL, // No security attributes
- OPEN_EXISTING, // Only open an existing file
- 0, // Ignore file attributes
- NULL); // Ignore hTemplateFile
-
- if (m_hFile == INVALID_HANDLE_VALUE)
- return ; // could not open file
-
-// Get the file's size
- m_dwSize = GetFileSize(m_hFile, NULL);
- if (m_dwSize == 0xffffffff)
- {
- m_hFile = NULL;
- return ;
- }
-
-// Allocate buffer to get raster line from file
-
- long mBufferSize = params_.ncols_;
- if (params_.interleaving_ == TeRasterParams::TePerPixel)
- mBufferSize *= params_.nBands();
-
- switch (params_.dataType_[0]) {
- case (TeUNSIGNEDCHAR):
- m_buffer = new unsigned char[mBufferSize];
- break;
- case (TeCHAR) :
- m_buffer = new char[mBufferSize];
- break;
- case (TeUNSIGNEDSHORT):
- m_buffer = new unsigned short[mBufferSize];
- break;
- case (TeSHORT):
- m_buffer = new short[mBufferSize];
- break;
- case (TeUNSIGNEDLONG):
- m_buffer = new unsigned long[mBufferSize];
- break;
- case (TeLONG):
- m_buffer = new long[mBufferSize];
- break;
- case (TeFLOAT):
- m_buffer = new float[mBufferSize];
- break;
- case (TeDOUBLE):
- m_buffer = new double[mBufferSize];
- break;
- }
- if ( m_buffer == NULL )
- return ;
- else
- return ;
-
-}
-
-bool
-TeDecoderFile::create()
-{
- m_hFile = CreateFileA(
- params_.fileName_.c_str(), // File name
- GENERIC_READ | GENERIC_WRITE, // Read-write
- FILE_SHARE_READ
- | FILE_SHARE_WRITE, // Allow sharing-- we're only doing a quick scan
- NULL, // No security attributes
- CREATE_NEW, // Open a new file
- 0, // Ignore file attributes
- NULL); // Ignore hTemplateFile
-
- if ( m_hFile == INVALID_HANDLE_VALUE)
- return false; // could not open file
-
- char lpBuffer[1024];
- unsigned long nNumberOfBytesToWrite=(long)params_.nBands() * (long)params_.ncols_ * (long)params_.nlines_; // number of bytes to write
- nNumberOfBytesToWrite *= (long)params_.nbitsperPixel_[0]/8; // number of bytes to write
- unsigned long nNumberOfBytesWritten; // pointer to number of bytes written
-
- for (;nNumberOfBytesToWrite > 1024; nNumberOfBytesToWrite-=1024)
- {
- if ( !WriteFile(
- m_hFile, // handle to file to write to
- lpBuffer, // pointer to data to write to file
- 1024, // number of bytes to write
- &nNumberOfBytesWritten, // pointer to number of bytes written
- NULL // pointer to structure for overlapped I/O
- ))
- return false; // could not write to file
- }
-
- if ( !WriteFile(
- m_hFile, // handle to file to write to
- lpBuffer, // pointer to data to write to file
- nNumberOfBytesToWrite, // number of bytes to write
- &nNumberOfBytesWritten, // pointer to number of bytes written
- NULL // pointer to structure for overlapped I/O
- ))
- return false; // could not write to file
-
- SetFilePointer (m_hFile, NULL, NULL, FILE_BEGIN);
-
-// Allocate buffer to get raster line from file
-
- switch (params_.dataType_[0]) {
- case (TeUNSIGNEDCHAR):
- m_buffer = new unsigned char[params_.ncols_];
- break;
- case (TeCHAR) :
- m_buffer = new char[params_.ncols_];
- break;
- case (TeUNSIGNEDSHORT):
- m_buffer = new unsigned short[params_.ncols_];
- break;
- case (TeSHORT):
- m_buffer = new short[params_.ncols_];
- break;
- case (TeUNSIGNEDLONG):
- m_buffer = new unsigned long[params_.ncols_];
- break;
- case (TeLONG):
- m_buffer = new long[params_.ncols_];
- break;
- case (TeFLOAT):
- m_buffer = new float[params_.ncols_];
- break;
- case (TeDOUBLE):
- m_buffer = new double[params_.ncols_];
- break;
- }
-
- if ( m_buffer == NULL )
- return false;
-
- if (params_.dummy_[0])
- {
- for (int b=0; b<params_.nBands();b++)
- for (int l=0; l<params_.nlines_;l++)
- for (int c=0; c<params_.ncols_;c++)
- setElement ( c, l, params_.dummy_[0], b);
- }
- return true;
-}
-
-bool
-TeDecoderFile::clear()
-{
- if (!m_hFile)
- return true;
-
- CloseHandle(m_hFile);
- m_hFile = NULL;
- delete m_buffer;
- m_buffer = 0;
- params_.status_ = TeRasterParams::TeNotReady;
- return true;
-}
-
-
-bool
-TeDecoderFile::getRasterBlock(const TeBlockIndex& index, void *buf)
-{
- int ulCol, ulLin, band;
- blockIndexPos(index, ulCol, ulLin, band);
-
- int nb = params_.nBands();
- DWORD position;
- DWORD nBytesToRead;
- int inc, inic;
- if (params_.interleaving_ == TeRasterParams::TePerPixel)
- {
- inc = nb;
- inic = index.band();
- position = dataInitPos_ + params_.ncols_*(nb* ulLin);
- nBytesToRead = m_dwWordSize*params_.ncols_*nb;
- }
- else
- {
- inc = 1;
- inic = 0;
- position = dataInitPos_ + params_.ncols_*(nb*ulLin + band);
- nBytesToRead = m_dwWordSize*params_.ncols_;
- }
- DWORD diff = position - m_dwPosition;
- if (diff != 0)
- m_dwPosition = SetFilePointer (m_hFile, diff, NULL, FILE_CURRENT);
- unsigned long nBytesRead;
- if (!ReadFile(m_hFile, m_buffer, nBytesToRead, &nBytesRead, NULL))
- return false;
- m_dwPosition += nBytesRead;
-
- int i,n;
- switch (params_.dataType_[0])
- {
- case (TeUNSIGNEDCHAR):
- for (i=inic,n=0;i<params_.ncols_*nb;i+=inc, n++)
- ((unsigned char*)buf)[n] = ((unsigned char*)m_buffer)[i];
- break;
- case (TeCHAR) :
- for (i=inic,n=0;i<params_.ncols_*nb;i+=inc, n++)
- ((char*)buf)[n] = ((char*)m_buffer)[i];
- break;
- case (TeUNSIGNEDSHORT):
- for (i=inic,n=0;i<params_.ncols_*nb;i+=inc, n++)
- ((unsigned short*)buf)[n] = ((unsigned short*)m_buffer)[i];
- break;
- case (TeSHORT):
- for (i=inic,n=0;i<params_.ncols_*nb;i+=inc, n++)
- ((short*)buf)[n] = ((short*)m_buffer)[i];
- break;
- case (TeUNSIGNEDLONG):
- for (i=inic,n=0;i<params_.ncols_*nb;i+=inc, n++)
- ((unsigned long*)buf)[n] = ((unsigned long*)m_buffer)[i];
- break;
- case (TeLONG):
- for (i=inic,n=0;i<params_.ncols_*nb;i+=inc, n++)
- ((long*)buf)[n] = ((long*)m_buffer)[i];
- break;
- case (TeFLOAT):
- for (i=inic,n=0;i<params_.ncols_*nb;i+=inc, n++)
- ((float*)buf)[n] = ((float*)m_buffer)[i];
- break;
- case (TeDOUBLE):
- for (i=inic,n=0;i<params_.ncols_*nb;i+=inc, n++)
- ((double*)buf)[n] = ((double*)m_buffer)[i];
- break;
- }
-
- return true;
-}
-
-
-
-bool
-TeDecoderFile::putRasterBlock(const TeBlockIndex& index, void *buf, long bsize)
-{
- int band,ulCol,ulLin;
- blockIndexPos(index, ulCol, ulLin, band);
-
- DWORD position = dataInitPos_ + params_.ncols_*(params_.nBands()*ulLin + band);
- DWORD diff = position - m_dwPosition;
- if (diff != 0)
- SetFilePointer (m_hFile, diff, NULL, FILE_CURRENT);
- DWORD nBytesToWrite = m_dwWordSize*params_.ncols_,
- nBytesWritten;
- int i;
- switch (params_.dataType_[0])
- {
- case (TeUNSIGNEDCHAR):
- for (i=0;i<params_.ncols_;i++)
- ((unsigned char*)m_buffer)[i] = ((unsigned char*)buf)[i];
- break;
- case (TeCHAR) :
- for (i=0;i<params_.ncols_;i++)
- ((char*)m_buffer)[i] = ((char*)buf)[i];
- break;
- case (TeUNSIGNEDSHORT):
- for (i=0;i<params_.ncols_;i++)
- ((unsigned short*)m_buffer)[i] = ((unsigned short*)buf)[i];
- break;
- case (TeSHORT):
- for (i=0;i<params_.ncols_;i++)
- ((short*)m_buffer)[i] = ((short*)buf)[i];
- break;
- case (TeUNSIGNEDLONG):
- for (i=0;i<params_.ncols_;i++)
- ((unsigned long*)m_buffer)[i] = ((unsigned long*)buf)[i];
- break;
- case (TeLONG):
- for (i=0;i<params_.ncols_;i++)
- ((long*)m_buffer)[i] = ((long*)buf)[i];
- break;
- case (TeFLOAT):
- for (i=0;i<params_.ncols_;i++)
- ((float*)m_buffer)[i] = ((float*)buf)[i];
- break;
- case (TeDOUBLE):
- memcpy (m_buffer,buf,params_.ncols_);
- break;
- }
-
- if (!WriteFile(m_hFile, m_buffer, nBytesToWrite, &nBytesWritten, NULL))
- return false;
-
- m_dwPosition += nBytesWritten;
-
- return true;
-}
-
-TeBlockIndex TeDecoderFile::blockIndex(int col, int lin, int band)
-{
- TeBlockIndex bl_index;
-
- bl_index.band_ = band;
- bl_index.lin_ = lin;
- bl_index.col_ = 0;
-
- return bl_index;
-}
-
-void TeDecoderFile::blockIndexPos(const TeBlockIndex& index, int& ulCol, int& ulLin, int& band)
-{
- ulCol = 0;
- ulLin = index.line() * params_.blockWidth_;
- band = index.band();
-}
-
-#endif
diff --git a/src/terralib/kernel/TeDecoderFile.h b/src/terralib/kernel/TeDecoderFile.h
deleted file mode 100644
index 9ce051c..0000000
--- a/src/terralib/kernel/TeDecoderFile.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoderFile.h
- \brief This file deals with decoding of raster structures in a binary file using Windows support
-*/
-#ifndef __TERRALIB_INTERNAL_DECODERFILE_H
-#define __TERRALIB_INTERNAL_DECODERFILE_H
-
-#ifdef WIN32
-#include "TeDecoderVirtualMemory.h"
-#include <windows.h>
-#include <winbase.h>
-
-//! Implements decoder to raster data stored in a file in a binary raw format
-/* \note This implementation is valid only for the windows platform
-*/
-class TL_DLL TeDecoderFile : public TeDecoderVirtualMemory
-{
-public:
- //! Constructor
- TeDecoderFile ( const TeRasterParams& );
-
- //! Destructor
- ~TeDecoderFile ();
-
- //! Initalizes its internal structures
- void init ();
-
- //! Created a handle
- bool create ();
-
- //! Releases the internal structures
- bool clear ();
-
-protected:
- bool getRasterBlock(const TeBlockIndex& index, void *buf);
- bool putRasterBlock(const TeBlockIndex& index, void *buf, long bsize);
- TeBlockIndex blockIndex(int col, int lin, int band);
- void blockIndexPos(const TeBlockIndex& index, int& ulCol, int& ulLin, int& band);
-
-private:
-
- unsigned long dataInitPos_;
- HANDLE m_hFile; // Handle to file we're currently zapping
- LPVOID m_buffer; // Pointer to view of file mapped to memory
- DWORD m_dwSize; // File size in bytes
- DWORD m_dwPosition; // Current file pointer position
- DWORD m_dwWordSize; // word size in bytes
-};
-
-//! Implements a factory to build file decoders
-class TL_DLL TeDecoderFileFactory : public TeDecoderFactory
-{
-public:
-
- TeDecoderFileFactory(const string& name) : TeDecoderFactory(name) {}
-
- //! Builds a file decoder
- virtual TeDecoder* build (const TeRasterParams& arg)
- { return new TeDecoderFile(arg); }
-};
-
-#endif
-#endif
diff --git a/src/terralib/kernel/TeDecoderJPEG.cpp b/src/terralib/kernel/TeDecoderJPEG.cpp
deleted file mode 100644
index fb27bd6..0000000
--- a/src/terralib/kernel/TeDecoderJPEG.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-#include <TeDecoderJPEG.h>
-#include <TeAsciiFile.h>
-#include <TeUtils.h>
-#include <TeLibJpegWrapper.h>
-
-#include <fstream>
-using std::ifstream;
-using std::ofstream;
-
-TeDecoderJPEG::TeDecoderJPEG():
- isModified_(false),
- size_(0),
- myData_(0)
-{
- params_.decoderIdentifier_ = "JPEG";
-}
-
-
-TeDecoderJPEG::TeDecoderJPEG (const TeRasterParams& par):
- isModified_(false),
- size_(0),
- myData_(0)
-{
- params_ = par;
- params_.errorMessage_.clear();
- // 'w' and 'r' modes suppose that the file already exists: try to read the basic information
- if (params_.mode_ == 'w' || params_.mode_ == 'r')
- {
- ifstream dataFile(params_.fileName_.c_str());
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to access the raster file:" + params_.fileName_;
- return;
- }
- dataFile.close();
-
- int nb;
- if (!Jpeg::ReadFileParams(params_.fileName_, params_.ncols_, params_.nlines_, nb))
- {
- params_.errorMessage_ = "Fail to read the parameters from the raster the file.";
- return;
- }
- params_.nBands(nb);
- params_.setDataType(TeUNSIGNEDCHAR);
- params_.setPhotometric(TeRasterParams::TeMultiBand);
- params_.decoderIdentifier_ = "JPEG";
- params_.blockWidth_ = params_.ncols_;
- params_.blockHeight_ = params_.nlines_;
- params_.interleaving_ = TeRasterParams::TePerPixel;
- TeProjection* proj = new TeNoProjection();
- params_.projection(proj);
- delete proj;
-
- // Try reading navigation parameters from auxiliary file
- string jgwFile = TeGetName(params_.fileName_.c_str()) +".jgw";
- try
- {
- vector<double> jgw;
- TeAsciiFile pFile(jgwFile.c_str());
- jgw.push_back(pFile.readFloat());
- jgw.push_back(pFile.readFloat());
- jgw.push_back(pFile.readFloat());
- jgw.push_back(pFile.readFloat());
- jgw.push_back(pFile.readFloat());
- jgw.push_back(pFile.readFloat());
- params_.setNavigationParameters(jgw);
- }
- catch (...)
- {
- // no .jgw inexistent or inconsistent, uses resolution of 1 unit
- // and box lower left coordinate of (0.5,0.5)
- params_.lowerLeftResolutionSize(0.5,0.5,1.0,1.0,params_.ncols_,params_.nlines_,true);
- }
- }
-}
-
-TeDecoderJPEG::~TeDecoderJPEG()
-{
- clear();
-}
-
-
-bool
-TeDecoderJPEG::clear()
-{
- size_ = 0;
- if (myData_ == 0)
- return true;
- if ( isModified_ && (params_.mode_ == 'w' || params_.mode_ == 'c') ) // save contents to disk
- {
- ofstream dataFile(params_.fileName_.c_str());
- if (dataFile)
- {
- dataFile.close();
- Jpeg::CompressToFile(myData_, params_.ncols_, params_.nlines_, params_.nBands(), params_.fileName_);
- isModified_ = false;
- }
- }
- delete [] myData_;
- myData_ = 0;
- return true;
-}
-
-
-void
-TeDecoderJPEG::init()
-{
- params_.status_= TeRasterParams::TeNotReady;
- params_.interleaving_ = TeRasterParams::TePerPixel;
-
- // try to allocate enough memory to hold the data
- if (size_ != params_.nlines_*params_.ncols_*params_.nBands())
- {
- size_ = params_.nlines_*params_.ncols_*params_.nBands();
- if (myData_)
- delete [] myData_;
- myData_ = new unsigned char [size_];
- }
- if (!myData_)
- return;
-
- for (long i=0; i<size_; myData_[i]=static_cast<unsigned char>(params_.dummy_[0]),++i);
-
- if (params_.mode_ == 'c') // creating a new file
- {
- int nb = params_.nBands();
- if (nb != 1 && nb != 3)
- {
- params_.errorMessage_ = "JPEG files can have only 1 or 3 bands.";
- return;
- }
- ofstream dataFile(params_.fileName_.c_str());
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to (re)create the raster the file:" + params_.fileName_;
- return;
- }
- dataFile.close();
-
- // write navigation file
- string jgw = TeGetName(params_.fileName_.c_str())+".jgw";
- try {
- TeAsciiFile jgwFile(jgw,"w");
- vector<double> jgw;
- params_.getNavigationParameters(jgw);
- for (unsigned int nl=0; nl<6; ++nl)
- {
- string line;
- line = Te2String(jgw[nl]) + "\n";
- jgwFile.writeString(line);
- }
- }
- catch(...)
- {}
- // write initial dummy data
- if (!Jpeg::CompressToFile(myData_, params_.ncols_, params_.nlines_, params_.nBands(), params_.fileName_))
- return;
- params_.status_ = TeRasterParams::TeReadyToWrite;
- }
- else if (params_.mode_ == 'w' || params_.mode_ == 'r')
- {
- ifstream dataFile(params_.fileName_.c_str());
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to open the raster the file:" + params_.fileName_;
- return;
- }
- dataFile.close();
-
- int nb;
- if (!Jpeg::DecompressFile(params_.fileName_.c_str(), myData_, params_.ncols_, params_.nlines_, nb))
- {
- params_.errorMessage_ = "Fail to decompress JPEG file.";
- return;
- }
- params_.nBands(nb);
- if (params_.mode_ == 'w')
- params_.status_ = TeRasterParams::TeReadyToWrite;
- else
- params_.status_ = TeRasterParams::TeReadyToRead;
- }
-}
-
-bool
-TeDecoderJPEG::getElement (int col,int lin, double& val,int band)
-{
- if (col < 0 || lin < 0 || col >= params_.ncols_ || lin >= params_.nlines_)
- return false;
-
- int position = params_.nBands()*(params_.ncols_*lin+col)+band;
- val = myData_[position];
- return true;
-}
-
-bool
-TeDecoderJPEG::setElement (int col, int lin, double val,int band)
-{
- if (col < 0 || lin < 0 || col >= params_.ncols_ || lin >= params_.nlines_)
- return false;
- int position = params_.nBands()*(params_.ncols_*lin+col)+band;
- myData_[position] = static_cast<unsigned char>(val);
- isModified_ = true;
- return true;
-}
-
-TeDecoderJPEGFactory::TeDecoderJPEGFactory(const string& name):
- TeDecoderFactory(name)
-{
- TeDecoderFactory::instanceName2Dec()["JPG"] = "JPEG";
- TeDecoderFactory::instanceName2Dec()["JPEG"] = "JPEG";
-}
diff --git a/src/terralib/kernel/TeDecoderJPEG.h b/src/terralib/kernel/TeDecoderJPEG.h
deleted file mode 100644
index 4995742..0000000
--- a/src/terralib/kernel/TeDecoderJPEG.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoderJPEG.h
- \brief This file deals with decoding of raster structures in JPEG format
-*/
-#ifndef __TERRALIB_INTERNAL_DECODERJPEG_H
-#define __TERRALIB_INTERNAL_DECODERJPEG_H
-
-#include "TeDecoder.h"
-
-//! Implements a decoder for images in JPEG format
-/*
- This implementation compress/decompress the entire JPEG image in memory and
- access its pixels acessed directly. \par
- The default file extensions associated to this decoder are ".jpg" and ".jpeg".
-*/
-class TL_DLL TeDecoderJPEG: public TeDecoder
-{
-public:
- //! Empty constructor
- TeDecoderJPEG();
-
- //! Constructor from some parameters
- TeDecoderJPEG(const TeRasterParams& par);
-
- //! Destructor
- ~TeDecoderJPEG();
-
- //! Initializes the internal structures
- void init();
-
- //! Releases the internal structures
- bool clear();
-
- //! Writes an element
- bool setElement(int col,int lin, double val, int band=0);
-
- //! Reads an element
- bool getElement(int col,int lin, double &val,int band=0);
-
-private:
- bool isModified_;
- long size_;
- unsigned char* myData_;
-};
-
-//! Implements a factory to build decoders to JPEG raster
-class TL_DLL TeDecoderJPEGFactory : public TeDecoderFactory
-{
-public:
-
- //! Constructor for the factory
- TeDecoderJPEGFactory(const string& name);
-
- //! Built the object
- TeDecoder* build (const TeRasterParams& arg)
- { return new TeDecoderJPEG(arg); }
-};
-
-#endif
-
diff --git a/src/terralib/kernel/TeDecoderMemory.cpp b/src/terralib/kernel/TeDecoderMemory.cpp
deleted file mode 100644
index f4775ec..0000000
--- a/src/terralib/kernel/TeDecoderMemory.cpp
+++ /dev/null
@@ -1,591 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeDecoderMemory.h"
-#include "TeException.h"
-
-#include <assert.h>
-#include <cstring> //FAMI
-
-TeDecoderMemory::TeDecoderMemory():
- nelems_(0),
- size_(0),
- getelement_ptr_(0),
- setelement_ptr_(0),
- data_TeUNSIGNEDCHAR_(0),
- data_TeCHAR_(0),
- data_TeUNSIGNEDSHORT_(0),
- data_TeSHORT_(0),
- data_TeINTEGER_(0),
- data_TeUNSIGNEDLONG_(0),
- data_TeLONG_(0),
- data_TeFLOAT_(0),
- data_TeDOUBLE_(0)
-{
- params_.decoderIdentifier_ = "MEM";
-}
-
-TeDecoderMemory::TeDecoderMemory(const TeRasterParams& par):
- nelems_(0),
- size_(0),
- getelement_ptr_(0),
- setelement_ptr_(0),
- data_TeUNSIGNEDCHAR_(0),
- data_TeCHAR_(0),
- data_TeUNSIGNEDSHORT_(0),
- data_TeSHORT_(0),
- data_TeINTEGER_(0),
- data_TeUNSIGNEDLONG_(0),
- data_TeLONG_(0),
- data_TeFLOAT_(0),
- data_TeDOUBLE_(0)
-{
- params_ = par;
- params_.decoderIdentifier_ = "MEM";
-}
-
-TeDecoderMemory::~TeDecoderMemory ()
-{
- clear();
-}
-
-void*
-TeDecoderMemory::data(int band)
-{
- // this is possible when band interleaved data
- if (params_.interleaving_ != TeRasterParams::TePerBand)
- return 0;
-
- void* pt = 0;
- switch (params_.dataType_[band])
- {
- case TeUNSIGNEDCHAR:
- pt = (data_TeUNSIGNEDCHAR_) + (params_.ncols_ * params_.nlines_*band);
- break;
- case TeCHAR:
- pt = (data_TeCHAR_) + (params_.ncols_ * params_.nlines_*band);
- break;
- case TeUNSIGNEDSHORT:
- pt = (data_TeUNSIGNEDSHORT_) + (params_.ncols_ * params_.nlines_*band);
- break;
- case (TeSHORT):
- pt = (data_TeSHORT_) + (params_.ncols_ * params_.nlines_*band);
- break;
- case (TeINTEGER):
- pt = (data_TeINTEGER_) + (params_.ncols_ * params_.nlines_*band);
- break;
- case (TeUNSIGNEDLONG):
- pt = (data_TeUNSIGNEDLONG_) + (params_.ncols_ * params_.nlines_*band);
- break;
- case (TeLONG):
- pt = (data_TeLONG_) + (params_.ncols_ * params_.nlines_*band);
- break;
- case (TeFLOAT):
- pt = (data_TeFLOAT_) + (params_.ncols_ * params_.nlines_*band);
- break;
- case (TeDOUBLE):
- pt = (data_TeDOUBLE_) + (params_.ncols_ * params_.nlines_*band);
- break;
- default:
- break;
- }
- return (void*) pt;
-}
-
-void
-TeDecoderMemory::init()
-{
- params_.errorMessage_.clear();
- params_.status_= TeRasterParams::TeNotReady;
- nelems_ = params_.nlines_*params_.ncols_*params_.nBands();
- if (!allocateMemory() || !resetMemory())
- {
- params_.errorMessage_ = "Fail to allocate enough memory to hold the raster.";
- return;
- }
- updateFuncPtr();
-
- // this decoder always grant an read/write access
- params_.status_ = TeRasterParams::TeReadyToWrite;
-}
-
-bool
-TeDecoderMemory::getElement (int col,int lin, double& val,int band)
-{
- unsigned long position = 0;
- switch (params_.interleaving_)
- {
- case TeRasterParams::TePerPixel:
- position = params_.nBands()*(params_.ncols_*lin+col)+band;
- break;
- case TeRasterParams::TePerLine:
- position = (params_.nBands()*params_.ncols_*lin)+band*params_.ncols_+col;
- break;
- case TeRasterParams::TePerBand:
- position = band*(params_.ncols_*params_.nlines_)+(params_.ncols_*lin+col);
- break;
- }
- assert(position < nelems_);
- (this->*( getelement_ptr_))(position,val);
- return true;
-}
-
-bool
-TeDecoderMemory::setElement (int col, int lin, double val,int band)
-{
- unsigned long position = 0;
- switch (params_.interleaving_)
- {
- case TeRasterParams::TePerPixel:
- position = params_.nBands()*(params_.ncols_*lin+col)+band;
- break;
- case TeRasterParams::TePerLine:
- position = (params_.nBands()*params_.ncols_*lin)+band*params_.ncols_+col;
- break;
- case TeRasterParams::TePerBand:
- position = band*(params_.ncols_*params_.nlines_)+(params_.ncols_*lin+col);
- break;
- }
- assert(position < nelems_);
- (this->*( setelement_ptr_))(position,val);
- return true;
-}
-
-void TeDecoderMemory::updateFuncPtr()
-{
- if ( getelement_ptr_ != 0 )
- getelement_ptr_ = 0;
-
- if ( setelement_ptr_ != 0 )
- setelement_ptr_ = 0;
-
- switch ( params_.dataType_[0] )
- {
- case (TeCHAR) :
- {
- getelement_ptr_ = &TeDecoderMemory::getElement_TeCHAR;
- setelement_ptr_ = &TeDecoderMemory::setElement_TeCHAR;
- break;
- }
- case (TeUNSIGNEDSHORT):
- {
- getelement_ptr_ = &TeDecoderMemory::getElement_TeUNSIGNEDSHORT;
- setelement_ptr_ = &TeDecoderMemory::setElement_TeUNSIGNEDSHORT;
- break;
- }
- case (TeSHORT):
- {
- getelement_ptr_ = &TeDecoderMemory::getElement_TeSHORT;
- setelement_ptr_ = &TeDecoderMemory::setElement_TeSHORT;
- break;
- }
- case (TeINTEGER):
- {
- getelement_ptr_ = &TeDecoderMemory::getElement_TeINTEGER;
- setelement_ptr_ = &TeDecoderMemory::setElement_TeINTEGER;
- break;
- }
- case (TeUNSIGNEDLONG):
- {
- getelement_ptr_ = &TeDecoderMemory::getElement_TeUNSIGNEDLONG;
- setelement_ptr_ = &TeDecoderMemory::setElement_TeUNSIGNEDLONG;
- break;
- }
- case (TeLONG):
- {
- getelement_ptr_ = &TeDecoderMemory::getElement_TeLONG;
- setelement_ptr_ = &TeDecoderMemory::setElement_TeLONG;
- break;
- }
- case (TeFLOAT):
- {
- getelement_ptr_ = &TeDecoderMemory::getElement_TeFLOAT;
- setelement_ptr_ = &TeDecoderMemory::setElement_TeFLOAT;
- break;
- }
- case (TeDOUBLE):
- {
- getelement_ptr_ = &TeDecoderMemory::getElement_TeDOUBLE;
- setelement_ptr_ = &TeDecoderMemory::setElement_TeDOUBLE;
- break;
- }
- default:
- {
- getelement_ptr_ = &TeDecoderMemory::getElement_TeUNSIGNEDCHAR;
- setelement_ptr_ = &TeDecoderMemory::setElement_TeUNSIGNEDCHAR;
- break;
- }
- }
-}
-
-bool
-TeDecoderMemory::allocateMemory()
-{
- long nelems = params_.nlines_*params_.ncols_*params_.nBands();
-
- // allocate necessary memory
- switch (params_.dataType_[0])
- {
- case (TeUNSIGNEDCHAR):
- if ((nelems*sizeof(unsigned char)) == (nelems_*sizeof(unsigned char)) && data_TeUNSIGNEDCHAR_)
- return true;
- data_TeUNSIGNEDCHAR_ = new unsigned char [nelems_];
- if (!data_TeUNSIGNEDCHAR_)
- return false;
- size_ = nelems_ * sizeof(unsigned char);
- break;
-
- case (TeCHAR):
- if ((nelems*sizeof(char)) == (nelems_*sizeof(char)) && data_TeCHAR_)
- return true;
- data_TeCHAR_ = new char [nelems_];
- if (!data_TeCHAR_)
- return false;
- size_ = nelems_ * sizeof(char);
- break;
-
- case (TeUNSIGNEDSHORT):
- if ((nelems*sizeof(unsigned short)) == (nelems_*sizeof(unsigned short)) && data_TeUNSIGNEDSHORT_)
- return true;
- data_TeUNSIGNEDSHORT_ = new unsigned short [nelems_];
- if (!data_TeUNSIGNEDSHORT_)
- return false;
- size_ = nelems_ * sizeof(unsigned short);
- break;
-
- case (TeSHORT):
- if ((nelems*sizeof( short)) == (nelems_*sizeof(short)) && data_TeSHORT_)
- return true;
- data_TeSHORT_ = new short [nelems_];
- if (!data_TeSHORT_)
- return false;
- size_ = nelems_ * sizeof(short);
- break;
-
- case (TeINTEGER):
- if ((nelems*sizeof(int)) == (nelems_*sizeof(int)) && data_TeINTEGER_)
- return true;
- data_TeINTEGER_ = new int [nelems_];
- if (!data_TeINTEGER_)
- return false;
- size_ = nelems_ * sizeof(int);
- break;
-
- case (TeUNSIGNEDLONG):
- if ((nelems*sizeof(unsigned long)) == (nelems_*sizeof(unsigned long)) && data_TeUNSIGNEDLONG_)
- return true;
- data_TeUNSIGNEDLONG_ = new unsigned long [nelems_];
- if (!data_TeUNSIGNEDLONG_)
- return false;
- size_ = nelems_ * sizeof(unsigned long);
- break;
-
- case (TeLONG):
- if ((nelems*sizeof(long)) == (nelems_*sizeof(long)) && data_TeLONG_)
- return true;
- data_TeLONG_ = new long [nelems_];
- if (!data_TeLONG_)
- return false;
- size_ = nelems_ * sizeof(long);
- break;
-
- case (TeFLOAT):
- if ((nelems*sizeof(float)) == (nelems_*sizeof(float)) && data_TeFLOAT_)
- return true;
- data_TeFLOAT_ = new float [nelems_];
- if (!data_TeFLOAT_)
- return false;
- size_ = nelems_ * sizeof(float);
- break;
-
- case (TeDOUBLE):
- if ((nelems*sizeof(double)) == (nelems_*sizeof(double)) && data_TeDOUBLE_)
- return true;
- data_TeDOUBLE_ = new double [nelems_];
- if (!data_TeDOUBLE_)
- return false;
- size_ = nelems_ * sizeof(double);
- break;
-
- default:
- return false;
- }
- return true;
-}
-
-
-bool
-TeDecoderMemory::resetMemory()
-{
- unsigned int i;
- switch (params_.dataType_[0])
- {
- case (TeBIT):
- case (TeCHAR):
- if (!data_TeCHAR_)
- return false;
- for(i=0; i<nelems_; data_TeCHAR_[i]=static_cast<char>(params_.dummy_[0]),++i);
- break;
-
- case (TeUNSIGNEDCHAR):
- if (!data_TeUNSIGNEDCHAR_)
- return false;
- for(i=0; i<nelems_; data_TeUNSIGNEDCHAR_[i]=static_cast<unsigned char>(params_.dummy_[0]),++i);
- break;
-
- case (TeUNSIGNEDSHORT):
- if (!data_TeUNSIGNEDSHORT_)
- return false;
- for(i=0; i<nelems_; data_TeUNSIGNEDSHORT_[i]=static_cast<unsigned short>(params_.dummy_[0]),++i);
- break;
-
- case (TeSHORT):
- if (!data_TeSHORT_)
- return false;
- for(i=0; i<nelems_; data_TeSHORT_[i]=static_cast<short>(params_.dummy_[0]),++i);
- break;
-
- case (TeINTEGER):
- if (!data_TeINTEGER_)
- return false;
- for(i=0; i<nelems_; data_TeINTEGER_[i]=static_cast<int>(params_.dummy_[0]),++i);
- break;
-
- case (TeUNSIGNEDLONG):
- if (!data_TeUNSIGNEDLONG_)
- return false;
- for(i=0; i<nelems_; data_TeUNSIGNEDLONG_[i]=static_cast<unsigned long>(params_.dummy_[0]),++i);
- break;
-
- case (TeLONG):
- if (!data_TeLONG_)
- return false;
- for(i=0; i<nelems_; data_TeLONG_[i]=static_cast<long>(params_.dummy_[0]),++i);
- break;
-
- case (TeFLOAT):
- if (!data_TeFLOAT_)
- return false;
- for(i=0; i<nelems_; data_TeFLOAT_[i]=static_cast<float>(params_.dummy_[0]),++i);
- break;
-
- case (TeDOUBLE):
- if (!data_TeDOUBLE_)
- return false;
- for(i=0; i<nelems_; data_TeDOUBLE_[i]=static_cast<double>(params_.dummy_[0]),++i);
- break;
-
- default:
- break;
-}
-
- return true;
-}
-
-bool
-TeDecoderMemory::clear()
-{
- if (data_TeUNSIGNEDCHAR_)
- {
- delete [] data_TeUNSIGNEDCHAR_;
- data_TeUNSIGNEDCHAR_ = 0;
- return true;
- }
- if (data_TeCHAR_)
- {
- delete [] data_TeCHAR_;
- data_TeCHAR_ = 0;
- return true;
- }
- if (data_TeUNSIGNEDSHORT_)
- {
- delete [] data_TeUNSIGNEDSHORT_;
- data_TeUNSIGNEDSHORT_ = 0;
- return true;
- }
- if (data_TeSHORT_)
- {
- delete [] data_TeSHORT_;
- data_TeSHORT_ = 0;
- return true;
- }
- if (data_TeINTEGER_)
- {
- delete [] data_TeINTEGER_;
- data_TeINTEGER_ = 0;
- return true;
- }
- if (data_TeUNSIGNEDLONG_)
- {
- delete [] data_TeUNSIGNEDLONG_;
- data_TeUNSIGNEDLONG_ = 0;
- return true;
- }
- if (data_TeLONG_)
- {
- delete [] data_TeLONG_;
- data_TeLONG_ = 0;
- return true;
- }
- if (data_TeFLOAT_)
- {
- delete [] data_TeFLOAT_;
- data_TeFLOAT_ = 0;
- return true;
- }
- if (data_TeDOUBLE_)
- {
- delete [] data_TeDOUBLE_;
- data_TeDOUBLE_ = 0;
- return true;
- }
- params_.status_ = TeRasterParams::TeNotReady;
- return true;
-}
-
-
-inline void TeDecoderMemory::setElement_TeUNSIGNEDCHAR(const long& pos, const double& val)
-{
- assert(data_TeUNSIGNEDCHAR_ != 0 );
- data_TeUNSIGNEDCHAR_[pos] = (unsigned char)val;
-}
-
-
-inline void TeDecoderMemory::setElement_TeCHAR(const long& pos, const double& val)
-{
- assert(data_TeCHAR_ != 0 );
- data_TeCHAR_[pos] = (char)val;
-}
-
-
-inline void TeDecoderMemory::setElement_TeUNSIGNEDSHORT(const long& pos, const double& val)
-{
- assert(data_TeUNSIGNEDSHORT_ != 0 );
- data_TeUNSIGNEDSHORT_[pos] = (unsigned short)val;
-}
-
-
-inline void TeDecoderMemory::setElement_TeSHORT(const long& pos, const double& val)
-{
- assert(data_TeSHORT_ != 0 );
- data_TeSHORT_[pos] = (short)val;
-}
-
-
-inline void TeDecoderMemory::setElement_TeINTEGER(const long& pos, const double& val)
-{
- assert(data_TeINTEGER_ != 0 );
- data_TeINTEGER_[pos] = (int)val;
-}
-
-
-inline void TeDecoderMemory::setElement_TeUNSIGNEDLONG(const long& pos, const double& val)
-{
- assert(data_TeUNSIGNEDLONG_ != 0 );
- data_TeUNSIGNEDLONG_[pos] = (unsigned long)val;
-}
-
-
-inline void TeDecoderMemory::setElement_TeLONG(const long& pos, const double& val)
-{
- assert(data_TeLONG_ != 0 );
- data_TeLONG_[pos] = (long)val;
-}
-
-
-inline void TeDecoderMemory::setElement_TeFLOAT(const long& pos, const double& val)
-{
- assert(data_TeFLOAT_ != 0 );
- data_TeFLOAT_[pos] = (float)val;
-}
-
-
-inline void TeDecoderMemory::setElement_TeDOUBLE(const long& pos, const double& val)
-{
- assert(data_TeDOUBLE_ != 0 );
- data_TeDOUBLE_[pos] = val;
-}
-
-
-inline void TeDecoderMemory::getElement_TeUNSIGNEDCHAR(const long& pos, double& val)
-{
- assert(data_TeUNSIGNEDCHAR_ != 0 );
- val = (double)data_TeUNSIGNEDCHAR_[pos];
-}
-
-
-inline void TeDecoderMemory::getElement_TeCHAR(const long& pos, double& val)
-{
- assert(data_TeCHAR_ != 0 );
- val = (double)data_TeCHAR_[pos];
-}
-
-
-inline void TeDecoderMemory::getElement_TeUNSIGNEDSHORT(const long& pos, double& val)
-{
- assert(data_TeUNSIGNEDSHORT_ != 0 );
- val = (double)data_TeUNSIGNEDSHORT_[pos];
-}
-
-
-inline void TeDecoderMemory::getElement_TeSHORT(const long& pos, double& val)
-{
- assert(data_TeSHORT_ != 0 );
- val = (double)data_TeSHORT_[pos];
-}
-
-
-inline void TeDecoderMemory::getElement_TeINTEGER(const long& pos, double& val)
-{
- assert(data_TeINTEGER_ != 0 );
- val = (double)data_TeINTEGER_[pos];
-}
-
-
-inline void TeDecoderMemory::getElement_TeUNSIGNEDLONG(const long& pos, double& val)
-{
- assert(data_TeUNSIGNEDLONG_ != 0 );
- val = (double)data_TeUNSIGNEDLONG_[pos];
-}
-
-
-inline void TeDecoderMemory::getElement_TeLONG(const long& pos,double& val)
-{
- assert(data_TeLONG_ != 0 );
- val = (double)data_TeLONG_[pos];
-}
-
-
-inline void TeDecoderMemory::getElement_TeFLOAT(const long& pos, double& val)
-{
- assert(data_TeFLOAT_ != 0 );
- val = (double)data_TeFLOAT_[pos];
-}
-
-
-inline void TeDecoderMemory::getElement_TeDOUBLE(const long& pos, double& val)
-{
- assert(data_TeDOUBLE_ != 0 );
- val = (double)data_TeDOUBLE_[pos];
-}
-
diff --git a/src/terralib/kernel/TeDecoderMemory.h b/src/terralib/kernel/TeDecoderMemory.h
deleted file mode 100644
index 3eb7852..0000000
--- a/src/terralib/kernel/TeDecoderMemory.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoderMemory.h
- \brief This file deals with decoding of raster structures as a mulitdimensional matrix in memory.
-*/
-#ifndef __TERRALIB_INTERNAL_DECODERMEMORY_H
-#define __TERRALIB_INTERNAL_DECODERMEMORY_H
-
-#include "TeDecoder.h"
-
-//! Implements a decoder to a raster stored as a as a mulitdimensional matrix in memory
-/*
- This classes tries to allocate the matrix in the memory RAM. No strategies or policies
- to allocate huge matrices are applied. It also doesn't support multiple bands with different types.
- For overcome this limitations use the class TeDecoderSmartMem.
- \sa TeDecoderSmartMem
-*/
-class TL_DLL TeDecoderMemory : public TeDecoder
-{
-public:
- //! Empty constructor
- TeDecoderMemory();
-
- //! Constructor from parameters
- TeDecoderMemory (const TeRasterParams& par);
-
- //! Destructor
- ~TeDecoderMemory ();
-
- //! Writes an element
- bool setElement (int col,int lin, double val, int band=0);
-
- //! Reads an element
- bool getElement (int col,int lin, double &val,int band=0);
-
- //! Retuns a pointer to a given band
- /*
- \note This method is applicable only when band interleaved organization
- */
- void* data (int band=0);
-
- //! Initalizes the internal structures
- void init();
-
- //! Releases the internal structures
- bool clear();
-
- //! Allocates the necessary memory
- bool allocateMemory();
-
- //! Deallocates the used memory
- bool resetMemory();
-
-private:
-
- unsigned int nelems_;
- unsigned int size_;
-
- //! Type definition for the getElement function pointer
- typedef void (TeDecoderMemory::*GetEleFunctPtrT)( const long& pos, double& val );
-
- //! Type definition for the setElement function pointer
- typedef void (TeDecoderMemory::*SetEleFunctPtrT)( const long& pos, const double& val );
-
- //! A pointer to the current getElement method following the current data type
- GetEleFunctPtrT getelement_ptr_;
-
- //! A pointer to the current setElement method following the current data
- SetEleFunctPtrT setelement_ptr_;
-
- //! A casted pointer to the current data
- unsigned char* data_TeUNSIGNEDCHAR_;
-
- //! A casted pointer to the current data
- char* data_TeCHAR_;
-
- //! A casted pointer to the current data
- unsigned short* data_TeUNSIGNEDSHORT_;
-
- //! A casted pointer to the current data
- short* data_TeSHORT_;
-
- //! A casted pointer to the current data
- int* data_TeINTEGER_;
-
- //! A casted pointer to the current data
- unsigned long* data_TeUNSIGNEDLONG_;
-
- //! A casted pointer to the current data
- long* data_TeLONG_;
-
- //! A casted pointer to the current data
- float* data_TeFLOAT_;
-
- //! A casted pointer to the current data
- double* data_TeDOUBLE_;
-
- //! Update the function pointer using the current raster parameters
- void updateFuncPtr();
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void setElement_TeUNSIGNEDCHAR( const long& pos, const double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void setElement_TeCHAR( const long& pos, const double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void setElement_TeUNSIGNEDSHORT( const long& pos, const double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void setElement_TeSHORT( const long& pos, const double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void setElement_TeINTEGER( const long& pos, const double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void setElement_TeUNSIGNEDLONG( const long& pos, const double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void setElement_TeLONG( const long& pos, const double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void setElement_TeFLOAT( const long& pos, const double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void setElement_TeDOUBLE( const long& pos, const double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void getElement_TeUNSIGNEDCHAR( const long& pos, double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void getElement_TeCHAR( const long& pos, double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void getElement_TeUNSIGNEDSHORT( const long& pos, double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void getElement_TeSHORT( const long& pos, double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void getElement_TeINTEGER( const long& pos, double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void getElement_TeUNSIGNEDLONG( const long& pos, double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void getElement_TeLONG( const long& pos, double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void getElement_TeFLOAT( const long& pos, double& val );
-
- /*! \brief Method overload.
- \param line Line.
- \param col Column.
- \param band Band.
- \param val Pixel value.
- */
- inline void getElement_TeDOUBLE( const long& pos, double& val );
-};
-
-//! Implements a factory to build decoder to MEMORY raster
-class TL_DLL TeDecoderMemoryFactory : public TeDecoderFactory
-{
-public:
-
- //! Factory constructor
- TeDecoderMemoryFactory(const string& name) : TeDecoderFactory(name) {}
-
- //! Build an object
- TeDecoder* build (const TeRasterParams& arg)
- { return new TeDecoderMemory(arg); }
-};
-#endif
-
diff --git a/src/terralib/kernel/TeDecoderMemoryMap.cpp b/src/terralib/kernel/TeDecoderMemoryMap.cpp
deleted file mode 100644
index f93f5ac..0000000
--- a/src/terralib/kernel/TeDecoderMemoryMap.cpp
+++ /dev/null
@@ -1,430 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeDecoderMemoryMap.h"
-#include "TeUtils.h"
-#include "TeAsciiFile.h"
-#include <map>
-#include <string>
-
-TeDecoderMemoryMap::TeDecoderMemoryMap ( const TeRasterParams& par )
-{
- params_ = par;
- dataInitPos_ = 0;
- dataInitPos_ = par.offset_;
- m_lpszFile = 0;
- m_hFile = 0;
- params_.decoderIdentifier_ = "MEMMAP";
- params_.errorMessage_.clear();
-}
-
-TeDecoderMemoryMap::~TeDecoderMemoryMap ()
-{
- if (m_hFile != 0)
- clear();
-}
-bool
-TeDecoderMemoryMap::getElement (int col,int lin, double& val,int band)
-{
- unsigned long position = 0;
- switch (params_.interleaving_)
- {
- case TeRasterParams::TePerPixel:
- position = params_.nBands()*(params_.ncols_*lin+col)+band;
- break;
- case TeRasterParams::TePerLine:
- position = (params_.nBands()*params_.ncols_*lin)+band*params_.ncols_+col;
- break;
- case TeRasterParams::TePerBand:
- position = band*(params_.ncols_*params_.nlines_)+(params_.ncols_*lin+col);
- break;
- }
-
- position += dataInitPos_;
- switch (params_.dataType_[0])
- {
- case (TeUNSIGNEDCHAR):
- val = ((unsigned char*)m_lpszFile)[position];
- break;
- case (TeCHAR) :
- val = ((char*) m_lpszFile)[position];
- break;
- case (TeUNSIGNEDSHORT):
- unsigned short uval;
- if (params_.swap_)
- uval = swaps(((unsigned short*)m_lpszFile)[position]);
- else
- uval = ((unsigned short*)m_lpszFile)[position];
- val = uval;
- break;
- case (TeSHORT):
- if (params_.swap_)
- val = swaps(((short*)m_lpszFile)[position]);
- else
- val = ((short*)m_lpszFile)[position];
- break;
- case (TeINTEGER):
- val = ((int*)m_lpszFile)[position];
- break;
- case (TeUNSIGNEDLONG):
- val = ((unsigned long*)m_lpszFile)[position];
- break;
- case (TeLONG):
- val = ((long*)m_lpszFile)[position];
- break;
- case (TeFLOAT):
- val = ((float*)m_lpszFile)[position];
- break;
- case (TeDOUBLE):
- val = ((double*)m_lpszFile)[position];
- break;
- default:
- return false;
- }
- return true;
-}
-
-bool
-TeDecoderMemoryMap::setElement (int col,int lin, double val, int band)
-{
- unsigned long position = 0;
- switch (params_.interleaving_)
- {
- case TeRasterParams::TePerPixel:
- position = params_.nBands()*(params_.ncols_*lin+col)+band;
- break;
- case TeRasterParams::TePerLine:
- position = (params_.nBands()*params_.ncols_*lin)+band*params_.ncols_+col;
- break;
- case TeRasterParams::TePerBand:
- position = band*(params_.ncols_*params_.nlines_)+(params_.ncols_*lin+col);
- break;
- }
-
- position += dataInitPos_;
- switch (params_.dataType_[0])
- {
- case (TeUNSIGNEDCHAR):
- ((unsigned char*)m_lpszFile)[position] = (unsigned char) val;
- break;
-
- case (TeCHAR) :
- ((char*) m_lpszFile)[position] = (char) val;
- break;
-
- case (TeUNSIGNEDSHORT):
- if (params_.swap_)
- ((unsigned short*)m_lpszFile)[position] = swaps((unsigned short) val);
- else
- ((unsigned short*)m_lpszFile)[position] = (unsigned short) val;
- break;
-
- case (TeSHORT):
- if (params_.swap_)
- ((short*)m_lpszFile)[position] = swaps((short) val);
- else
- ((short*)m_lpszFile)[position] = (short) val;
- break;
-
- case (TeINTEGER):
- ((int*)m_lpszFile)[position] = (int) val;
- break;
-
- case (TeUNSIGNEDLONG):
- ((unsigned long*)m_lpszFile)[position] = (unsigned long) val;
- break;
-
- case (TeLONG):
- ((long*)m_lpszFile)[position] = (long) val;
- break;
-
- case (TeFLOAT):
- ((float*)m_lpszFile)[position] = (float) val;
- break;
-
- case (TeDOUBLE):
- ((double*)m_lpszFile)[position] = val;
- break;
-
- default:
- return false;
- }
- return true;
-}
-
-#ifdef WIN32
-void
-TeDecoderMemoryMap::init()
-{
- clear();
- DWORD dwDesiredAccess, dwCreationDisposition, flProtect,dwDesiredAccessV ;
- if (params_.mode_ == 'c')
- {
- params_.writeParametersFile();
- dwCreationDisposition = CREATE_ALWAYS;
- dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
- flProtect = PAGE_READWRITE;
- dwDesiredAccessV = FILE_MAP_WRITE;
- }
- else if (params_.mode_ == 'w')
- {
- params_.readParametersFile();
- dwCreationDisposition = OPEN_ALWAYS;
- dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
- flProtect = PAGE_READWRITE;
- dwDesiredAccessV = FILE_MAP_WRITE;
- }
- else // default mode: reading
- {
- params_.readParametersFile();
- dwCreationDisposition = OPEN_EXISTING;
- dwDesiredAccess = GENERIC_READ;
- flProtect = PAGE_READONLY;
- dwDesiredAccessV = FILE_MAP_READ;
- }
-
-
- // calculate the expected file size accordingly to the parameters
- unsigned long fsize = (long)(params_.nBands()*params_.ncols_*params_.nlines_);
- fsize *= params_.elementSize(0);
-
- if (fsize <= 0)
- return;
-
- // First open the file
- m_hFile = CreateFileA(
- params_.fileName_.c_str(), // File name
- dwDesiredAccess, // Desired access
- FILE_SHARE_READ| FILE_SHARE_WRITE, // Allow sharing-- we're only doing a quick scan
- NULL, // No security attributes
- dwCreationDisposition, // Creation disposition
- 0, // Ignore file attributes
- NULL); // Ignore hTemplateFile
-
- if (m_hFile == INVALID_HANDLE_VALUE)
- return; // could not open file
-
- // get the file's size
- m_dwSize = GetFileSize(m_hFile, NULL);
- if (m_dwSize == 0xffffffff)
- {
- m_hFile = NULL;
- return;
- }
-
- if (params_.mode_ == 'c')
- {
- if (m_dwSize < fsize)
- {
- char lpBuffer[1024];
- int nNumberOfBytesToWrite = fsize-m_dwSize;
- unsigned long nNumberOfBytesWritten; // pointer to number of bytes written
- for (;nNumberOfBytesToWrite > 1024; nNumberOfBytesToWrite-=1024)
- {
- if (!WriteFile(m_hFile, lpBuffer, 1024, &nNumberOfBytesWritten, NULL))
- {
- CloseHandle(m_hFile);
- m_hFile = NULL;
- return;
- }
- }
- if (!WriteFile(m_hFile, lpBuffer, nNumberOfBytesToWrite, &nNumberOfBytesWritten, NULL))
- {
- CloseHandle(m_hFile);
- m_hFile = NULL;
- return;
- }
- }
- }
- else
- {
- if (m_dwSize < fsize)
- return;
- }
-
- // Create a mapping object from the file
- m_hMapping = CreateFileMapping(
- m_hFile, // Handle we got from CreateFile
- NULL, // No security attributes
- flProtect, // read-write
- 0, 0, // Max size = current size of file
- NULL); // Don't name the mapping object
-
- if ( m_hMapping == NULL )
- {
- CloseHandle(m_hFile);
- m_hFile = NULL;
- return;
- }
-
- // Map the file to memory
- switch (params_.dataType_[0]) {
- case (TeUNSIGNEDCHAR):
- m_lpszFile = (unsigned char*) MapViewOfFile(m_hMapping, dwDesiredAccessV, 0, 0, 0);
- break;
- case (TeCHAR) :
- m_lpszFile = (char*) MapViewOfFile(m_hMapping, dwDesiredAccessV, 0, 0, 0);
- break;
- case (TeUNSIGNEDSHORT):
- m_lpszFile = (unsigned short*) MapViewOfFile(m_hMapping, dwDesiredAccessV, 0, 0, 0);
- break;
- case (TeSHORT):
- m_lpszFile = (short*) MapViewOfFile(m_hMapping, dwDesiredAccessV, 0, 0, 0);
- break;
- case (TeUNSIGNEDLONG):
- m_lpszFile = (unsigned long*) MapViewOfFile(m_hMapping, dwDesiredAccessV, 0, 0, 0);
- break;
- case (TeLONG):
- m_lpszFile = (long*) MapViewOfFile(m_hMapping, dwDesiredAccessV, 0, 0, 0);
- break;
- case (TeFLOAT):
- m_lpszFile = (float*) MapViewOfFile(m_hMapping, dwDesiredAccessV, 0, 0, 0);
- break;
- case (TeDOUBLE):
- m_lpszFile = (double*) MapViewOfFile(m_hMapping, dwDesiredAccessV, 0, 0, 0);
- break;
- }
- if ( m_lpszFile == NULL )
- return ;
-
- if (params_.mode_ == 'c')
- {
- int b, l, c;
- for (b=0; b<params_.nBands();++b)
- for (l=0; l<params_.nlines_;++l)
- for (c=0; c<params_.ncols_;++c)
- setElement(c, l, params_.dummy_[b], b);
- }
- if (params_.mode_ =='c' || params_.mode_ == 'w')
- params_.status_ = TeRasterParams::TeReadyToWrite;
- else
- params_.status_ = TeRasterParams::TeReadyToRead;
- return;
-}
-
-bool
-TeDecoderMemoryMap::clear()
-{
- params_.status_ = TeRasterParams::TeNotReady;
- params_.errorMessage_.clear();
- if (m_hFile == NULL)
- return true;
-
- if ( !UnmapViewOfFile(m_lpszFile) )
- return false;
-
- CloseHandle(m_hMapping);
- CloseHandle(m_hFile);
- m_hFile = NULL;
- return true;
-}
-#else
-// Linux version: uses mmap
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-void
-TeDecoderMemoryMap::init()
-{
- clear();
- mode_t mode=0;
- if (params_.mode_ == 'c')
- {
- m_dwSize = (long)(params_.nBands()*params_.ncols_*params_.nlines_);
- m_dwSize *= params_.elementSize(0);
- if (m_dwSize <= 0)
- return;
- params_.writeParametersFile();
- m_hFile = open(params_.fileName_.c_str(),O_RDWR|O_CREAT,S_IRWXU);
- mode = (PROT_READ | PROT_WRITE);
- lseek(m_hFile, m_dwSize - 1, SEEK_SET);
- //write(m_hFile, '\0', 1);
- }
- else if (params_.mode_ == 'r')
- {
- params_.readParametersFile();
- m_dwSize = (long)(params_.nBands()*params_.ncols_*params_.nlines_);
- m_dwSize *= params_.elementSize(0);
- if (m_dwSize <= 0)
- return;
- m_hFile = open(params_.fileName_.c_str(),O_RDONLY,S_IRWXU);
- mode = PROT_READ;
- }
- else
- {
- params_.readParametersFile();
- m_dwSize = (long)(params_.nBands()*params_.ncols_*params_.nlines_);
- m_dwSize *= params_.elementSize(0);
- if (m_dwSize <= 0)
- return;
- m_hFile = open(params_.fileName_.c_str(),O_RDWR,S_IRWXU);
- mode = (PROT_READ | PROT_WRITE);
- }
-
- if (m_hFile == -1)
- return; // could not open file
-
- m_lpszFile = mmap(0, m_dwSize, mode, MAP_SHARED, m_hFile, 0);
- if (((long) m_lpszFile) == -1 )
- return;
-
- if (params_.mode_ == 'c')
- {
- int b, l, c;
- for (b=0; b<params_.nBands();++b)
- for (l=0; l<params_.nlines_;++l)
- for (c=0; c<params_.ncols_;++c)
- setElement(c, l, params_.dummy_[b], b);
- }
-
- if (params_.mode_ =='c' || params_.mode_ == 'w')
- params_.status_ = TeRasterParams::TeReadyToWrite;
- else
- params_.status_ = TeRasterParams::TeReadyToRead;
- return;
-}
-
-bool
-TeDecoderMemoryMap::clear()
-{
- params_.status_ = TeRasterParams::TeNotReady;
- params_.errorMessage_.clear();
- if (m_lpszFile == 0)
- return true;
-
- if ( munmap(m_lpszFile, m_dwSize) == -1)
- return false;
- m_lpszFile = 0;
- close(m_hFile);
- m_hFile = 0;
- return true;
-}
-#endif
-
-TeDecoderMemoryMapFactory::TeDecoderMemoryMapFactory(const string& name) :
- TeDecoderFactory(name)
-{
- TeDecoderFactory::instanceName2Dec()["RAW"] = "MEMMAP";
-}
diff --git a/src/terralib/kernel/TeDecoderMemoryMap.h b/src/terralib/kernel/TeDecoderMemoryMap.h
deleted file mode 100644
index 3131ac2..0000000
--- a/src/terralib/kernel/TeDecoderMemoryMap.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoderMemoryMap.h
- \brief This file deals with decoding of raster data in a bynary file, using the memory map operation system functionality
-*/
-#ifndef __TERRALIB_INTERNAL_DECODERMEMORYMAP_H
-#define __TERRALIB_INTERNAL_DECODERMEMORYMAP_H
-
-#include "TeDecoder.h"
-
-#ifdef WIN32
-#include <windows.h>
-#include <winbase.h>
-#else
-#include <sys/mman.h>
-#endif
-
-
-//! Implements a decoder to raster data in a bynary file, using the memory map operation system functionality
-/*
- Due to limits set by the operating system, the maximum amount of data you can map
- with a single instance of a memory map is 2^31 - 1 (or 2 GB).
-*/
-class TL_DLL TeDecoderMemoryMap : public TeDecoder
-{
-public:
- //! Constructor
- TeDecoderMemoryMap ( const TeRasterParams& );
-
- //! Destructor
- ~TeDecoderMemoryMap ();
-
- //! Reads an element
- bool setElement (int col,int lin, double val, int band=0);
-
- //! Writes an element
- bool getElement (int col,int lin, double &val,int band=0);
-
- //! Initalizes the internal structures
- virtual void init();
-
- //! Releases the internal structures
- virtual bool clear();
-
-private:
- long dataInitPos_;
-#ifdef WIN32
-// Windows support to file memory mapping
- HANDLE m_hFile; // Handle to file we're currently zapping
- HANDLE m_hMapping; // Handle to memory-mapping of that file
- LPVOID m_lpszFile; // Pointer to view of file mapped to memory
- DWORD m_dwSize;
-#else
-// Linux support to file memory mapping
- int m_hFile; //(fd) Handle to file we're currently zapping
- void* m_lpszFile; // Pointer to view of file mapped to memory
- long m_dwSize;
-#endif
-};
-
-//! Implements a factory to build memory map decoder
-class TL_DLL TeDecoderMemoryMapFactory : public TeDecoderFactory
-{
-public:
-
- //! Factory constructor
- TeDecoderMemoryMapFactory(const string& name);
-
- //! Builds the object
- virtual TeDecoder* build (const TeRasterParams& arg)
- { return new TeDecoderMemoryMap(arg); }
-};
-#endif
-
diff --git a/src/terralib/kernel/TeDecoderSPR.cpp b/src/terralib/kernel/TeDecoderSPR.cpp
deleted file mode 100644
index 1335950..0000000
--- a/src/terralib/kernel/TeDecoderSPR.cpp
+++ /dev/null
@@ -1,399 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeException.h"
-#include "TeDecoderSPR.h"
-#include "TeAsciiFile.h"
-#include "TeUtils.h"
-
-#include <cstdlib>
-#include <cstring>
-#include <fstream>
-using std::ifstream;
-using std::ofstream;
-
-TeDecoderSPR::TeDecoderSPR() :
- TeDecoderSmartMem(),
- isModified_(false)
-{
- params_.decoderIdentifier_ = "SPR";
-}
-
-TeDecoderSPR::TeDecoderSPR (const TeRasterParams& par) :
- TeDecoderSmartMem(),
- isModified_(false)
-{
- params_.errorMessage_.clear();
- if (par.fileName_.empty())
- return;
- params_ = par;
- params_.decoderIdentifier_ = "SPR";
- if (params_.mode_ == 'w' || params_.mode_ == 'r')
- readParameters();
-}
-
-TeDecoderSPR::~TeDecoderSPR()
-{
- if ( isModified_ && (params_.mode_ == 'w' || params_.mode_ == 'c'))
- { // save contents to disk
- try
- {
- TeAsciiFile sFile(params_.fileName_,"w+");
- if (writeParameters(sFile))
- saveData(sFile);
- }
- catch (...)
- {
- }
- }
- TeDecoderSmartMem::clear();
-}
-
-bool
-TeDecoderSPR::clear()
-{
- if ( isModified_ && (params_.mode_ == 'w' || params_.mode_ == 'c'))
- { // save contents to disk
- try
- {
- TeAsciiFile sFile(params_.fileName_,"w+");
- if (writeParameters(sFile))
- saveData(sFile);
- }
- catch (...)
- {
- }
- isModified_ = false;
- }
- TeDecoderSmartMem::clear();
- return true;
-}
-
-bool
-TeDecoderSPR::readParameters()
-{
- try
- {
- TeAsciiFile pFile (params_.fileName_);
- string name;
-
- // check if there is the GRIDDEF section
- while (pFile.isNotAtEOF())
- {
- name = pFile.readString();
- if (name[0] =='/' && name[1] == '/') // skip comments
- pFile.findNewLine();
- else if (name == "GRIDDEF")
- break;
- }
- if (!pFile.isNotAtEOF()) // unexpected end of file
- return false;
-
- // read INFO section
- double x1, y2;
- int ncols;
- double dummy;
-
- // Expected format to grid definition:
- // GRIDDEF <ncols> <nlins> <X1> <Y2> <resX> <resY> <nodatavalue>
- params_.ncols_ = ncols = pFile.readInt();
- params_.nlines_ = pFile.readInt();
- x1 = pFile.readFloat();
- y2 = pFile.readFloat();
- params_.resx_ = pFile.readFloat();
- params_.resy_ = pFile.readFloat();
- params_.nBands(1);
- dummy = pFile.readFloat();
- params_.useDummy_ = true;
- params_.setDummy(dummy);
-
- do
- {
- name = pFile.readString();
- if (name[0] =='/' && name[1] == '/') // skip comments
- pFile.findNewLine();
- } while (pFile.isNotAtEOF() && name != "GRIDCLASS" && name != "INFO_END");
-
- if (name == "GRIDCLASS" )
- {
- params_.setPhotometric(TeRasterParams::TePallete);
- params_.setDataType(TeUNSIGNEDCHAR);
-
- // Expected format GRIDCLASS <nclass> <ncolorR> <ncolorG> <ncolorB> <nameclass>
- params_.lutr_.clear();
- params_.lutg_.clear();
- params_.lutb_.clear();
-
- params_.lutr_.insert(params_.lutr_.begin(),256,0);
- params_.lutg_.insert(params_.lutg_.begin(),256,0);
- params_.lutb_.insert(params_.lutb_.begin(),256,0);
-
- vector<string> lnames;
- name = pFile.readString();
- while (pFile.isNotAtEOF() && name != "INFO_END") // loop through all class definitions
- {
- int index = atoi(name.c_str());
- params_.lutr_[index] = pFile.readInt();
- params_.lutg_[index] = pFile.readInt();
- params_.lutb_[index] = pFile.readInt();
- lnames.clear();
- pFile.readStringList(lnames); // class name
- name = pFile.readString(); // next index
- }
-
- if (!pFile.isNotAtEOF()) // unexpected end of file
- return false;
- }
- else if (name == "INFO_END")
- {
- params_.setDataType(TeDOUBLE);
- params_.setPhotometric(TeRasterParams::TeMultiBand);
- }
- params_.topLeftResolutionSize(x1,y2,params_.resx_,params_.resy_,
- params_.ncols_,params_.nlines_,false);
- TeProjection* pp = new TeNoProjection();
- params_.projection(pp);
- delete pp;
- }
- catch(...)
- {
- return false;
- }
- return true;
-}
-
-bool
-TeDecoderSPR::readFile(const string& filename)
-{
- string valstring;
- try
- {
- TeAsciiFile pFile (filename);
- string name;
- while (pFile.isNotAtEOF() && name != "INFO_END")
- {
- name = pFile.readString();
- if (name[0] =='/' && name[1] == '/') // skip comments
- pFile.findNewLine();
- }
- if (!pFile.isNotAtEOF()) // unexpected end of file
- return false;
-
- for (int lin = 0; lin < params_.nlines_; lin++)
- {
- for (int col = 0; col < params_.ncols_; col++)
- {
- valstring = pFile.readString();
- setElement(col,lin,atof(valstring.c_str()));
- }
- }
- }
- catch(...)
- {
- return false;
- }
- return true;
-}
-
-void
-TeDecoderSPR::init()
-{
- params_.status_= TeRasterParams::TeNotReady;
- int nb = params_.nBands();
- if (nb != 1 )
- {
- params_.errorMessage_ = "Ascii SPRING can store raster with only 1 band.";
- return;
- }
-
- // 1 - check if file exists and has the necessary permission
- if (params_.mode_ == 'c') // creating a new file
- {
- ofstream dataFile(params_.fileName_.c_str()); // try to (re)create the file
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to (re)create the raster the file:" + params_.fileName_;
- return;
- }
- }
- else if (params_.mode_ == 'w')
- {
- ifstream dataFile(params_.fileName_.c_str()); // check if file exists
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to open the raster the file:" + params_.fileName_;
- return;
- }
- dataFile.close();
- }
- else if (params_.mode_ == 'r')
- {
- ifstream dataFile(params_.fileName_.c_str()); // check if file exists
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to open the raster the file:" + params_.fileName_;
- return;
- }
- dataFile.close();
- }
-
- // 2 - check if there is memory enough to handle the data
- TeDecoderSmartMem::init();
- if (params_.status_ == TeRasterParams::TeNotReady)
- return;
-
- // 3 - try to read the data
- if (params_.mode_ == 'c') // creating a new file
- {
- try
- {
- params_.status_ = TeRasterParams::TeNotReady;
- TeAsciiFile sFile(params_.fileName_,"w+");
- if (!writeParameters(sFile) || !saveData(sFile))
- {
- params_.errorMessage_ = "Fail to write the raster to file";
- return;
- }
- params_.status_ = TeRasterParams::TeReadyToWrite;
- }
- catch (...)
- {
- params_.errorMessage_ = "Fail to write the raster to file";
- }
- }
- else if (params_.mode_ == 'w')
- {
- if (!readFile(params_.fileName_))
- {
- params_.status_ = TeRasterParams::TeNotReady;
- params_.errorMessage_ = "Fail to read the raster the file:" + params_.fileName_;
- return;
- }
- params_.status_ = TeRasterParams::TeReadyToWrite;
- }
- else if (params_.mode_ == 'r')
- {
- if (!readFile(params_.fileName_))
- {
- params_.status_ = TeRasterParams::TeNotReady;
- params_.errorMessage_ = "Fail to read the raster the file:" + params_.fileName_;
- return;
- }
- params_.status_ = TeRasterParams::TeReadyToRead;
- }
-}
-
-bool
-TeDecoderSPR::writeParameters(TeAsciiFile& pFile)
-{
- string name;
- try
- {
- TeBox box = params_.boundingBox();
- name = "GRIDREG\nINFO\n";
- pFile.writeString(name);
- name = "//Formato GRIDDEF <ncols> <nlins> <X1> <Y2> <resX> <resY> <nodatavalue>\n";
- pFile.writeString(name);
- name = "GRIDDEF ";
- pFile.writeString(name);
- name = Te2String(params_.ncols_) + " " + Te2String(params_.nlines_) + " ";
- pFile.writeString(name);
- name = Te2String(box.x1_,6) + " " + Te2String(box.y2_,6) + " ";
- pFile.writeString(name);
- name = Te2String(params_.resx_,6) + " " + Te2String(params_.resy_,6) + " ";
- pFile.writeString(name);
- name = Te2String(params_.dummy_[0],6) + "\n";
- pFile.writeString(name);
-
- if (params_.photometric_[0] == TeRasterParams::TePallete)
- {
- name = "GRIDCLASS\n";
- for (unsigned int nc=0; nc<params_.lutr_.size(); ++nc)
- {
- name = Te2String(nc) + " " + Te2String(params_.lutr_[nc]);
- name += " " + Te2String(params_.lutg_[nc]) + " " + Te2String(params_.lutb_[nc]);
- name += " c" + Te2String(nc) + "\n";
- pFile.writeString(name);
- }
- }
- name = "INFO_END\n";
- pFile.writeString(name);
- }
- catch (...)
- {
- return false;
- }
- return true;
-}
-
-bool
-TeDecoderSPR::saveData(TeAsciiFile& pFile)
-{
- bool isi = (params_.dataType_[0] != TeDOUBLE) && (params_.dataType_[0] != TeFLOAT);
-
- FILE* fp = pFile.FilePtr();
- char fmt[100];
- if (isi)
- strcpy(fmt,"%.0f ");
- else
- strcpy(fmt,"%f ");
- try
- {
- double d;
- for (int l=0; l<params_.nlines_; ++l)
- {
- for (int c=0; c<params_.ncols_; ++c)
- {
- TeDecoderSmartMem::getElement(c,l,d);
- fprintf(fp,fmt,d);
- }
- pFile.writeNewLine();
- }
- string spc = "END\n";
- pFile.writeString(spc);
- }
- catch(...)
- {
- return false;
- }
- return true;
-}
-
-bool
-TeDecoderSPR::setElement (int col,int lin, double val, int band)
-{
- if (TeDecoderSmartMem::setElement(col,lin,val,band))
- {
- isModified_ = true;
- return true;
- }
- else
- return false;
-}
-
-
-TeDecoderSPRFactory::TeDecoderSPRFactory(const string& name):
- TeDecoderFactory(name)
-{
- TeDecoderFactory::instanceName2Dec()["SPR"] = "SPR";
-}
diff --git a/src/terralib/kernel/TeDecoderSPR.h b/src/terralib/kernel/TeDecoderSPR.h
deleted file mode 100644
index 3586944..0000000
--- a/src/terralib/kernel/TeDecoderSPR.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoderSPR.h
- \brief This file deals with decoding of raster data in a ASCII SPRING format
-*/
-#ifndef __TERRALIB_INTERNAL_DECODERSPR_H
-#define __TERRALIB_INTERNAL_DECODERSPR_H
-
-#include "TeDecoderSmartMem.h"
-
-class TeAsciiFile;
-
-//! Implements a decoder for raster data in ASCII-SPRING format
-/*! The description of this format can be found at SPRING website <http://www.dpi.inpe.br/spring>.\par
- The default file extension associated to this format is ".spr".
-*/
-class TL_DLL TeDecoderSPR : public TeDecoderSmartMem
-{
-public:
- //! Empty constructor
- TeDecoderSPR();
-
- //! Constructor from some parameters
- TeDecoderSPR(const TeRasterParams& par);
-
- //! Destructor
- ~TeDecoderSPR();
-
- //! Intializes the internal structures
- void init();
-
- //! Releases the internal structures
- bool clear();
-
- //! Writes an element
- bool setElement (int col,int lin, double val, int band=0);
-
-private:
-
- bool isModified_;
-
- bool readFile(const string& filename);
- bool readParameters();
- bool writeParameters(TeAsciiFile& pFile);
- bool saveData(TeAsciiFile& pFile);
-};
-
-//! Implements a factory to build decoders to ASCII-SPRING raster
-class TL_DLL TeDecoderSPRFactory : public TeDecoderFactory
-{
-public:
- //! Factory constructor
- TeDecoderSPRFactory(const string& name);
-
- //! Builds the object
- TeDecoder* build (const TeRasterParams& arg)
- { return new TeDecoderSPR(arg); }
-};
-
-#endif
diff --git a/src/terralib/kernel/TeDecoderSmartMem.cpp b/src/terralib/kernel/TeDecoderSmartMem.cpp
deleted file mode 100644
index 855bf50..0000000
--- a/src/terralib/kernel/TeDecoderSmartMem.cpp
+++ /dev/null
@@ -1,539 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeDecoderSmartMem.h"
-
-#include "TeException.h"
-#include "TeAgnostic.h"
-
-
-TeDecoderSmartMem::TeDecoderSmartMem ()
-{
- initVars();
-
- params_.decoderIdentifier_ = "SMARTMEM";
-};
-
-
-TeDecoderSmartMem::TeDecoderSmartMem ( const TeRasterParams& par )
-{
- initVars();
-
- params_ = par;
- params_.decoderIdentifier_ = "SMARTMEM";
-};
-
-
-
-TeDecoderSmartMem::~TeDecoderSmartMem ()
-{
- clear();
-}
-
-void TeDecoderSmartMem::init()
-{
- clear();
-
- /* Creating the new data structures */
-
- if( ( params_.nBands() > 0 ) &&
- ( params_.nlines_ > 0 ) &&
- ( params_.ncols_ > 0 ) ) {
-
- std::vector< unsigned int > tiles_sizes;
-
- for( int band_index = 0 ; band_index < params_.nBands() ;
- ++band_index ) {
-
- tiles_sizes.push_back( params_.elementSize( band_index ) * params_.ncols_ );
- }
-
- if( man_manager_.reset( params_.nBands(), params_.nlines_,
- tiles_sizes, TeRasterMemManager::AutoMemPol ) ) {
-
- if (params_.mode_ == 'c' || params_.mode_ == 'w') // creating a new file
- {
- params_.status_ = TeRasterParams::TeReadyToWrite;
- } else if (params_.mode_ == 'r') {
- params_.status_ = TeRasterParams::TeReadyToRead;
- }
-
- updateFuncPtrVectors();
- dummyFill();
- } else {
- clear();
- }
- }
-}
-
-bool TeDecoderSmartMem::clear()
-{
- man_manager_.clear();
-
- if( getelement_ptrs_vec_ != 0 ) {
- delete[] getelement_ptrs_vec_;
- getelement_ptrs_vec_ = 0;
- }
-
- if( setelement_ptrs_vec_ != 0 ) {
- delete[] setelement_ptrs_vec_;
- setelement_ptrs_vec_ = 0;
- }
-
- params_.status_= TeRasterParams::TeNotReady;
-
- return true;
-}
-
-
-void TeDecoderSmartMem::initVars()
-{
- getelement_ptrs_vec_ = 0;
- setelement_ptrs_vec_ = 0;
-};
-
-
-void TeDecoderSmartMem::updateFuncPtrVectors()
-{
- if( params_.nBands() > 0 ) {
- getelement_ptrs_vec_ = new GetEleFunctPtrT[ params_.nBands() ];
- if( getelement_ptrs_vec_ == 0 ) {
- throw TeException( UNKNOWN_ERROR_TYPE,
- "Unable to allocate GET function pointers vector", false );
- }
-
- setelement_ptrs_vec_ = new SetEleFunctPtrT[ params_.nBands() ];
- if( setelement_ptrs_vec_ == 0 ) {
- throw TeException( UNKNOWN_ERROR_TYPE,
- "Unable to allocate SET function pointers vector", false );
- }
-
- for( int band = 0 ; band < params_.nBands() ; ++band ) {
- switch ( params_.dataType_[ band ] ) {
- case (TeUNSIGNEDCHAR):
- {
- getelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::getElement_TeUNSIGNEDCHAR;
- setelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::setElement_TeUNSIGNEDCHAR;
- break;
- }
- case (TeCHAR) :
- {
- getelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::getElement_TeCHAR;
- setelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::setElement_TeCHAR;
- break;
- }
- case (TeUNSIGNEDSHORT):
- {
- getelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::getElement_TeUNSIGNEDSHORT;
- setelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::setElement_TeUNSIGNEDSHORT;
- break;
- }
- case (TeSHORT):
- {
- getelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::getElement_TeSHORT;
- setelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::setElement_TeSHORT;
- break;
- }
- case (TeINTEGER):
- {
- getelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::getElement_TeINTEGER;
- setelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::setElement_TeINTEGER;
- break;
- }
- case (TeUNSIGNEDLONG):
- {
- getelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::getElement_TeUNSIGNEDLONG;
- setelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::setElement_TeUNSIGNEDLONG;
- break;
- }
- case (TeLONG):
- {
- getelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::getElement_TeLONG;
- setelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::setElement_TeLONG;
- break;
- }
- case (TeFLOAT):
- {
- getelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::getElement_TeFLOAT;
- setelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::setElement_TeFLOAT;
- break;
- }
- case (TeDOUBLE):
- {
- getelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::getElement_TeDOUBLE;
- setelement_ptrs_vec_[ band ] =
- &TeDecoderSmartMem::setElement_TeDOUBLE;
- break;
- }
- default:
- {
- TEAGN_LOG_AND_THROW( "Invalid raster data type" );
- break;
- }
- }
- }
- }
-}
-
-
-void TeDecoderSmartMem::dummyFill()
-{
- TEAGN_DEBUG_CONDITION(
- ( params_.status_ != TeRasterParams::TeNotReady),
- "Raster not Ready" );
-
- /* Checking if dummy fill is required */
-
- if( ! params_.useDummy_ ) {
- return;
- }
-
- /* Dummy fill */
-
- const unsigned int nlines = (unsigned int )params_.nlines_;
- const unsigned int ncols = (unsigned int )params_.ncols_;
-
- unsigned int line = 0;
- unsigned int col = 0;
- double double_dummy_value = 0;
-
- for( int band = 0 ; band < params_.nBands() ; ++band ) {
- if( params_.useDummy_ ) {
- double_dummy_value = params_.dummy_[ band ];
- } else {
- double_dummy_value = 0;
- }
-
- switch ( params_.dataType_[ band ] ) {
- case (TeUNSIGNEDCHAR):
- {
- unsigned char dummy_value = (unsigned char)double_dummy_value;
- unsigned char* line_ptr = 0;
-
- for( line = 0 ; line < nlines ; ++line ) {
- line_ptr = (unsigned char*) man_manager_.getTilePointer( band,
- line );
-
- for( col = 0 ; col < ncols ; ++col ) {
- line_ptr[ col ] = dummy_value;
- }
- }
-
- break;
- }
- case (TeCHAR) :
- {
- char dummy_value = (char)double_dummy_value;
- char* line_ptr = 0;
-
- for( line = 0 ; line < nlines ; ++line ) {
- line_ptr = (char*) man_manager_.getTilePointer( band,
- line );
-
- for( col = 0 ; col < ncols ; ++col ) {
- line_ptr[ col ] = dummy_value;
- }
- }
-
- break;
- }
- case (TeUNSIGNEDSHORT):
- {
- unsigned short dummy_value = (unsigned short)double_dummy_value;
- unsigned short* line_ptr = 0;
-
- for( line = 0 ; line < nlines ; ++line ) {
- line_ptr = (unsigned short*) man_manager_.getTilePointer( band,
- line );
-
- for( col = 0 ; col < ncols ; ++col ) {
- line_ptr[ col ] = dummy_value;
- }
- }
-
- break;
- }
- case (TeSHORT):
- {
- short dummy_value = (short)double_dummy_value;
- short* line_ptr = 0;
-
- for( line = 0 ; line < nlines ; ++line ) {
- line_ptr = (short*) man_manager_.getTilePointer( band,
- line );
-
- for( col = 0 ; col < ncols ; ++col ) {
- line_ptr[ col ] = dummy_value;
- }
- }
-
- break;
- }
- case (TeINTEGER):
- {
- int dummy_value = (int)double_dummy_value;
- int* line_ptr = 0;
-
- for( line = 0 ; line < nlines ; ++line ) {
- line_ptr = (int*) man_manager_.getTilePointer( band,
- line );
-
- for( col = 0 ; col < ncols ; ++col ) {
- line_ptr[ col ] = dummy_value;
- }
- }
-
- break;
- }
- case (TeUNSIGNEDLONG):
- {
- unsigned long dummy_value = (unsigned long)double_dummy_value;
- unsigned long* line_ptr = 0;
-
- for( line = 0 ; line < nlines ; ++line ) {
- line_ptr = (unsigned long*) man_manager_.getTilePointer( band,
- line );
-
- for( col = 0 ; col < ncols ; ++col ) {
- line_ptr[ col ] = dummy_value;
- }
- }
-
- break;
- }
- case (TeLONG):
- {
- long dummy_value = (long)double_dummy_value;
- long* line_ptr = 0;
-
- for( line = 0 ; line < nlines ; ++line ) {
- line_ptr = (long*) man_manager_.getTilePointer( band,
- line );
-
- for( col = 0 ; col < ncols ; ++col ) {
- line_ptr[ col ] = dummy_value;
- }
- }
-
- break;
- }
- case (TeFLOAT):
- {
- float dummy_value = (float)double_dummy_value;
- float* line_ptr = 0;
-
- for( line = 0 ; line < nlines ; ++line ) {
- line_ptr = (float*) man_manager_.getTilePointer( band,
- line );
-
- for( col = 0 ; col < ncols ; ++col ) {
- line_ptr[ col ] = dummy_value;
- }
- }
-
- break;
- }
- case (TeDOUBLE):
- {
- double* line_ptr = 0;
-
- for( line = 0 ; line < nlines ; ++line ) {
- line_ptr = (double*) man_manager_.getTilePointer( band,
- line );
-
- for( col = 0 ; col < ncols ; ++col ) {
- line_ptr[ col ] = double_dummy_value;
- }
- }
-
- break;
- }
- default:
- {
- TEAGN_LOG_AND_THROW( "Invalid raster data type" );
- break;
- }
- }
- }
-}
-
-
-inline void TeDecoderSmartMem::setElement_TeUNSIGNEDCHAR( const int& col,
- const int& lin, const double& val, const int& band )
-{
- *( ( (unsigned char*)man_manager_.getTilePointer( band, lin ) ) + col ) =
- (unsigned char)val;
-}
-
-
-inline void TeDecoderSmartMem::setElement_TeCHAR(const int& col,
- const int& lin, const double& val, const int& band )
-{
- *( ( (char*)man_manager_.getTilePointer( band, lin ) ) + col ) =
- (char)val;
-}
-
-
-inline void TeDecoderSmartMem::setElement_TeUNSIGNEDSHORT(const int& col,
- const int& lin, const double& val, const int& band )
-{
- *( ( (unsigned short*)man_manager_.getTilePointer( band, lin ) ) + col ) =
- (unsigned short)val;
-}
-
-
-inline void TeDecoderSmartMem::setElement_TeSHORT(const int& col,
- const int& lin, const double& val, const int& band )
-{
- *( ( (short*)man_manager_.getTilePointer( band, lin ) ) + col ) =
- (short)val;
-}
-
-
-inline void TeDecoderSmartMem::setElement_TeINTEGER(const int& col,
- const int& lin, const double& val, const int& band )
-{
- *( ( (int*)man_manager_.getTilePointer( band, lin ) ) + col ) =
- (int)val;
-}
-
-
-inline void TeDecoderSmartMem::setElement_TeUNSIGNEDLONG(const int& col,
- const int& lin, const double& val, const int& band )
-{
- *( ( (unsigned long*)man_manager_.getTilePointer( band, lin ) ) + col ) =
- (unsigned long)val;
-}
-
-
-inline void TeDecoderSmartMem::setElement_TeLONG(const int& col,
- const int& lin, const double& val, const int& band )
-{
- *( ( (long*)man_manager_.getTilePointer( band, lin ) ) + col ) =
- (long)val;
-}
-
-
-inline void TeDecoderSmartMem::setElement_TeFLOAT(const int& col,
- const int& lin, const double& val, const int& band )
-{
- *( ( (float*)man_manager_.getTilePointer( band, lin ) ) + col ) =
- (float)val;
-}
-
-
-inline void TeDecoderSmartMem::setElement_TeDOUBLE(const int& col,
- const int& lin, const double& val, const int& band )
-{
- *( ( (double*)man_manager_.getTilePointer( band, lin ) ) + col ) = val;
-}
-
-
-inline void TeDecoderSmartMem::getElement_TeUNSIGNEDCHAR( const int& col,
- const int& lin, double& val, const int& band )
-{
- val = (double)( *( ( (unsigned char*)man_manager_.getTilePointer( band,
- lin ) ) + col ) );
-}
-
-
-inline void TeDecoderSmartMem::getElement_TeCHAR(const int& col,
- const int& lin, double& val, const int& band )
-{
- val = (double)( *( ( (char*)man_manager_.getTilePointer( band,
- lin ) ) + col ) );
-}
-
-
-inline void TeDecoderSmartMem::getElement_TeUNSIGNEDSHORT(const int& col,
- const int& lin, double& val, const int& band )
-{
- val = (double)( *( ( (unsigned short*)man_manager_.getTilePointer( band,
- lin ) ) + col ) );
-}
-
-
-inline void TeDecoderSmartMem::getElement_TeSHORT(const int& col,
- const int& lin, double& val, const int& band )
-{
- val = (double)( *( ( (short*)man_manager_.getTilePointer( band,
- lin ) ) + col ) );
-}
-
-
-inline void TeDecoderSmartMem::getElement_TeINTEGER(const int& col,
- const int& lin, double& val, const int& band )
-{
- val = (double)( *( ( (int*)man_manager_.getTilePointer( band,
- lin ) ) + col ) );
-}
-
-
-inline void TeDecoderSmartMem::getElement_TeUNSIGNEDLONG(const int& col,
- const int& lin, double& val, const int& band )
-{
- val = (double)( *( ( (unsigned long*)man_manager_.getTilePointer( band,
- lin ) ) + col ) );
-}
-
-
-inline void TeDecoderSmartMem::getElement_TeLONG(const int& col,
- const int& lin, double& val, const int& band )
-{
- val = (double)( *( ( (long*)man_manager_.getTilePointer( band,
- lin ) ) + col ) );
-}
-
-
-inline void TeDecoderSmartMem::getElement_TeFLOAT(const int& col,
- const int& lin, double& val, const int& band )
-{
- val = (double)( *( ( (float*)man_manager_.getTilePointer( band,
- lin ) ) + col ) );
-}
-
-
-inline void TeDecoderSmartMem::getElement_TeDOUBLE(const int& col,
- const int& lin, double& val, const int& band )
-{
- val = ( *( ( (double*)man_manager_.getTilePointer( band,
- lin ) ) + col ) );
-}
-
diff --git a/src/terralib/kernel/TeDecoderSmartMem.h b/src/terralib/kernel/TeDecoderSmartMem.h
deleted file mode 100644
index f6b993c..0000000
--- a/src/terralib/kernel/TeDecoderSmartMem.h
+++ /dev/null
@@ -1,382 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoderSmartMem.h
- \brief This file deals with decoding of raster structures as a mulitdimensional matrix in memory
-*/
-#ifndef __TERRALIB_INTERNAL_DECODERSMARTMEM_H
-#define __TERRALIB_INTERNAL_DECODERSMARTMEM_H
-
-#include "TeDecoder.h"
-#include "TeRasterMemManager.h"
-#include "TeAgnostic.h"
-
-/**
- * @brief Implements a decoder to a raster stored as a as a mulitdimensional
- * matrix in memory.
- * @note The used memory ( RAM or mapped memory ) will be automatically choosed
- * following the current system resources.
- * @note No interleaving support.
- */
-class TL_DLL TeDecoderSmartMem : public TeDecoder
-{
-
-public:
-
- //! @brief Empty constructor
- TeDecoderSmartMem ();
-
- //! @brief Constructor from parameters
- TeDecoderSmartMem ( const TeRasterParams& par );
-
- //! @brief Destructor
- virtual ~TeDecoderSmartMem ();
-
- //! @brief Sets the value of a specific raster element
- /*!
- \param col element column identifier
- \param lin element line identifier
- \param val element value being inserted
- \param band element band identifier
- */
- inline bool setElement (int col,int lin, double val, int band=0)
- {
- TEAGN_DEBUG_CONDITION( ( setelement_ptrs_vec_ != 0 ),
- "invalid setElement function pointers vector" )
- TEAGN_DEBUG_CONDITION( ( col < params_.ncols_ ),
- "Invalid number of columns" )
- TEAGN_DEBUG_CONDITION( ( lin < params_.nlines_ ),
- "Invalid number of lines" )
- TEAGN_DEBUG_CONDITION( ( band < params_.nBands() ),
- "Invalid band" )
- TEAGN_DEBUG_CONDITION(
- ( params_.status_ != TeRasterParams::TeNotReady),
- "Raster not Ready" );
-
- ( this->*( setelement_ptrs_vec_[ band ] ) )( col, lin, val, band );
-
- return true;
- };
-
- //! @brief Gets an specific element (col, lin, band) of a raster data
- /*!
- \param col element column identifier
- \param lin element line identifier
- \param val element value being retrieved
- \param band element band identifier
- */
- inline bool getElement (int col,int lin, double &val,int band=0)
- {
- TEAGN_DEBUG_CONDITION( ( getelement_ptrs_vec_ != 0 ),
- "invalid getElement function pointers vector" )
- TEAGN_DEBUG_CONDITION( ( col < params_.ncols_ ),
- "Invalid number of columns" )
- TEAGN_DEBUG_CONDITION( ( lin < params_.nlines_ ),
- "Invalid number of lines" )
- TEAGN_DEBUG_CONDITION( ( band < params_.nBands() ),
- "Invalid band" )
- TEAGN_DEBUG_CONDITION(
- ( params_.status_ != TeRasterParams::TeNotReady),
- "Raster not Ready" );
-
- ( this->*( getelement_ptrs_vec_[ band ] ) )( col, lin, val, band );
-
- return true;
- };
-
- //! @brief Initializes the internal structures of the decoder
- virtual void init ();
-
- //! @brief Clears its internal structures
- virtual bool clear ();
-
-protected:
-
- /**
- * @brief Type definition for the getElement function pointer.
- *
- * @param line Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- typedef void (TeDecoderSmartMem::*GetEleFunctPtrT)( const int& col,
- const int& lin, double& val, const int& band );
-
- /**
- * @brief Type definition for the setElement function pointer.
- *
- * @param line Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- typedef void (TeDecoderSmartMem::*SetEleFunctPtrT)( const int& col,
- const int& lin, const double& val, const int& band );
-
- /**
- * @brief Internal memory manager instance.
- */
- TeRasterMemManager man_manager_;
-
- /**
- * @brief A vector of pointers to the current getElement method following the
- * current data bype of each band (indexed by the band index).
- */
- GetEleFunctPtrT* getelement_ptrs_vec_;
-
- /**
- * @brief A vector of pointers to the current setElement method following the
- * current data bype of each band (indexed by the band index).
- */
- SetEleFunctPtrT* setelement_ptrs_vec_;
-
- /**
- * @brief Set all internal variables to their initial values.
- */
- void initVars();
-
- /**
- * @brief Update the function pointers vectors using the current
- * raster parameters.
- */
- void updateFuncPtrVectors();
-
- /**
- * @brief Fill data with dummy values.
- */
- void dummyFill();
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void setElement_TeUNSIGNEDCHAR( const int& col, const int& lin,
- const double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void setElement_TeCHAR( const int& col, const int& lin,
- const double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void setElement_TeUNSIGNEDSHORT( const int& col, const int& lin,
- const double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void setElement_TeSHORT( const int& col, const int& lin,
- const double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void setElement_TeINTEGER( const int& col, const int& lin,
- const double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void setElement_TeUNSIGNEDLONG( const int& col, const int& lin,
- const double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void setElement_TeLONG( const int& col, const int& lin,
- const double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void setElement_TeFLOAT( const int& col, const int& lin,
- const double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void setElement_TeDOUBLE( const int& col, const int& lin,
- const double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void getElement_TeUNSIGNEDCHAR( const int& col, const int& lin,
- double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void getElement_TeCHAR( const int& col, const int& lin,
- double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void getElement_TeUNSIGNEDSHORT( const int& col, const int& lin,
- double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void getElement_TeSHORT( const int& col, const int& lin,
- double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void getElement_TeINTEGER( const int& col, const int& lin,
- double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void getElement_TeUNSIGNEDLONG( const int& col, const int& lin,
- double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void getElement_TeLONG( const int& col, const int& lin,
- double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param line Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void getElement_TeFLOAT( const int& col, const int& lin,
- double& val, const int& band );
-
- /**
- * @brief Method overload.
- *
- * @param lin Line.
- * @param col Column.
- * @param band Band.
- * @param val Pixel value.
- */
- inline void getElement_TeDOUBLE( const int& col, const int& lin,
- double& val, const int& band );
-
-};
-
-//! Implements a factory to build decoder to MEMORY raster
-class TL_DLL TeDecoderSmartMemFactory : public TeDecoderFactory
-{
-public:
-
- //! Factory constructor
- TeDecoderSmartMemFactory(const string& name) : TeDecoderFactory(name) {}
-
- //! Builds the object
- virtual TeDecoder* build (const TeRasterParams& arg)
- { return new TeDecoderSmartMem(arg); }
-};
-#endif
-
diff --git a/src/terralib/kernel/TeDecoderTIFF.cpp b/src/terralib/kernel/TeDecoderTIFF.cpp
deleted file mode 100644
index dd0cc2b..0000000
--- a/src/terralib/kernel/TeDecoderTIFF.cpp
+++ /dev/null
@@ -1,1214 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeDecoderTIFF.h"
-#include "TeUtils.h"
-#include "TeException.h"
-#include <geovalues.h>
-#include <geo_normalize.h>
-#include <geo_tiffp.h>
-
-#include <fstream>
-#include <cassert>
-using std::ifstream;
-using std::ofstream;
-
-// ---- Public Methods -----
-
-TeDecoderTIFF::TeDecoderTIFF(const TeRasterParams& par):
- tif(0),
- gtif(0),
- dataBuffer_(0),
- nplanes_(0),
- isGeoTiff_(false),
- TImage_(0),
- planar_(PLANARCONFIG_CONTIG),
- isTiled_(false),
- tilew_(0),
- tileh_(0),
- tilesacross_(0),
- bytespertile_(0),
- TCurTile_(-1),
- rowsperstrip_(0),
- nstripsperplane_(0),
- stripsize_(0),
- TCurStrip_(-1),
- nBands_(1),
- data_TeUNSIGNEDCHAR_(0),
- data_TeCHAR_(0),
- data_TeUNSIGNEDSHORT_(0),
- data_TeSHORT_(0),
- data_TeINTEGER_(0),
- data_TeUNSIGNEDLONG_(0),
- data_TeLONG_(0),
- data_TeFLOAT_(0),
- data_TeDOUBLE_(0)
-{
- params_ = par;
- params_.status_= TeRasterParams::TeNotReady;
- if (params_.mode_ == 'r') // file should exists
- { // read tiff/geotiff parameters
- tif=XTIFFOpen(params_.fileName_.c_str(),"r");
- if (!tif)
- return;
-
- gtif = (GTIF*)GTIFNew(tif);
- readTiffDirectory();
- if (gtif)
- {
- GTIFFree(gtif);
- gtif = 0;
- }
- if (tif)
- {
- XTIFFClose(tif);
- tif = 0;
- }
- params_.decoderIdentifier_ = "TIF";
- }
-}
-
-void
-TeDecoderTIFF::init()
-{
- clear(); // reset existent internal structures
- params_.status_= TeRasterParams::TeNotReady;
-
- // TIFF image files may not be opened for both reading and writing;
- // there is no support for altering the contents of a TIFF file. So
- // mode == 'w' never initializes this decoder.
- if (params_.mode_ == 'w')
- {
- params_.errorMessage_ = "There is no support for altering the contents of a TIFF file.";
- return;
- }
- if (params_.mode_ != 'r' && params_.mode_ != 'c') // unknown mode
- {
- params_.errorMessage_ = "Invalid access mode.";
- return;
- }
-
- // check the initial permissions on the file
- if (params_.mode_ == 'c') // creating a new raster file
- {
- ofstream dataFile(params_.fileName_.c_str()); // try to (re)create the file
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to (re)create the raster the file:" + params_.fileName_;
- return;
- }
- dataFile.close();
- memManager_.updateParams(params_);
- memManager_.params().decoderIdentifier_ = "SMARTMEM";
- memManager_.params().mode_ = 'c';
- memManager_.init();
- if (memManager_.params().status_ != TeRasterParams::TeReadyToWrite)
- {
- params_.errorMessage_ = "Fail to create the raster the file:" + params_.fileName_;
- return;
- }
- else
- params_.status_ = TeRasterParams::TeReadyToWrite;
-
- tif=XTIFFOpen(params_.fileName_.c_str(),"a");
- if (!tif)
- {
- params_.errorMessage_ = "Fail to create a tiff file.";
- params_.status_= TeRasterParams::TeNotReady;
- return;
- }
-
- // try to create a geotiff instance on the tiff file
- gtif = (GTIF*)GTIFNew(tif);
- if (!gtif)
- {
- params_.errorMessage_ = "Fail to instantiate a geotiff file.";
- params_.status_= TeRasterParams::TeNotReady;
- return;
- }
- return;
- }
-
- ifstream dataFile(params_.fileName_.c_str()); // check if file exists
- if (!dataFile)
- {
- params_.errorMessage_ = "Fail to open the raster the file:" + params_.fileName_;
- return;
- }
- dataFile.close();
- // try to open the tiff file with the desired mode
- tif=XTIFFOpen(params_.fileName_.c_str(),"r");
- if (!tif)
- {
- params_.errorMessage_ = "Fail to instantiate a tiff file.";
- return;
- }
-
- isTiled_ = TIFFIsTiled(tif) != 0; // return non-zero if is organized in tiles
- TIFFGetField(tif,TIFFTAG_PLANARCONFIG,&planar_); // storage organization
- if (isTiled_ && (planar_== PLANARCONFIG_SEPARATE))
- {
- XTIFFClose(tif);
- tif = 0;
- params_.errorMessage_ = "There is no support to decode tiff files that are tiled and organized in separate planes.";
- return;
- }
-
- // try to create a geotiff instance on the tiff file
- gtif = (GTIF*)GTIFNew(tif);
- if (!gtif)
- {
- XTIFFClose(tif);
- tif = 0;
- params_.errorMessage_ = "Fail to instantiate a geotiff file.";
- return;
- }
- readTiffDirectory(); // read tiff keys
- getGeoTIFF(); // read geotiff keys
- params_.errorMessage_.clear();
- if (allocateWorkMemory())
- params_.status_ = TeRasterParams::TeReadyToRead;
- else
- {
- XTIFFClose(tif);
- tif = 0;
- GTIFFree(gtif);
- gtif = 0;
- params_.errorMessage_ = "Fail to allocate necessary work memory.";
- }
-}
-
-
-bool
-TeDecoderTIFF::clear()
-{
- if (!tif || !gtif)
- return true;
-
- TeRasterParams& mmpars = memManager_.params();
-
- if (mmpars.mode_== 'c')
- {
- setGeoKeys();
- int row, col, b;
- double val=0.0;
- int nb = mmpars.nBands();
- long ssize = TIFFScanlineSize(tif);
- unsigned char* obuf = (unsigned char*)_TIFFmalloc(ssize);
-
- for (row=0; row<mmpars.nlines_; ++row)
- {
- for (col=0; col<mmpars.ncols_; ++col)
- {
- for (b=0; b<nb; ++b)
- {
- if (!memManager_.getElement(col,row,val,b))
- continue;
-
- if (mmpars.dataType_[0] == TeDOUBLE)
- {
- ((double*)obuf)[col*nb+b] = (double)val;
- }
- else if (mmpars.dataType_[0] == TeFLOAT)
- {
- ((float*)obuf)[col*nb+b] = (float)val;
- }
- else if (mmpars.dataType_[0] == TeLONG)
- {
- ((long*)obuf)[col*nb+b] = (long)val;
- }
- else if (mmpars.dataType_[0] == TeUNSIGNEDLONG)
- {
- ((unsigned long*)obuf)[col*nb+b] = (unsigned long)val;
- }
- else if (mmpars.dataType_[0] == TeINTEGER)
- {
- ((int*)obuf)[col*nb+b] = (int)val;
- }
- else if (mmpars.dataType_[0] == TeUNSIGNEDSHORT)
- {
- ((unsigned short*)obuf)[col*nb+b] = (unsigned short)val;
- }
- else if (mmpars.dataType_[0] == TeSHORT)
- {
- ((short*)obuf)[col*nb+b] = (short)val;
- }
- else if (mmpars.dataType_[0] == TeCHAR)
- {
- obuf[col*nb+b] = (char)val;
- }
- else
- {
- obuf[col*nb+b] = (unsigned char)val;
- }
-
- }
- }
- if (!TIFFWriteScanline(tif, obuf, row, 0))
- {
- TIFFFlushData(tif);
- _TIFFfree(obuf);
- return false;
- }
- }
- TIFFFlushData(tif);
- _TIFFfree(obuf);
- }
-
- if (dataBuffer_)
- {
- for (unsigned int p=0; p<nplanes_; ++p)
- delete []dataBuffer_[p];
- delete []dataBuffer_;
- }
- dataBuffer_ = 0;
-
- if (gtif)
- GTIFFree(gtif);
- gtif = 0;
-
- if (tif)
- XTIFFClose(tif);
- tif = 0;
-
- memManager_.clear();
- params_.status_ = TeRasterParams::TeNotReady;
- params_.errorMessage_.clear();
- return true;
-}
-
-TeDecoderTIFF::~TeDecoderTIFF()
-{
- clear();
-}
-
-bool
-TeDecoderTIFF::setElement(int col, int lin, double val, int band)
-{
- return memManager_.setElement(col,lin,val,band);
-}
-
-
-bool
-TeDecoderTIFF::getElement(int col,int lin, double &val,int band)
-{
- unsigned int pos;
- unsigned long plane;
- if (isTiled_) // tiled organization
- {
- if (TCurTile_ != (long)(lin/tileh_))
- {
- if (!readTileImageContig(lin/tileh_))
- return false;
- else
- TCurTile_ = (long)(lin/tileh_);
- }
- plane = (col/tilew_);
- lin = lin - TCurTile_*tileh_;
- col = col - (int)(col/tilew_)*tilew_;
- pos = lin*tilew_*nBands_+col*nBands_+band;
- }
- else // striped organization
- {
- if (TCurStrip_ != (long)(lin/rowsperstrip_))
- {
- if (!readStrip(lin/rowsperstrip_)) // strip is not in memory
- return false;
- else
- TCurStrip_ = (long)(lin/rowsperstrip_);
- }
- lin = lin-(TCurStrip_*rowsperstrip_);
- plane = 0;
- if (planar_ == PLANARCONFIG_CONTIG)
- {
- pos = lin*params_.ncols_*nBands_+col*nBands_+band;
- }
- else
- {
- pos = lin*params_.ncols_+col;
- plane = band;
- }
- }
- (this->*( getelement_ptr_))(plane,pos,val);
- return true;
-}
-
-
-// --- Internal Methods ---
-void
-TeDecoderTIFF::readTiffDirectory()
-{
- int ncols=0, nlins = 0;
- TIFFGetField(tif,TIFFTAG_IMAGEWIDTH,&ncols);
- TIFFGetField(tif,TIFFTAG_IMAGELENGTH,&nlins);
- params_.ncols_ = ncols;
- params_.nlines_ = nlins;
-
- short samplesperPixel;
- if (!TIFFGetField(tif,TIFFTAG_SAMPLESPERPIXEL,&samplesperPixel) )
- params_.nBands(1);
- else
- params_.nBands(samplesperPixel);
- nBands_ = params_.nBands();
-
- unsigned long nbitsperpixel_ = 0;
- if( !TIFFGetField(tif,TIFFTAG_BITSPERSAMPLE,&nbitsperpixel_) )
- {
- nbitsperpixel_ = 1;
- params_.setDataType(TeBIT);
- }
- else
- {
- short sampleformat;
- if (!TIFFGetField(tif,TIFFTAG_SAMPLEFORMAT,&sampleformat))
- sampleformat = 0;
-
- TeDataType tifType;
- if (nbitsperpixel_ == 8)
- {
- if (sampleformat == SAMPLEFORMAT_INT)
- tifType = TeCHAR;
- else
- tifType = TeUNSIGNEDCHAR;
- }
- else if (nbitsperpixel_ == 16)
- {
- if (sampleformat == SAMPLEFORMAT_INT)
- tifType = TeSHORT;
- else
- tifType = TeUNSIGNEDSHORT;
- }
- else if (nbitsperpixel_ == 32)
- {
- if (sampleformat == SAMPLEFORMAT_INT)
- tifType = TeLONG;
- else if (sampleformat == SAMPLEFORMAT_UINT)
- tifType = TeUNSIGNEDLONG;
- else
- tifType = TeFLOAT;
- }
- else
- tifType = TeDOUBLE;
- params_.setDataType(tifType);
- }
- unsigned short photom_; // photometric interpretation
- TIFFGetField(tif,TIFFTAG_PHOTOMETRIC,&photom_); // photometric interpretation
- if (samplesperPixel == 3 &&
- (photom_ == PHOTOMETRIC_MINISWHITE ||
- photom_ == PHOTOMETRIC_MINISBLACK))
- photom_ = PHOTOMETRIC_RGB;
-
- switch (photom_)
- {
- case PHOTOMETRIC_PALETTE:
- params_.setPhotometric(TeRasterParams::TePallete);
- TImage_ = 2;
- readLut();
- break;
- case PHOTOMETRIC_RGB:
- params_.setPhotometric(TeRasterParams::TeRGB);
- TImage_ = 1;
- break;
- default:
- params_.setPhotometric(TeRasterParams::TeMultiBand);
- TImage_ = 0;
- }
- TIFFGetField(tif,TIFFTAG_PLANARCONFIG,&planar_); // storage organization
- isTiled_ = TIFFIsTiled(tif) != 0; // return non-zero if is organized in tiles
- if (isTiled_)
- {
- TIFFGetField(tif,TIFFTAG_TILEWIDTH,&tilew_);
- TIFFGetField(tif,TIFFTAG_TILELENGTH,&tileh_);
- bytespertile_ = TIFFTileSize(tif);
- tilesacross_ = (params_.ncols_ + tilew_ - 1) / tilew_;
- params_.blockWidth_ = tilew_;
- params_.blockWidth_ = tileh_;
- }
- else
- {
- TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip_);
- nstripsperplane_ = TIFFNumberOfStrips(tif)/nBands_;
- stripsize_ = TIFFStripSize(tif);
- }
-
- unsigned short compress_; // photometric interpretation
- TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress_);
- if (compress_ != COMPRESSION_NONE)
- params_.setCompressionMode(TeRasterParams::TeTiffCompression);
-
- double *minmaxvalues = 0;
- int count=0;
- unsigned int b;
- if (TIFFGetField(tif, TIFFTAG_MAXSAMPLEVALUE, &count, &minmaxvalues)==1)
- {
- for (b=0; b<nBands_; ++b)
- params_.vmax_[b]=minmaxvalues[b];
- }
-
- if (TIFFGetField(tif, TIFFTAG_MINSAMPLEVALUE, &count, &minmaxvalues)==1)
- {
- for (b=0; b<nBands_; ++b)
- params_.vmin_[b]=minmaxvalues[b];
- }
-
- // Read georeference parameters
- getGeoTIFF();
- if (!params_.box().isValid())
- params_.lowerLeftResolutionSize(0.5,0.5,1,1,params_.ncols_,params_.nlines_);
-}
-
-bool
-TeDecoderTIFF::allocateWorkMemory()
-{
- if (dataBuffer_ && nplanes_>0) // release previously used buffer
- {
- for (unsigned int p=0; p<nplanes_; ++p)
- delete []dataBuffer_[p];
- delete []dataBuffer_;
- }
- dataBuffer_ = 0;
- unsigned long buffersize;
- if (isTiled_)
- {
- nplanes_ = tilesacross_;
- buffersize = bytespertile_;
- }
- else
- {
- if (planar_ == PLANARCONFIG_SEPARATE)
- nplanes_ = nBands_;
- else
- nplanes_ = 1;
- buffersize = stripsize_;
- }
-
- dataBuffer_ = new unsigned char*[nplanes_];
- unsigned int i;
- for (i=0; i<nplanes_; ++i)
- {
- dataBuffer_[i] = new unsigned char [buffersize];
- if (!dataBuffer_[i])
- {
- for (unsigned int j=0; j<i; ++j)
- delete []dataBuffer_[j];
- delete []dataBuffer_;
- dataBuffer_=0;
- return false;
- }
- }
- data_TeUNSIGNEDCHAR_ = (unsigned char**)dataBuffer_;
- data_TeCHAR_ = (char**)dataBuffer_;
- data_TeUNSIGNEDSHORT_ = (unsigned short**)dataBuffer_;
- data_TeSHORT_ = (short**)dataBuffer_;
- data_TeINTEGER_ = (int**)dataBuffer_;
- data_TeUNSIGNEDLONG_ = (unsigned long**)dataBuffer_;
- data_TeLONG_ = (long**)dataBuffer_;
- data_TeFLOAT_ = (float**)dataBuffer_;
- data_TeDOUBLE_ = (double**)dataBuffer_;
-
- switch ( params_.dataType_[0] )
- {
- case (TeUNSIGNEDCHAR):
- getelement_ptr_ = &TeDecoderTIFF::getElement_TeUNSIGNEDCHAR;
- break;
- case (TeCHAR) :
- getelement_ptr_ = &TeDecoderTIFF::getElement_TeCHAR;
- break;
- case (TeUNSIGNEDSHORT):
- getelement_ptr_ = &TeDecoderTIFF::getElement_TeUNSIGNEDSHORT;
- break;
- case (TeSHORT):
- getelement_ptr_ = &TeDecoderTIFF::getElement_TeSHORT;
- break;
- case (TeINTEGER):
- getelement_ptr_ = &TeDecoderTIFF::getElement_TeINTEGER;
- break;
- case (TeUNSIGNEDLONG):
- getelement_ptr_ = &TeDecoderTIFF::getElement_TeUNSIGNEDLONG;
- break;
- case (TeLONG):
- getelement_ptr_ = &TeDecoderTIFF::getElement_TeLONG;
- break;
- case (TeFLOAT):
- getelement_ptr_ = &TeDecoderTIFF::getElement_TeFLOAT;
- break;
- case (TeDOUBLE):
- getelement_ptr_ = &TeDecoderTIFF::getElement_TeDOUBLE;
- break;
- default:
- throw TeException( UNKNOWN_ERROR_TYPE, "Invalid raster data type", false );
- }
- return true;
-}
-void
-TeDecoderTIFF::setGeoKeys()
-{
- TeRasterParams& mmparams = memManager_.params();
-
-// Image Size
- TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, mmparams.ncols_);
- TIFFSetField(tif, TIFFTAG_IMAGELENGTH, mmparams.nlines_);
-
-// Orientation
- TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
-
-// Number of bits
- int nb = mmparams.nbitsperPixel_[0];
- TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, nb);
- switch (mmparams.dataType_[0])
- {
- case TeUNSIGNEDCHAR:
- case TeUNSIGNEDSHORT:
- case TeUNSIGNEDLONG:
- TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
- break;
- case TeCHAR:
- case TeSHORT:
- case TeINTEGER:
- case TeLONG:
- TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
- break;
- case TeFLOAT:
- case TeDOUBLE:
- TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
- break;
- default:
- TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_VOID);
- break;
- }
-// Number of bands
- TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, mmparams.nBands() );
-
-// Compression
- TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
-
-// Planar configuration
- TIFFSetField(tif,TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
-
-// Photometric type
- if (mmparams.nBands() == 1) // monobands
- {
- if (mmparams.photometric_[0] == TeRasterParams::TePallete)
- {
- TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
- saveLut();
- TImage_ = 2;
- }
- else
- {
- TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
- TImage_ = 0;
- }
- }
- else if (mmparams.nBands() == 3)
- {
- if ( mmparams.photometric_[0] == TeRasterParams::TeRGB )
- {
- TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
- TImage_ = 1;
- }
- else
- {
- TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
- TImage_ = 0;
- }
- }
- else
- {
- TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
- TImage_ = 0;
- }
- TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
-
- if (mmparams.dxI_ != 0. || mmparams.dyJ_ != 0.) // there is a rotation defined
- {
- // It seems that most viewers are not able to deal with GTIFF_TRANSMATRIX...
- // ... so let's write a navigation file instead...
- string tfw = TeGetName(mmparams.fileName_.c_str())+".tfw";
- FILE* fp = fopen(tfw.c_str(),"w");
- if (fp)
- {
- fprintf(fp,"%.6f\n",mmparams.dxJ_);
- fprintf(fp,"%.6f\n",mmparams.dyI_);
- fprintf(fp,"%.6f\n",mmparams.dxI_);
- fprintf(fp,"%.6f\n",mmparams.dyJ_);
- fprintf(fp,"%.6f\n",mmparams.x0_);
- fprintf(fp,"%.6f\n",mmparams.y0_);
-
- fclose( fp );
- }
- }
- else // tf there is no rotation use one tie point and pixel scale
- {
- double tiepoint[6];
- tiepoint[0] = 0;
- tiepoint[1] = 0;
- tiepoint[2] = 0;
- tiepoint[3] = mmparams.boundingBox().x1_;
- tiepoint[4] = mmparams.boundingBox().y2_;
- tiepoint[5] = 0;
- TIFFSetField(tif, GTIFF_TIEPOINTS, 6,&tiepoint);
-
- double resolution[3];
- resolution[0] = mmparams.resx_;
- resolution[1] = mmparams.resy_;
- resolution[2] = 0;
- TIFFSetField(tif, GTIFF_PIXELSCALE, 3,&resolution);
- }
-
- // projection parameters
- if (!mmparams.projection() || mmparams.projection()->name() == "NoProjection")
- {
- // at least try to write a tfw file
- string tfw = TeGetName(mmparams.fileName_.c_str())+".tfw";
- FILE* fp = fopen(tfw.c_str(),"w");
- if (fp)
- {
- vector<double> tfw;
- mmparams.getNavigationParameters(tfw);
- for (unsigned int nl=0; nl<6; ++nl)
- fprintf(fp,"%8.4f\n",tfw[nl]);
-
- fclose( fp );
- }
- return;
- }
- GTIFKeySet(gtif, GTRasterTypeGeoKey, TYPE_SHORT, 1, RasterPixelIsArea);
- const TeProjectionParams& paramas = mmparams.projection()->params();
- const string& projname = mmparams.projection()->name();
- if (projname == "LatLong")
- {
- GTIFKeySet(gtif, GTModelTypeGeoKey, TYPE_SHORT, 1, ModelTypeGeographic);
- GTIFKeySet(gtif, GeogAngularUnitsGeoKey, TYPE_SHORT, 1, Angular_Degree);
- }
- else
- {
- GTIFKeySet(gtif, GTModelTypeGeoKey, TYPE_SHORT, 1, ModelTypeProjected);
- GTIFKeySet(gtif, ProjLinearUnitsGeoKey, TYPE_SHORT, 1,Linear_Meter);
- if (projname == "UTM")
- {
- GTIFKeySet(gtif, ProjCoordTransGeoKey, TYPE_SHORT, 1, CT_TransverseMercator);
- GTIFKeySet(gtif, ProjNatOriginLatGeoKey, TYPE_DOUBLE,1,paramas.lat0*TeCRD);
- GTIFKeySet(gtif, ProjNatOriginLongGeoKey, TYPE_DOUBLE,1,paramas.lon0*TeCRD);
- GTIFKeySet(gtif, ProjScaleAtNatOriginGeoKey, TYPE_DOUBLE,1,paramas.scale);
- GTIFKeySet(gtif, ProjFalseEastingGeoKey, TYPE_DOUBLE,1,paramas.offx);
- GTIFKeySet(gtif, ProjFalseNorthingGeoKey, TYPE_DOUBLE,1,paramas.offy);
- }
- else if (projname == "Mercator")
- {
- GTIFKeySet(gtif, ProjCoordTransGeoKey, TYPE_SHORT, 1, CT_Mercator);
- GTIFKeySet(gtif, ProjNatOriginLongGeoKey, TYPE_DOUBLE,1,paramas.lon0*TeCRD);
- GTIFKeySet(gtif, ProjNatOriginLatGeoKey, TYPE_DOUBLE,1,paramas.stlat1*TeCRD);
- GTIFKeySet(gtif, ProjScaleAtNatOriginGeoKey, TYPE_DOUBLE,1,paramas.scale);
- GTIFKeySet(gtif, ProjFalseEastingGeoKey, TYPE_DOUBLE,1,paramas.offx);
- GTIFKeySet(gtif, ProjFalseNorthingGeoKey, TYPE_DOUBLE,1,paramas.offy);
- }
- else if (projname == "LambertConformal")
- {
- GTIFKeySet(gtif, ProjCoordTransGeoKey, TYPE_SHORT, 1, CT_LambertConfConic_2SP);
- GTIFKeySet(gtif, ProjFalseOriginLatGeoKey,TYPE_DOUBLE, 1, paramas.lat0*TeCRD);
- GTIFKeySet(gtif, ProjFalseOriginLongGeoKey, TYPE_DOUBLE, 1, paramas.lon0*TeCRD);
- GTIFKeySet(gtif, ProjStdParallel1GeoKey, TYPE_DOUBLE, 1, paramas.stlat1*TeCRD);
- GTIFKeySet(gtif, ProjStdParallel2GeoKey, TYPE_DOUBLE, 1, paramas.stlat2*TeCRD);
- GTIFKeySet(gtif, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,paramas.offx);
- GTIFKeySet(gtif, ProjFalseNorthingGeoKey,TYPE_DOUBLE, 1,paramas.offy);
- }
- else if (projname == "Polyconic")
- {
- GTIFKeySet(gtif, ProjCoordTransGeoKey, TYPE_SHORT, 1, CT_Polyconic);
- GTIFKeySet(gtif, ProjNatOriginLatGeoKey,TYPE_DOUBLE, 1, paramas.lat0*TeCRD);
- GTIFKeySet(gtif, ProjNatOriginLongGeoKey, TYPE_DOUBLE, 1, paramas.lon0*TeCRD);
- GTIFKeySet(gtif, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,paramas.offx);
- GTIFKeySet(gtif, ProjFalseNorthingGeoKey,TYPE_DOUBLE, 1,paramas.offy);
- GTIFKeySet(gtif, ProjScaleAtNatOriginGeoKey, TYPE_DOUBLE,1,paramas.scale);
- }
- else if (projname == "CylindricalEquidistant")
- {
- GTIFKeySet(gtif, ProjCoordTransGeoKey, TYPE_SHORT, 1, CT_Equirectangular);
- GTIFKeySet(gtif, ProjCenterLatGeoKey,TYPE_DOUBLE, 1, paramas.stlat1*TeCRD);
- GTIFKeySet(gtif, ProjCenterLongGeoKey, TYPE_DOUBLE, 1, paramas.lon0*TeCRD);
- GTIFKeySet(gtif, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,paramas.offx);
- GTIFKeySet(gtif, ProjFalseNorthingGeoKey,TYPE_DOUBLE, 1,paramas.offy);
- }
- else if (projname == "PolarStereographic")
- {
- GTIFKeySet(gtif, ProjCoordTransGeoKey, TYPE_SHORT, 1, CT_PolarStereographic);
- GTIFKeySet(gtif, ProjNatOriginLatGeoKey, TYPE_DOUBLE,1,paramas.lat0*TeCRD);
- GTIFKeySet(gtif, ProjStraightVertPoleLongGeoKey, TYPE_DOUBLE,1,paramas.lon0*TeCRD);
- GTIFKeySet(gtif, ProjScaleAtNatOriginGeoKey, TYPE_DOUBLE,1,paramas.scale);
- GTIFKeySet(gtif, ProjFalseEastingGeoKey, TYPE_DOUBLE,1,paramas.offx);
- GTIFKeySet(gtif, ProjFalseNorthingGeoKey, TYPE_DOUBLE,1,paramas.offy);
- }
- else if (projname == "Albers")
- {
- GTIFKeySet(gtif, ProjCoordTransGeoKey, TYPE_SHORT, 1, CT_AlbersEqualArea);
- GTIFKeySet(gtif, ProjStdParallel1GeoKey, TYPE_DOUBLE, 1, paramas.stlat1*TeCRD);
- GTIFKeySet(gtif, ProjStdParallel2GeoKey, TYPE_DOUBLE, 1, paramas.stlat2*TeCRD);
- GTIFKeySet(gtif, ProjNatOriginLatGeoKey,TYPE_DOUBLE, 1, paramas.lat0*TeCRD);
- GTIFKeySet(gtif, ProjNatOriginLongGeoKey, TYPE_DOUBLE, 1, paramas.lon0*TeCRD);
- GTIFKeySet(gtif, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,paramas.offx);
- GTIFKeySet(gtif, ProjFalseNorthingGeoKey,TYPE_DOUBLE, 1,paramas.offy);
- }
- else if (projname == "Miller")
- {
- GTIFKeySet(gtif, ProjCoordTransGeoKey, TYPE_SHORT, 1, CT_MillerCylindrical);
- GTIFKeySet(gtif, ProjCenterLatGeoKey, TYPE_DOUBLE, 1, paramas.lat0*TeCRD);
- GTIFKeySet(gtif, ProjCenterLongGeoKey, TYPE_DOUBLE, 1, paramas.lon0*TeCRD);
- GTIFKeySet(gtif, ProjFalseEastingGeoKey, TYPE_DOUBLE, 1,paramas.offx);
- GTIFKeySet(gtif, ProjFalseNorthingGeoKey,TYPE_DOUBLE, 1,paramas.offy);
- }
- }
-
- // datum parameters
- if (paramas.datum.name() == "CorregoAlegre")
- GTIFKeySet(gtif, GeogGeodeticDatumGeoKey, TYPE_SHORT, 1,Datum_Corrego_Alegre);
- else if (paramas.datum.name() == "WGS84")
- GTIFKeySet(gtif, GeogGeodeticDatumGeoKey, TYPE_SHORT, 1,Datum_WGS84);
- else if (paramas.datum.name() == "SAD69")
- GTIFKeySet(gtif, GeogGeodeticDatumGeoKey, TYPE_SHORT, 1,Datum_South_American_Datum_1969);
- else if (paramas.datum.name() == "Aratu")
- GTIFKeySet(gtif, GeogGeodeticDatumGeoKey, TYPE_SHORT, 1,Datum_Aratu);
- else
- GTIFKeySet(gtif, GeogGeodeticDatumGeoKey, TYPE_SHORT, 1,32767);
-
- GTIFKeySet(gtif, GeogCitationGeoKey, TYPE_ASCII,1,paramas.datum.name().c_str());
- GTIFKeySet(gtif, GeogSemiMajorAxisGeoKey,TYPE_DOUBLE, 1, paramas.datum.radius());
- GTIFKeySet(gtif, GeogSemiMinorAxisGeoKey,TYPE_DOUBLE, 1, paramas.datum.radius()*(1-paramas.datum.flattening()));
- GTIFWriteKeys(gtif);
-}
-
-bool
-TeDecoderTIFF::getGeoTIFF()
-{
- params_.resx_ = params_.resy_ = 1;
-
- //---------------- navigation parameters
-
- bool isGeoreferenced_ = false;
- // The three tags defined below may be used for defining the relationship between R (raster space)
- // and M (model space), and the relationship may be diagrammed as:
- // ModelPixelScaleTag
- // ModelTiepointTag
- // R ------------ OR --------------> M
- // (I,J,K) ModelTransformationTag (X,Y,Z)
-
- double *tiepoints = 0;
- double *pixel_scale = 0;
- double *transform = 0;
-
- int count=0, tiepoint_count=0, transform_count=0;
- TIFFGetField(tif, GTIFF_TIEPOINTS, &tiepoint_count,&tiepoints);
- TIFFGetField(tif, GTIFF_PIXELSCALE, &count, &pixel_scale);
- TIFFGetField(tif, GTIFF_TRANSMATRIX, &transform_count, &transform);
-
- GTIFDefn defn;
- int hasGTifDefn;
- hasGTifDefn = GTIFGetDefn(gtif, &defn);
- bool isCentreOfPixel = false;
- if (hasGTifDefn)
- {
- short mtype;
- GTIFKeyGet(gtif,GTRasterTypeGeoKey,&mtype,0,1);
- if (mtype == RasterPixelIsPoint)
- isCentreOfPixel = true;
- }
-
- if (count >= 3 && tiepoint_count >= 6) // if we have 1 tie point and pixel scale
- {
- params_.topLeftResolutionSize(tiepoints[3]-tiepoints[0]*pixel_scale[0],
- tiepoints[4]-tiepoints[1]*pixel_scale[1],
- pixel_scale[0],pixel_scale[1],
- params_.ncols_,params_.nlines_,isCentreOfPixel);
- isGeoreferenced_ = true;
- }
- else if (transform_count == 16) // if we have a transformation matrix
- {
- vector<double> wf;
- wf.push_back(transform[0]);
- wf.push_back(transform[1]);
- wf.push_back(transform[4]);
- wf.push_back(transform[5]);
- wf.push_back(transform[3]);
- wf.push_back(transform[7]);
- params_.setNavigationParameters(wf);
- isGeoreferenced_ = true;
-
- }
- // else if (tiepoint_count > 6)
- // {
- // we should use the set of tiepoints to interpolate... not implemented yet...
- // }
-
-
- // if we couldn't get the georrefencing information from the tags
- // try to get if from an external (.tfw) world file
- if (!isGeoreferenced_)
- {
- size_t dotpos = params_.fileName_.rfind('.');
- if (dotpos != std::string::npos)
- {
- vector<double> wf;
- wf.resize(6);
- string tfwfile = params_.fileName_.substr(0,dotpos+1) + "tfw";
- FILE* fp = fopen(tfwfile.c_str(),"r");
- if (!fp)
- {
- tfwfile = params_.fileName_.substr(0,dotpos+1) + "TFW";
- fp = fopen(tfwfile.c_str(),"r");
- }
-
- if (fp)
- {
- isGeoreferenced_ = true;
- char val[40];
- for (int ii=0; ii<6; ++ii)
- {
- if (fscanf(fp,"%s",val))
- wf[ii] = TeRoundD(atof(val));
- else
- {
- isGeoreferenced_ = false;
- break;
- }
- }
- fclose(fp);
- }
- if (isGeoreferenced_)
- params_.setNavigationParameters(wf);
- }
- }
-
- //---------------- projection parameters
- if (!hasGTifDefn)
- {
- if (!params_.projection())
- {
- TeProjection* noproj = new TeNoProjection();
- params_.projection(noproj);
- delete noproj;
- }
- return false;
- }
- else
- {
- // 1) Get Datum parameters
- TeDatum mDatum;
- if (defn.Datum == Datum_South_American_Datum_1969)
- mDatum = TeDatumFactory::make("SAD69");
- else if (defn.Datum == Datum_WGS84)
- mDatum = TeDatumFactory::make("WGS84");
- else if (defn.Datum == Datum_Corrego_Alegre)
- mDatum = TeDatumFactory::make("CorregoAlegre");
- else if (defn.Datum == Datum_Aratu)
- mDatum = TeDatumFactory::make("Aratu");
- else
- {
- if(params_.projection())
- mDatum = params_.projection()->datum();
- else
- {
- double TISemiMajor = defn.SemiMajor, TISemiMinor = defn.SemiMinor;
- // unknown datum... try to find a similar one based on SemiAxis values
- if (defn.SemiMajor == 0. && defn.SemiMinor == 0.)
- {
- TISemiMajor =6.371000e+06; // default parameter of a spherical ellipsoid
- TISemiMinor =6.371000e+06;
- }
- if (!findDatum(TISemiMajor,(TISemiMajor - TISemiMinor)/TISemiMajor,mDatum))
- mDatum = TeDatum("UserDefined",TISemiMajor,(TISemiMajor - TISemiMinor)/TISemiMajor,0.,0.,0.);
- }
- }
-
- // 2) Get projection parameters
- // if geographical model
- short mtype;
- GTIFKeyGet(gtif, GTModelTypeGeoKey,&mtype, 0, 1 );
- if (mtype == ModelTypeGeographic)
- {
- TeProjection* latlong = new TeLatLong(mDatum);
- params_.projection(latlong);
- delete latlong;
- return true;
- }
-
- if (mtype != ModelTypeProjected)
- {
- if (!params_.projection())
- {
- TeProjection* noproj = new TeNoProjection();
- params_.projection(noproj);
- delete noproj;
- return false;
- }
- return true;
- }
- TeProjectionParams mProjPars;
- mProjPars.units = "Meters"; // == not necessarily true... we should check for the units as defined in geotiff
- mProjPars.datum = mDatum;
-
- // just set all parameters available from defn... some of them will not be used by some projections
- mProjPars.lat0 = defn.ProjParm[0]*defn.UOMAngleInDegrees*TeCDR;
- mProjPars.lon0 = defn.ProjParm[1]*defn.UOMAngleInDegrees*TeCDR;
- mProjPars.stlat1 = defn.ProjParm[2]*defn.UOMAngleInDegrees*TeCDR;
- mProjPars.stlat2 = defn.ProjParm[3]*defn.UOMAngleInDegrees*TeCDR;
- mProjPars.scale = defn.ProjParm[4];
- mProjPars.offx = defn.ProjParm[5];
- mProjPars.offy = defn.ProjParm[6];
- if (mProjPars.offy > 0)
- mProjPars.hemisphere = TeSOUTH_HEM;
- else
- mProjPars.hemisphere = TeNORTH_HEM;
-
- // now make the correspondence between geotiff projections and terralib projections
- switch (defn.CTProjection)
- {
- case CT_TransverseMercator :
- mProjPars.name = "UTM";
- break;
- case CT_Mercator :
- mProjPars.name = "Mercator";
- break;
- case CT_LambertConfConic_2SP :
- mProjPars.name = "LambertConformal";
- break;
- case CT_Polyconic :
- mProjPars.name = "Polyconic";
- break;
- case CT_Equirectangular :
- mProjPars.name = "CylindricalEquidistant";
- break;
- case CT_PolarStereographic :
- mProjPars.name = "PolarStereographic";
- break;
- case CT_AlbersEqualArea :
- mProjPars.name = "Albers";
- break;
- case CT_MillerCylindrical:
- mProjPars.name = "Miller";
- break;
- case CT_Sinusoidal:
- mProjPars.name = "TeSinusoidal";
- break;
- default:
- TeBox bb = params_.boundingBox();
- if (bb.x1_ >= -180 && bb.x1_ <= 180 && bb.y1_ >= -90 && bb.y2_ <= 90)
- mProjPars.name = "LatLong";
- else
- {
- TeProjection* noproj = TeProjectionFactory::make(mProjPars);
- params_.projection(noproj);
- delete noproj;
- return false;
- }
- break;
- }
- TeProjection* proj = TeProjectionFactory::make(mProjPars);
- params_.projection(proj);
- delete proj;
- return true;
- }
-}
-
-bool
-TeDecoderTIFF::readStrip(unsigned long strip)
-{
- assert(tif);
- if (planar_ == PLANARCONFIG_CONTIG) // for planar config all planes are in the strip
- return (TIFFReadEncodedStrip(tif, strip, dataBuffer_[0], -1) > 0);
-
- for (unsigned int i=0; i<nBands_; ++i) // for separated config we have to read each plane individually
- {
- if (TIFFReadEncodedStrip(tif, (strip+i*nstripsperplane_), dataBuffer_[i],-1) == -1)
- return false;
- }
- return true;
-}
-
-bool
-TeDecoderTIFF::readTileImageContig(unsigned long tiler)
-{
- tiler *= tilesacross_;
- unsigned long i;
- for (i=0; i<tilesacross_; ++i)
- {
- if (TIFFReadEncodedTile(tif,tiler+i,dataBuffer_[i],-1) == -1)
- return false;
- }
- return true;
-}
-
-// --- To read and set a LUT table ---
-
-static int checkmap(int n, unsigned short *r, unsigned short *g, unsigned short *b,long val)
-{
- while (n-- >= 0)
- if (*r++ > val || *g++ > val || *b++ > val)
- return (16);
- return (8);
-}
-
-static unsigned short CVT1 (unsigned long x,long value) //CVT is used in DEC station
-{
- unsigned long den = (1L << 16) -1L;
- unsigned short num = (unsigned short)((x*value)/den); // normalize lut value
- return num;
-}
-
-bool
-TeDecoderTIFF::readLut()
-{
- unsigned short *rmap,*gmap,*bmap;
- if (!TIFFGetField(tif, TIFFTAG_COLORMAP, &rmap, &gmap, &bmap))
- return false;
- params_.lutr_.clear();
- params_.lutb_.clear();
- params_.lutg_.clear();
-
- unsigned int n = params_.lutr_.size();
-
- int nindexes = (1 << params_.nbitsperPixel_[0]);
- long maxval = (long)pow(2.,params_.nbitsperPixel_[0])-1;
-
- int x;
- if (checkmap (nindexes,rmap,gmap,bmap,maxval) == 16)
- {
- for(x=0; x<nindexes; ++x)
- {
- params_.lutr_.push_back(CVT1(rmap[x],maxval));
- params_.lutg_.push_back(CVT1(gmap[x],maxval));
- params_.lutb_.push_back(CVT1(bmap[x],maxval));
- }
- }
- else
- {
- for(x=0; x<nindexes; ++x)
- {
- params_.lutr_.push_back(rmap[x]);
- params_.lutg_.push_back(gmap[x]);
- params_.lutb_.push_back(bmap[x]);
- }
- }
- n = params_.lutr_.size();
- return true;
-}
-
-void
-TeDecoderTIFF::saveLut()
-{
- if (!tif)
- return;
-
- TeRasterParams& mmparams = memManager_.params();
-
- int nentries = mmparams.lutr_.size();
- if (nentries <= 0)
- return;
-
- unsigned short* lutr = new unsigned short[nentries];
- unsigned short* lutg = new unsigned short[nentries];
- unsigned short* lutb = new unsigned short[nentries];
-
- for (int i=0; i<nentries; i++)
- {
- lutr[i] = mmparams.lutr_[i]*255;
- lutg[i] = mmparams.lutg_[i]*255;
- lutb[i] = mmparams.lutb_[i]*255;
- }
- TIFFSetField(tif, TIFFTAG_COLORMAP,lutr,lutg,lutb);
- delete [] lutr;
- delete [] lutg;
- delete [] lutb;
-}
-
-
-inline void TeDecoderTIFF::getElement_TeUNSIGNEDCHAR(const long& plane, const long& pos, double& val)
-{
- assert(data_TeUNSIGNEDCHAR_ != 0 );
- val = (double)data_TeUNSIGNEDCHAR_[plane][pos];
-}
-
-
-inline void TeDecoderTIFF::getElement_TeCHAR(const long& plane, const long& pos, double& val)
-{
- assert(data_TeCHAR_ != 0 );
- val = (double)data_TeCHAR_[plane][pos];
-}
-
-
-inline void TeDecoderTIFF::getElement_TeUNSIGNEDSHORT(const long& plane, const long& pos, double& val)
-{
- assert(data_TeUNSIGNEDSHORT_ != 0 );
- val = (double)data_TeUNSIGNEDSHORT_[plane][pos];
-}
-
-
-inline void TeDecoderTIFF::getElement_TeSHORT(const long& plane, const long& pos, double& val)
-{
- assert(data_TeSHORT_ != 0 );
- val = (double)data_TeSHORT_[plane][pos];
-}
-
-
-inline void TeDecoderTIFF::getElement_TeINTEGER(const long& plane, const long& pos, double& val)
-{
- assert(data_TeINTEGER_ != 0 );
- val = (double)data_TeINTEGER_[plane][pos];
-}
-
-
-inline void TeDecoderTIFF::getElement_TeUNSIGNEDLONG(const long& plane, const long& pos, double& val)
-{
- assert(data_TeUNSIGNEDLONG_ != 0 );
- val = (double)data_TeUNSIGNEDLONG_[plane][pos];
-}
-
-
-inline void TeDecoderTIFF::getElement_TeLONG(const long& plane, const long& pos,double& val)
-{
- assert(data_TeLONG_ != 0 );
- val = (double)data_TeLONG_[plane][pos];
-}
-
-
-inline void TeDecoderTIFF::getElement_TeFLOAT(const long& plane, const long& pos, double& val)
-{
- assert(data_TeFLOAT_ != 0 );
- val = (double)data_TeFLOAT_[plane][pos];
-}
-
-
-inline void TeDecoderTIFF::getElement_TeDOUBLE(const long& plane, const long& pos, double& val)
-{
- assert(data_TeDOUBLE_ != 0 );
- val = (double)data_TeDOUBLE_[plane][pos];
-}
-
-
-TeDecoderTIFFFactory::TeDecoderTIFFFactory(const string& name):
- TeDecoderFactory(name)
-{
- // Defines the decoder identifiers synonyms
- TeDecoderFactory::instanceName2Dec()["TIF"] = "TIF";
- TeDecoderFactory::instanceName2Dec()["TIFF"] = "TIF";
-}
-
diff --git a/src/terralib/kernel/TeDecoderTIFF.h b/src/terralib/kernel/TeDecoderTIFF.h
deleted file mode 100644
index 2a51b2e..0000000
--- a/src/terralib/kernel/TeDecoderTIFF.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoderTIFF.h
- \brief This file contais functions to deal with raster images in Tiff/GeoTIFF format.
-*/
-
-#ifndef __TERRALIB_INTERNAL_DECODERTIFF_H
-#define __TERRALIB_INTERNAL_DECODERTIFF_H
-
-#include "TeDecoder.h"
-#include "TeDecoderSmartMem.h"
-
-// LibTIFF includes
-#include "geotiff.h"
-#include "xtiffio.h"
-
-
-//! Implements a decoder to a raster in TIFF (Tagged Image File Format) format with or without geographical tags (geotiff)
-/*!
- Decoder TIFF is based on geotiff libray (http://remotesensing.org/geotiff/geotiff.html).
- This imposes some restrictions to this decoder. Using libtiff TIFF image files may not
- be opened for both reading and writing access, or, there is no support for altering the contents of
- a TIFF file. So this decoder is limited to create new tiff files or to read existing ones. \par
- The default file extensions associated to this decoder are ".tif" or ".tiff". \par
- \note This decoder doesn't support tiff files that are organizes in tiles and in separated planes.
-*/
-class TL_DLL TeDecoderTIFF: public TeDecoder
-{
- TIFF *tif; // TIFF directory structure
- GTIF *gtif; // GEOTIFF directory structure
-
- unsigned char** dataBuffer_; // buffer to hold decoded data
- // for tile data it holds 1 tile
- // for stripped data it holds 1 strip with all the planes
-
- unsigned int nplanes_; // number of planes or logical division of the data within the files
-
- bool isGeoTiff_; // indicates if the data has geographical information
- short TImage_; // 0=MONOIMAGE, 1=RGBIMAGE, 2=PALLETE
- unsigned short planar_; // storage organization : PLANARCONFIG_CONTIG or PLANARCONFIG_SEPARATE
-
- bool isTiled_; // indicates if the data is organizes in tiles
- unsigned long tilew_,tileh_; // tile and height
- unsigned long tilesacross_; // number of tiles to compose a row of image
- unsigned long bytespertile_; // number of bytes per tile
- long TCurTile_; // current tile decoded in internal memory
-
- unsigned long rowsperstrip_; // number of rows per strip
- unsigned long nstripsperplane_; // number of strips per plane of data
- unsigned long stripsize_; // number of bytes per strip
- long TCurStrip_; // current line in memory
-
- unsigned int nBands_; // number of samples per data
-
- // This is an internal smart manager to support the creation of tiffs
- TeDecoderSmartMem memManager_;
-
- // Reads TIFF Directory and fills tif structure
- void readTiffDirectory();
-
- // Reads the georeferencing keys of a geotiff data
- bool getGeoTIFF();
-
- // Sets the georeferencing keys of a geotiff data
- void setGeoKeys();
-
- // Reads LUT information
- bool readLut();
-
- // Saves LUT information
- void saveLut();
-
- // Reads enough tiles to compose a row of data
- bool readTileImageContig(unsigned long tiler);
-
- // Reads a strip
- bool readStrip(unsigned long strip);
-
- // Allocates te internal memory
- bool allocateWorkMemory();
-
- //! Type definition for the getElement function pointer
- typedef void (TeDecoderTIFF::*GetEleFunctPtrT)( const long& plane, const long& pos, double& val );
-
- //! A pointer to the current getElement method following the current data type
- GetEleFunctPtrT getelement_ptr_;
-
- //! A casted pointer to the current data
- unsigned char** data_TeUNSIGNEDCHAR_;
-
- //! A casted pointer to the current data
- char** data_TeCHAR_;
-
- //! A casted pointer to the current data
- unsigned short** data_TeUNSIGNEDSHORT_;
-
- //! A casted pointer to the current data
- short** data_TeSHORT_;
-
- //! A casted pointer to the current data
- int** data_TeINTEGER_;
-
- //! A casted pointer to the current data
- unsigned long** data_TeUNSIGNEDLONG_;
-
- //! A casted pointer to the current data
- long** data_TeLONG_;
-
- //! A casted pointer to the current data
- float** data_TeFLOAT_;
-
- //! A casted pointer to the current data
- double** data_TeDOUBLE_;
-
- inline void getElement_TeUNSIGNEDCHAR(const long& plane, const long& pos, double& val );
-
- inline void getElement_TeCHAR(const long& plane, const long& pos, double& val );
-
- inline void getElement_TeUNSIGNEDSHORT(const long& plane, const long& pos, double& val );
-
- inline void getElement_TeSHORT(const long& plane, const long& pos, double& val );
-
- inline void getElement_TeINTEGER(const long& plane, const long& pos, double& val );
-
- inline void getElement_TeUNSIGNEDLONG( const long& plane, const long& pos, double& val );
-
- inline void getElement_TeLONG(const long& plane, const long& pos, double& val );
-
- inline void getElement_TeFLOAT(const long& plane, const long& pos, double& val );
-
- inline void getElement_TeDOUBLE(const long& plane, const long& pos, double& val );
-
-public:
-
- //! Construtor from parameters
- TeDecoderTIFF( const TeRasterParams& );
-
- //! Normal destructor
- ~TeDecoderTIFF();
-
- //! Initializes the internal structures
- void init();
-
- //! Clear internal structures
- bool clear();
-
- //! Reads an element
- bool setElement (int col,int lin, double val, int band=0);
-
- //! Writes an element
- bool getElement (int col,int lin, double &val,int band=0);
-};
-
-//! Implements a tiff decoder factory
-class TL_DLL TeDecoderTIFFFactory : public TeDecoderFactory
-{
-public:
-
- TeDecoderTIFFFactory(const string& name);
-
- TeDecoder* build (const TeRasterParams& arg)
- { return new TeDecoderTIFF(arg); }
-};
-
-#endif
diff --git a/src/terralib/kernel/TeDecoderVirtualMemory.cpp b/src/terralib/kernel/TeDecoderVirtualMemory.cpp
deleted file mode 100644
index 92894cf..0000000
--- a/src/terralib/kernel/TeDecoderVirtualMemory.cpp
+++ /dev/null
@@ -1,473 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeDecoderVirtualMemory.h"
-#include <cstring>
-
-TeMemoryPage::TeMemoryPage(const TeMemoryPage& rhs)
-{
- data_ = rhs.data_;
- used_ = rhs.used_;
- defValue_ = rhs.defValue_;
- dataType_ = rhs.dataType_;
-}
-
-//! Operator =
-TeMemoryPage&
-TeMemoryPage::operator=(const TeMemoryPage& rhs)
-{
- if (this != &rhs)
- {
- data_ = rhs.data_;
- used_ = rhs.used_;
- size_ = rhs.size_;
- defValue_ = rhs.defValue_;
- dataType_ = rhs.dataType_;
- }
- return *this;
-}
-
-//! Destructor
-TeMemoryPage::~TeMemoryPage()
-{
- if (this->data_ != 0)
- {
- switch (dataType_)
- {
- case (TeUNSIGNEDCHAR):
- delete [](unsigned char*)data_;
- break;
- case (TeCHAR) :
- delete (char*)data_;
- break;
- case (TeUNSIGNEDSHORT):
- delete [](unsigned short*)data_;
- break;
- case (TeSHORT):
- delete (short*) data_;
- break;
- case (TeUNSIGNEDLONG):
- delete [](unsigned long*)data_;
- break;
- case (TeLONG):
- delete [](long*) data_;
- break;
- case (TeFLOAT):
- delete [](float*)data_;
- break;
- case (TeDOUBLE):
- delete [](double*) data_;
- break;
- default:
- break;
- }
- data_ = 0;
- }
-}
-
-TeMemoryPage::TeMemoryPage(unsigned long size, double defValue, TeDataType dataType):
- used_(false),
- size_(size),
- defValue_(defValue),
- dataType_(dataType)
-{
- data_ = 0;
- try
- {
- unsigned int i;
- // Try to allocate the necessary memory
- switch (dataType_) {
- case (TeUNSIGNEDCHAR):
- data_ = new unsigned char [size_];
- memset(data_, (int)defValue, size);
- break;
- case (TeCHAR) :
- data_ = new char [size_];
- memset(data_, (int)defValue, size);
- break;
- case (TeUNSIGNEDSHORT):
- data_ = new unsigned short [size_];
- for (i=0;i<size;((unsigned short*)data_)[i]= (unsigned short) defValue_,i++);
- break;
- case (TeSHORT):
- data_ = new short [size_];
- for (i=0;i<size;((short*)data_)[i]=(short)defValue_,i++);
- break;
- case (TeUNSIGNEDLONG):
- data_ = new unsigned long [size_];
- for (i=0;i<size;((unsigned long*)data_)[i]=(unsigned long)defValue_,i++);
- break;
- case (TeLONG):
- data_ = new long [size_];
- for (i=0;i<size;((long*)data_)[i]=(long)defValue_,i++);
- break;
- case (TeFLOAT):
- data_ = new float [size_];
- for (i=0;i<size;((float*)data_)[i]=(float)defValue_,i++);
- break;
- case (TeDOUBLE):
- data_ = new double [size_];
- for (i=0;i<size;((double*)data_)[i]=(double)defValue_,i++);
- break;
- default:
- break;
- }
- }
- catch (...)
- {
- }
-}
-
-void
-TeMemoryPage::clear()
-{
- unsigned int i;
- switch (dataType_)
- {
- case (TeUNSIGNEDCHAR):
- case (TeCHAR) :
- memset((void*)data_, (int)defValue_, size_);
- break;
- case (TeUNSIGNEDSHORT):
- for (i=0;i<size_;((unsigned short*)data_)[i]= (unsigned short) defValue_,i++);
- break;
- case (TeSHORT):
- for (i=0;i<size_;((short*)data_)[i]=(short)defValue_,i++);
- break;
- case (TeUNSIGNEDLONG):
- for (i=0;i<size_;((unsigned long*)data_)[i]=(unsigned long)defValue_,i++);
- break;
- case (TeLONG):
- for (i=0;i<size_;((long*)data_)[i]=(long)defValue_,i++);
- break;
- case (TeFLOAT):
- for (i=0;i<size_;((float*)data_)[i]=(float)defValue_,i++);
- break;
- case (TeDOUBLE):
- for (i=0;i<size_;((double*)data_)[i]=(double)defValue_,i++);
- break;
- default:
- break;
- }
-}
-
-long
-TeMemoryPage::pageSize()
-{
- long s;
- switch (dataType_)
- {
- case (TeCHAR) :
- s = size_*sizeof(char);
- break;
- case (TeUNSIGNEDSHORT):
- s = size_*sizeof(unsigned short);
- break;
- case (TeSHORT):
- s = size_*sizeof(short);
- break;
- case (TeUNSIGNEDLONG):
- s = size_*sizeof(unsigned long);
- break;
- case (TeLONG):
- s = size_*sizeof(long);
- break;
- case (TeFLOAT):
- s = size_*sizeof(float);
- break;
- case (TeDOUBLE):
- s = size_*sizeof(double);
- break;
- default:
- s = size_*sizeof(unsigned char);
- }
- return s;
-}
-
-double
-TeMemoryPage::getVal(int col,int lin, int nCols)
-{
- unsigned long offset = (lin-ulLin_)*nCols+(col-ulCol_);
- double val = defValue_;
-
- if (offset < size_) // solucao temporaria, rever
- {
- switch (dataType_)
- {
- case (TeUNSIGNEDCHAR):
- val = ((unsigned char*)data_)[offset];
- break;
- case (TeCHAR) :
- val = ((char*) data_)[offset];
- break;
- case (TeUNSIGNEDSHORT):
- val = ((unsigned short*)data_)[offset];
- break;
- case (TeSHORT):
- val = ((short*)data_)[offset];
- break;
- case (TeUNSIGNEDLONG):
- val = ((unsigned long*)data_)[offset];
- break;
- case (TeLONG):
- val = ((long*)data_)[offset];
- break;
- case (TeFLOAT):
- val = ((float*)data_)[offset];
- break;
- case (TeDOUBLE):
- val = ((double*)data_)[offset];
- break;
- default:
- break;
- }
- }
-
- return val;
-}
-
-void
-TeMemoryPage::setVal(int col,int lin,int nCols, double val)
-{
- unsigned long offset = (lin-ulLin_)*nCols+(col-ulCol_);
- if (offset < size_)
- {
- switch (dataType_)
- {
- case (TeUNSIGNEDCHAR):
- ((unsigned char*)data_)[offset] = (unsigned char) val;
- break;
-
- case (TeCHAR) :
- ((char*) data_)[offset] = (char) val;
- break;
-
- case (TeUNSIGNEDSHORT):
- ((unsigned short*)data_)[offset] = (unsigned short) val;
- break;
-
- case (TeSHORT):
- ((short*)data_)[offset] = (short) val;
- break;
-
- case (TeUNSIGNEDLONG):
- ((unsigned long*)data_)[offset] = (unsigned long) val;
- break;
-
- case (TeLONG):
- ((long*)data_)[offset] = (long) val;
- break;
-
- case (TeFLOAT):
- ((float*)data_)[offset] = (float) val;
- break;
-
- case (TeDOUBLE):
- ((double*)data_)[offset] = val;
-
- default:
- break;
- }
- }
- return;
-}
-
-TeDecoderVirtualMemory::TeDecoderVirtualMemory(const TeRasterParams par)
-{
- params_ = par;
-}
-
-TeDecoderVirtualMemory::~TeDecoderVirtualMemory()
-{
- if (!pagesQueue_.empty())
- TeDecoderVirtualMemory::clear();
-}
-
-TeMemoryPage* TeDecoderVirtualMemory::loadBlock(int col,int lin, int band)
-{
- // If element is outside raster boundaries return
- if(col < 0 || lin < 0 || col > params_.ncols_ || lin > params_.nlines_)
- return NULL;
-
- TeBlockIndex index = blockIndex(col,lin,band);
- TeMemoryPage* block = NULL;
-
- // check band cache first
- if (pageCache_[band] != NULL && indexCache_[band] == index)
- block = pageCache_[band];
- else
- {
- // check if page is already in memory
- MapMemoryPageIterator p = virtualMemory_.find(index);
- if (p != virtualMemory_.end()) // use it
- block = p->second;
- else
- {
- // page is not in memory
- // check whether there is space in memory to bring another page
- if (virtualMemory_.size() >= (unsigned int)params_.nTilesInMemory_)
- {
- // FIFO strategy: replace the oldest page in memory
- TeBlockIndex first = pagesQueue_.front();
- pagesQueue_.pop();
- p = virtualMemory_.find(first);
- if (p != virtualMemory_.end())
- {
- block = p->second;
- if (block->used_)
- putRasterBlock(first,block->data_,block->pageSize());
-
- block->used_ = false;
- block->clear(); // reuse the allocated memory
- virtualMemory_.erase(first);
- }
- }
- else // bring the page to memory
- block = new TeMemoryPage(params_.blockHeight_*params_.blockWidth_, params_.dummy_[band],params_.dataType_[band]);
-
- virtualMemory_.insert(MapMemoryPage::value_type(index,block));
- pagesQueue_.push(index);
- getRasterBlock(index,block->data_);
- int band_out;
- blockIndexPos(index, block->ulCol_, block->ulLin_, band_out);
- }
- indexCache_[band] = index;
- pageCache_[band] = block;
- }
- return block;
-}
-
-bool
-TeDecoderVirtualMemory::getElement(int col,int lin, double &val,int band)
-{
- TeMemoryPage* block = loadBlock(col, lin, band);
- if(block == NULL)
- {
- val = params_.dummy_[band];
- return false;
- }
- val = block->getVal(col,lin,params_.blockWidth_);
- return true;
-}
-
-bool
-TeDecoderVirtualMemory::setElement(int col, int lin, double val,int band)
-{
- TeMemoryPage* block = loadBlock(col, lin, band);
- if(block == NULL)
- return false;
-
- block->setVal(col,lin,params_.blockWidth_,val);
- block->used_ = true;
- return true;
-}
-
-TeBlockIndex TeDecoderVirtualMemory::blockIndex(int col, int lin, int band)
-{
- TeBlockIndex bl_idx;
-
- bl_idx.band_ = band;
- bl_idx.col_ = (int)(col/params_.blockWidth_);
- bl_idx.lin_ = (int)(lin/params_.blockHeight_);
- return bl_idx;
-}
-
-void TeDecoderVirtualMemory::blockIndexPos( const TeBlockIndex& index, int& ulCol, int& ulLin, int& band)
-{
- ulCol = index.column()*params_.blockWidth_;
- ulLin = index.line()*params_.blockHeight_;
- band = index.band();
-}
-
-void
-TeDecoderVirtualMemory::init()
-{
- TeDecoderVirtualMemory::clear();
- if (params_.nBands() == 0 || params_.ncols_ <= 0 || params_.nlines_ == 0)
- {
- params_.errorMessage_ = "Raster doesnt have valid dimensions.";
- params_.status_ = TeRasterParams::TeNotReady;
- return;
- }
- if ( params_.nTilesInMemory_ == 0 )
- params_.nTilesInMemory_ = params_.nBands() * (params_.ncols_ / params_.blockWidth_+1) ;
-}
-
-bool
-TeDecoderVirtualMemory::clear()
-{
- TeMemoryPage* block;
- TeBlockIndex index;
- MapMemoryPageIterator p;
- while (!pagesQueue_.empty() )
- {
- index = pagesQueue_.front();
- pagesQueue_.pop();
- p = virtualMemory_.find(index);
- if (p != virtualMemory_.end())
- {
- block = p->second;
- if (block->used_)
- putRasterBlock(index,block->data_,block->pageSize());
- delete block;
- virtualMemory_.erase(index);
- }
- }
-
- pageCache_.resize(params_.nBands());
- for(unsigned int i = 0; i < pageCache_.size(); ++i)
- {
- pageCache_[i] = NULL;
- }
-
- indexCache_.resize(params_.nBands());
- for(unsigned int i = 0; i < indexCache_.size(); ++i)
- {
- indexCache_[i] = TeBlockIndex();
- }
-
- return true;
-}
-
-void TeDecoderVirtualMemory::setCacheSize(int size)
-{
- int block_size = params_.blockHeight_ * params_.blockWidth_;
- setCacheNTiles((int)(size / block_size));
-}
-
-int TeDecoderVirtualMemory::getCacheSize()
-{
- int block_size = params_.blockHeight_ * params_.blockWidth_;
- return getCacheNTiles() * block_size;
-}
-
-void TeDecoderVirtualMemory::setCacheNTiles(int n)
-{
- params_.nTilesInMemory_ = n;
- TeDecoderVirtualMemory::clear();
-}
-
-int TeDecoderVirtualMemory::getCacheNTiles()
-{
- return params_.nTilesInMemory_;
-}
diff --git a/src/terralib/kernel/TeDecoderVirtualMemory.h b/src/terralib/kernel/TeDecoderVirtualMemory.h
deleted file mode 100644
index 1069742..0000000
--- a/src/terralib/kernel/TeDecoderVirtualMemory.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDecoderVirtualMemory.h
- \brief This file supports a virtual memory strategy to deal whith raster structures
-*/
-#ifndef __TERRALIB_INTERNAL_DECODERVIRTUALMEMORY_H
-#define __TERRALIB_INTERNAL_DECODERVIRTUALMEMORY_H
-
-#include "TeDefines.h"
-#include "TeDecoder.h"
-
-#include <queue>
-#include <vector>
-
-using namespace std;
-
-//! A page of memory
-class TL_DLL TeMemoryPage
-{
-public:
- void* data_; //<! Pointer to the data in memory
- bool used_; //<! Flag that indicate if the page was modified in memory
- unsigned long size_; //<! Page number of elements
-
- int ulLin_; //<! Line index of the upper-left corner
- int ulCol_; //<! Column index of the upper-left corner
- double defValue_; //<! Default value (fo initially fill the page)
- TeDataType dataType_; //<! Pixel data type
-
- //! Constructor
- TeMemoryPage(unsigned long size, double defValue, TeDataType dataType = TeDOUBLE);
-
- //! Destructor
- ~TeMemoryPage();
-
- //! Copy constructor
- TeMemoryPage(const TeMemoryPage& rhs);
-
- //! Operator =
- TeMemoryPage& operator=(const TeMemoryPage& rhs);
-
- //! Returns the value of on position within the block
- /*
- \par col column identifier of the position
- \par lin line identifier of the position
- \par nCols number of columns per line of the block
- \returns the value of the position indicated by (col x lin)
- */
- double getVal(int col,int lin, int nCols);
-
- //! Sets the value of a position within the block
- /*
- \par col column identifier of the position
- \par lin line identifier of the position
- \par nCols number of columns per line of the block
- \par val the value to be put in the position
- */
- void setVal(int col,int lin,int nCols, double val);
-
- //! Set all positions of the page to the default value;
- void clear();
-
- //! Returns the physical size of a memory page
- long pageSize();
-};
-
-class TL_DLL TeBlockIndex{
-public:
- TeBlockIndex()
- {
- col_ = 0;
- lin_ = 0;
- band_ = -1;
- }
-
- int col_;
- int lin_;
- int band_;
-
- int column() const
- {
- return col_;
- }
-
- int line() const
- {
- return lin_;
- }
-
- int band() const
- {
- return band_;
- }
-
- int operator==(const TeBlockIndex& idx2) const
- {
- if(col_ != idx2.col_)
- return 0;
-
- if(lin_ != idx2.lin_)
- return 0;
-
- return (band_ == idx2.band_);
- }
-};
-
-//! Implements a virtual memory strategy to decode raster in blocks
-/*
- It should be used as a parent class of decoder that access raster
- blocks from a physical storage
-*/
-class TL_DLL TeDecoderVirtualMemory: public TeDecoder
-{
-public:
-
- //! Empty constructor
- TeDecoderVirtualMemory() {};
-
- //! Constructor from parameters
- TeDecoderVirtualMemory( const TeRasterParams par);
-
- //! Destructor
- virtual ~TeDecoderVirtualMemory();
-
- //! Sets the value of a specific raster pixel
- /*!
- \param col pixel column identifier
- \param lin pixel line identifier
- \param val pixel value being inserted
- \param band pixel band identifier
- */
- bool getElement(int col,int lin, double &val,int band);
-
- //! Gets an specific element (col, lin, band) of a raster data
- /*!
- \param col pixel column identifier
- \param lin pixel line identifier
- \param val pixel value being retrieved
- \param band pixel band identifier
- */
- bool setElement(int col, int lin, double val,int band);
-
- //! Initializes the internal structures of the decoder, from its raster parameters structure.
- void init();
-
- //! Clears the decoder internal structures
- bool clear();
-
- //! Defines the physical size of the cache
- void setCacheSize(int size);
-
- //! Returns the physical size of the cache
- int getCacheSize();
-
- //! Defines the number of tiles in the cache
- void setCacheNTiles(int n);
-
- //! Returns the number of tiles in the cache
- int getCacheNTiles();
-
-protected:
- struct TeBlockIndexMapFunc
- {
- bool operator()(const TeBlockIndex& idx1, const TeBlockIndex& idx2) const;
- };
-
- //! Saves a raster tile from a virtual memory to permanent storage
- /*!
- \param index block index
- \param buf pointer to a raster tile in memory
- \param bsize block size
- */
- virtual bool putRasterBlock(const TeBlockIndex& index, void *buf, long bsize) = 0; /******/
-
- //! Gets the raster block with index identifier
- /*!
- \param index block index
- \param buf pointer to a raster tile in memory
- */
- virtual bool getRasterBlock(const TeBlockIndex& index, void *buf) = 0; /******/
-
- //! Codifies the unique identifier of the raster block that contains a certain pixel
- /*!
- \param col column number
- \param lin pixel line number
- \param band pixel band
- \return block index
- */
- virtual TeBlockIndex blockIndex(int col, int lin, int band);
-
- //! Returns the parameters of a tile from its indexs
- virtual void blockIndexPos( const TeBlockIndex& index, int& ulCol, int& ulLin, int& band); /******/
-
- //! Retrieve a block of the cache that contains an element
- TeMemoryPage* loadBlock(int col,int lin, int band);
-
-private:
-
- //! A map of string identifiers to pointer to memory pages
- typedef map<TeBlockIndex, TeMemoryPage*, TeBlockIndexMapFunc> MapMemoryPage;
-
- //! A const iterator to a map of pages
- typedef MapMemoryPage::const_iterator MapMemoryPageIterator;
-
- MapMemoryPage virtualMemory_;
- queue<TeBlockIndex> pagesQueue_;
- vector<TeBlockIndex> indexCache_;
- vector<TeMemoryPage*> pageCache_;
-};
-
-inline bool TeDecoderVirtualMemory::TeBlockIndexMapFunc::operator()(const TeBlockIndex& idx1, const TeBlockIndex& idx2) const
-{
- if(idx1.band_ != idx2.band_)
- return (idx1.band_ < idx2.band_);
-
- if(idx1.lin_ != idx2.lin_)
- return idx1.lin_ < idx2.lin_;
-
- return (idx1.col_ < idx2.col_);
-}
-#endif
diff --git a/src/terralib/kernel/TeDefines.h b/src/terralib/kernel/TeDefines.h
index 9442e69..6c585dc 100644
--- a/src/terralib/kernel/TeDefines.h
+++ b/src/terralib/kernel/TeDefines.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeDefines.h
\brief Provides a set of general definitions used by Terralib
*/
diff --git a/src/terralib/kernel/TeErrorLog.cpp b/src/terralib/kernel/TeErrorLog.cpp
index f104ed8..087afc1 100644
--- a/src/terralib/kernel/TeErrorLog.cpp
+++ b/src/terralib/kernel/TeErrorLog.cpp
@@ -1,32 +1,19 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#ifdef WIN32
#pragma warning ( disable: 4786 )
#endif
#include "TeErrorLog.h"
-#include "TeAsciiFile.h"
#include "TeUtils.h"
#include "TeException.h"
@@ -112,24 +99,7 @@ TeErrorLog::message( const TeErrorType msgCode )
void
TeErrorLog::insert ( TeErrorType code, const string& msg )
{
- // create a new logfile, if needed
- if ( logFile_ == 0 )
- //logFile_ = new TeAsciiFile ( "terralib.err", "rw" );
- return;
-
- string log = errorMessage_ [ code ] + " " + msg;
- logFile_->writeString ( log );
- logFile_->writeNewLine();
-
- // increment the count associated to this error type
- map<TeErrorType, int>::iterator it = errorLog_.find( code );
- if ( it == errorLog_.end() )
- errorLog_[ code ] = 1;
- else
- {
- int count = (*it).second;
- errorLog_[ code ] = ++count;
- }
+
}
@@ -138,47 +108,14 @@ TeErrorLog::startSession ( const string& errLogFileName)
{
endSession();
- // create a new logfile
- logFile_ = new TeAsciiFile ( errLogFileName, "w+" );
-
- if( logFile_ == 0 ) {
- throw TeException( UNKNOWN_ERROR_TYPE, "Unable to create log file",
- false );
- }
}
int
TeErrorLog::endSession ()
{
- if( logFile_ == 0 ) {
- errorLog_.clear ();
- return 0;
- }
-
- int numerr = errorLog_.size();
-
- // increment the count associated to this error type
- map<TeErrorType, int>::iterator it = errorLog_.begin();
-
- while ( it != errorLog_.end() )
- {
- int count = (*it).second;
- string log = "Number of Error of Type " + errorMessage_ [ (*it).first ]
- + " = " + Te2String ( count );
- logFile_->writeString ( log );
- logFile_->writeNewLine();
-
- ++it;
- }
-
- // close the log file
- delete logFile_;
- logFile_ = 0;
-
- // clear the stack
- errorLog_.clear ();
-
- return numerr;
+
+
+ return 0;
}
diff --git a/src/terralib/kernel/TeErrorLog.h b/src/terralib/kernel/TeErrorLog.h
index 53bc89a..cee4fcb 100644
--- a/src/terralib/kernel/TeErrorLog.h
+++ b/src/terralib/kernel/TeErrorLog.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeErrorLog.h
\brief This file deals log of errors in TerraLib
*/
diff --git a/src/terralib/kernel/TeErrorMessage.cpp b/src/terralib/kernel/TeErrorMessage.cpp
deleted file mode 100644
index 0f5a1a6..0000000
--- a/src/terralib/kernel/TeErrorMessage.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeErrorMessage.h"
-#include <map>
-using namespace std;
-static map<string, string> errorMessage_;
-
-
diff --git a/src/terralib/kernel/TeErrorMessage.h b/src/terralib/kernel/TeErrorMessage.h
deleted file mode 100644
index c63934f..0000000
--- a/src/terralib/kernel/TeErrorMessage.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeErrorMessage.h
- \brief This file contains some definitions issuing error messages to the user
-*/
-#ifndef TeErrorMessage_H
-#define TeErrorMessage_H
-
-#include <string>
-using namespace std;
-
-#include "TePrototype.h"
-#include "TeSingleton.h"
-
-/*!
-\enum TeMessageType
-
-Te_ABORTRETRYIGNORE
- The message box contains three pushbuttons: Abort, Retry, and Ignore.
-Te_OK The message box contains one pushbutton: OK.
-Te_OKCANCEL The message box contains two pushbuttons: OK and Cancel.
-Te_RETRYCANCEL The message box contains two pushbuttons: Retry and Cancel.
-Te_YESNO The message box contains two pushbuttons: Yes and No.
-Te_YESNOCANCEL The message box contains three pushbuttons: Yes, No, and Cancel.
-
----*/
-enum TeMessageType
-{ Te_ABORTRETRYIGNORE, Te_OK, Te_OKCANCEL, Te_RETRYCANCEL, Te_YESNO, Te_YESNOCANCEL };
-
-
-/*!
-\enum TeMessageIcon
-
-Te_ICONEXCLAMATION An exclamation-point icon appears in the message box.
-Te_ICONINFORMATION An icon consisting of an i in a circle appears in the message box.
-Te_ICONQUESTION A question-mark icon appears in the message box.
-Te_ICONSTOP A stop-sign icon appears in the message box.
------*/
-
-enum TeMessageIcon
-{ Te_ICONEXCLAMATION, Te_ICONINFORMATION, Te_ICONQUESTION, Te_ICONSTOP };
-
-/*---------
-Return Value
-
-Zero if there is not enough memory to display the message box;
-otherwise one of the following values is returned:
-
-Te_IDABORT The Abort button was selected.
-Te_IDCANCEL The Cancel button was selected.
-Te_IDIGNORE The Ignore button was selected.
-Te_IDNO The No button was selected.
-Te_IDOK The OK button was selected.
-Te_IDRETRY The Retry button was selected.
-Te_IDYES The Yes button was selected.
-
-----*/
-
-enum TeMessageReturn
-{ Te_IDABORT, Te_IDCANCEL, Te_IDIGNORE, Te_IDNO, Te_IDOK, Te_IDRETRY, Te_IDYES };
-
-//! Provides a convenience class for issuing error messages to the user
-/*
- Based on a configuration parameter, provide implementations
- for console (stdio), MFC and QT
-
- \sa TeException
-*/
-class TL_DLL TeErrorMessage
-{
-public:
- //! Constructor
- TeErrorMessage(){}
-
- virtual ~TeErrorMessage(){}
-
- virtual TeMessageReturn apply (
- const string& appName,
- const string & msgText,
- TeMessageType msgType,
- TeMessageIcon iconType ) = 0;
-};
-
-class TL_DLL TeErrorMessagePrototype: public TePrototype<TeErrorMessage>
-{
- virtual TeErrorMessage* build() = 0;
-};
-
-#endif
-
diff --git a/src/terralib/kernel/TeException.cpp b/src/terralib/kernel/TeException.cpp
index 6b9dae1..df794c5 100644
--- a/src/terralib/kernel/TeException.cpp
+++ b/src/terralib/kernel/TeException.cpp
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
#ifdef WIN32
#pragma warning ( disable: 4786 )
diff --git a/src/terralib/kernel/TeException.h b/src/terralib/kernel/TeException.h
index 5b7e03b..7dabea9 100644
--- a/src/terralib/kernel/TeException.h
+++ b/src/terralib/kernel/TeException.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeException.h
\brief This file deals Eexception throwing in TerraLib
*/
diff --git a/src/terralib/kernel/TeExternalTheme.cpp b/src/terralib/kernel/TeExternalTheme.cpp
deleted file mode 100644
index 93d46a8..0000000
--- a/src/terralib/kernel/TeExternalTheme.cpp
+++ /dev/null
@@ -1,1447 +0,0 @@
-#include "TeExternalTheme.h"
-#include "TeLayer.h"
-#include "TeDatabase.h"
-#include "TeDatabaseFactoryParams.h"
-#include "TeDBConnectionsPool.h"
-#include "TeGroupingAlgorithms.h"
-#include "TeQuerier.h"
-#include "TeQuerierParams.h"
-#include "TeRasterTransform.h"
-
-
-TeExternalTheme::TeExternalTheme(TeDatabase* sourceDB, const string& name, TeViewNode* parent, const int& view, const int& id)
- : TeTheme(name, 0, parent, view, id), remoteTheme_(0), sourceDB_(sourceDB)
-{
- type(TeEXTERNALTHEME);
-}
-
-TeExternalTheme::TeExternalTheme(const TeViewNodeParams& params)
- : TeTheme(params), remoteTheme_(0), sourceDB_(0)
-{
-}
-
-TeExternalTheme::~TeExternalTheme()
-{
-}
-
-TeExternalTheme::TeExternalTheme(const TeExternalTheme& rhs) :
- TeTheme(rhs.viewNodeParams_)
-{
-// *(TeTheme*)this = rhs;
- remoteTheme_ = rhs.remoteTheme_;
- sourceDB_ = rhs.sourceDB_;
- remoteDBConn_ = rhs.remoteDBConn_;
-}
-
-TeExternalTheme& TeExternalTheme::operator=(TeExternalTheme& rhs)
-{
- *(TeTheme*)this = rhs;
- remoteTheme_ = rhs.remoteTheme_;
- sourceDB_ = rhs.sourceDB_;
- remoteDBConn_ = rhs.remoteDBConn_;
- return *this;
-}
-
-void
-TeExternalTheme::setSourceDatabase(TeDatabase* db)
-{
- this->sourceDB_ = db;
-}
-
-TeDatabase*
-TeExternalTheme::getSourceDatabase()
-{
- return sourceDB_;
-}
-
-TeTheme*
-TeExternalTheme::getRemoteTheme() const
-{
- return remoteTheme_;
-}
-
-void
-TeExternalTheme::setRemoteTheme(TeTheme* theme)
-{
- this->remoteTheme_ = theme;
-}
-
-string
-TeExternalTheme::getRemoteThemeName()
-{
- return remoteTheme_->name();
-}
-
-void
-TeExternalTheme::loadObjectLegendMap()
-{
- objLegendMap_.clear();
- objOwnLegendMap_.clear();
- objStatusMap_.clear();
- itemStatusMap_.clear();
-
- TeDatabasePortal* portal = sourceDB_->getPortal();
-
- if(!portal->query("SELECT c_object_id, c_legend_id, c_legend_own, c_object_status FROM " + collectionTable()))
- return;
-
- while(portal->fetchRow())
- {
- string objId = portal->getData(0);
- int status = portal->getInt(3);
- if(portal->getInt(1) != 0)
- objLegendMap_[portal->getData(0)] = portal->getInt(1);
- if(portal->getInt(2) != 0)
- objOwnLegendMap_[portal->getData(0)] = portal->getInt(2);
- if(status != 0)
- objStatusMap_[objId] = status;
- }
-
- portal->freeResult();
-
- if(!portal->query("SELECT object_id, unique_id, grid_status FROM " + collectionAuxTable()))
- return;
-
- while(portal->fetchRow())
- {
- if(portal->getInt(2) != 0)
- {
- itemStatusMap_[portal->getData(1)] = portal->getInt(2);
- }
- }
-
- portal->freeResult();
- delete portal;
-}
-
-int
-TeExternalTheme::getGridStatus(const int uniqueId, const std::string /* objectId */)
-{
- string aux = Te2String(uniqueId);
- std::map<std::string, int >::iterator itGridStatus = itemStatusMap_.find(aux);
- if(itGridStatus == itemStatusMap_.end())
- return 0;
- return itGridStatus->second;
-}
-
-int
-TeExternalTheme::getObjectStatus(const std::string objectId)
-{
- std::map<std::string, int>::iterator it = objStatusMap_.find(objectId);
- if(it == objStatusMap_.end())
- return 0;
-
- return it->second;
-}
-
-bool
-TeExternalTheme::setObjectLegendStatusMap(const std::string objId, const int status)
-{
- if(objId.empty())
- return false;
-
- if( status == 0)
- {
- map<std::string, int>::iterator itLegStatus = objStatusMap_.find(objId);
-
- if(itLegStatus != objStatusMap_.end())
- {
- objStatusMap_.erase(itLegStatus);
- return true;
- }
- return false;
- }
-
- objStatusMap_[objId] = status;
-
- return true;
-}
-
-bool
-TeExternalTheme::setObjectGridStatusMap(const std::string objId, const int uniqueId, const int status)
-{
- string aux = Te2String(uniqueId);
- if(objId.empty() || aux.empty())
- return false;
-
- if( status == 0 )
- {
- std::map<std::string, int >::iterator itGridStatus = itemStatusMap_.find(aux);
-
- if(itGridStatus != itemStatusMap_.end())
- {
- itemStatusMap_.erase(itGridStatus);
- return true;
- }
- return false;
- }
-
- itemStatusMap_[aux] = status;
-
- return true;
-}
-
-int
-TeExternalTheme::layerId()
-{
- return -1;
-}
-
-void
-TeExternalTheme::layerId(int)
-{
-}
-
-void
-TeExternalTheme::layer(TeLayer* layer)
-{
- if(remoteTheme_)
- remoteTheme_->layer(layer);
-}
-
-TeLayer*
-TeExternalTheme::layer()
-{
- if(remoteTheme_)
- return remoteTheme_->layer();
- return 0;
-}
-
-TeProjection*
-TeExternalTheme::getThemeProjection()
-{
- if(remoteTheme_ && remoteTheme_->layer())
- return remoteTheme_->layer()->projection();
- return 0;
-}
-
-bool
-TeExternalTheme::hasRestriction()
-{
- return false;
-}
-
-bool TeExternalTheme::hasAttrRest()
-{
- return false;
-}
-
-bool TeExternalTheme::hasTemporalRest()
-{
- return false;
-}
-
-bool TeExternalTheme::hasSpatialRest()
-{
- return false;
-}
-
-string TeExternalTheme::sqlWhereRestrictions(TeRepresentation* /* rep */)
-{
- return string("");
-}
-
-void TeExternalTheme::loadTablesJoin(const string& geomTable)
-{
- remoteTheme_->loadTablesJoin(geomTable);
-}
-
-string TeExternalTheme::sqlGridJoin()
-{
- return remoteTheme_->sqlGridJoin();
-}
-
-string TeExternalTheme::sqlGridFrom(const string& geomTable)
-{
- return remoteTheme_->sqlGridFrom(geomTable);
-}
-
-bool TeExternalTheme::save(TeDatabase* db)
-{
- if(!db)
- return false;
-
- //insert theme in database
- //TeDatabase::insertTheme and TeDatabase::updateTheme use the method saveMetadata
- if(id()==0)
- {
- if(!db->insertTheme(this)) //updateThemeTable
- {
- db->deleteTheme(this->id());
- return false;
- }
- }
- else
- {
- if(!db->updateTheme(this)) //updateThemeTable
- {
- db->deleteTheme(this->id());
- return false;
- }
- }
-
- //collection table
- if(collectionTable().empty())
- collectionTable("te_collection_"+ Te2String(id()));
-
- if(!db->createCollectionTable(collectionTable_))
- {
- db->deleteTheme(this->id());
- return false;
- }
-
- //collection aux table
- collectionAuxTable(collectionTable() + "_aux");
-
- if(!TeTheme::createCollectionAuxTable(db))
- {
- db->deleteTheme(this->id());
- return false;
- }
-
- return true;
-}
-
-bool TeExternalTheme::save()
-{
- if(!save(sourceDB_))
- return false;
-
- // a map to identify legends id between local theme and remote theme during copy.
- std::map<int, int> mapIdLegend;
-
- createLegendMapId(mapIdLegend);
-
- if(!mapIdLegend.empty())
- copyRemoteCollection(mapIdLegend);
-
- mapIdLegend.clear();
-
- loadObjectLegendMap();
-
- return true;
-}
-
-bool TeExternalTheme::createCollectionAuxTable()
-{
- return TeTheme::createCollectionAuxTable(sourceDB_);
-}
-
-bool TeExternalTheme::populateCollectionAux(std::string /* objectId */)
-{
- throw;
- return false;
-}
-
-bool TeExternalTheme::buildGrouping(const TeGrouping& g, TeSelectedObjects /* selectedObjects */,
- vector<double>* dValuesVec)
-{
- TeDatabase* db = remoteTheme_->layer()->database();
- if(!db)
- return false;
-
- grouping_ = g;
- unsigned int i;
- vector<TeSlice> slices;
- int nullValues = 0;
- if (grouping_.groupMode_ == TeRasterSlicing)
- {
- int b = atoi(grouping_.groupAttribute_.name_.c_str());
- if (!remoteTheme_->layer()->raster() ||
- b < 0 ||
- b > remoteTheme_->layer()->raster()->params().nBands() ||
- grouping_.groupNumSlices_ <= 0)
- return false;
-
- if (grouping_.groupMaxVal_ == TeMINFLOAT)
- grouping_.groupMaxVal_ = remoteTheme_->layer()->raster()->params().vmax_[b];
-
- if (grouping_.groupMinVal_ == TeMAXFLOAT)
- grouping_.groupMinVal_ = remoteTheme_->layer()->raster()->params().vmin_[b];
-
- TeGroupByEqualStep(grouping_.groupMinVal_, grouping_.groupMaxVal_,
- grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- }
- else
- {
- if(grouping_.groupAttribute_.name_.empty())
- return false;
-
- TeDatabasePortal* portal = db->getPortal();
- string query;
- bool normal = false;
- string aggrFunc = "";
- if(grouping_.groupFunction_.empty())
- aggrFunc = " MIN";
- else
- aggrFunc = grouping_.groupFunction_;
-
- if(grouping_.groupNormAttribute_.empty())
- {
- query = " SELECT "+ aggrFunc +"("+ grouping_.groupAttribute_.name_ +")";
- }
- else
- {
- query = " SELECT "+ aggrFunc +"("+ grouping_.groupAttribute_.name_ +") / "+ aggrFunc +"("+ grouping_.groupNormAttribute_ + ")";
- normal = true;
- }
- query += sqlGridFrom();
- query += " GROUP BY " + remoteTheme_->collectionTable() + ".c_object_id";
- if(!portal->query(query) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- vector<double> dValues; //inputvect
- vector<string> sValues; //svec
- double mean, sum;
- mean = sum = 0.;
- do
- {
- string val = portal->getData(0);
- string valNorm = Te2String(atof(val.c_str()), grouping_.groupPrecision_);
-
- if (!val.empty())
- {
- if(grouping_.groupMode_== TeUniqueValue)
- {
- if(normal)
- sValues.push_back(valNorm);
- else
- sValues.push_back(val);
- }
- else
- {
- dValues.push_back(atof(valNorm.c_str()));
- sum += atof(valNorm.c_str());
- }
-
- }
- else
- nullValues++;
- }while(portal->fetchRow());
-
- delete portal;
-
- if(dValues.empty() && sValues.empty())
- return false;
-
- if(grouping_.groupMode_== TeEqualSteps)
- TeGroupByEqualStep(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- else if(grouping_.groupMode_== TeQuantil)
- TeGroupByQuantil(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- else if(grouping_.groupMode_== TeStdDeviation)
- {
- string m = Te2String(mean);
- TeGroupByStdDev(dValues.begin(), dValues.end(), grouping_.groupStdDev_, slices, m, grouping_.groupPrecision_);
- }
- else if(grouping_.groupMode_== TeUniqueValue)
- {
- if(grouping_.groupFunction_ == "COUNT")
- TeGroupByUniqueValue(sValues, TeINT, slices, grouping_.groupPrecision_);
- else
- TeGroupByUniqueValue(sValues, grouping_.groupAttribute_.type_, slices, grouping_.groupPrecision_);
- }
-
- if (dValuesVec)
- {
- for (i = 0; i < dValues.size(); ++i)
- dValuesVec->push_back(dValues[i]);
- }
- }
- if(grouping_.groupNullAttr_ && nullValues > 0)
- {
- TeSlice ps;
- ps.count_ = nullValues;
- ps.from_ = "Missing Data";
- slices.push_back(ps);
- grouping_.groupNumSlices_ = slices.size() - 1;
- }
- else
- grouping_.groupNumSlices_ = slices.size();
-
- legend_.clear();
- for(i=0; i<slices.size(); ++i)
- {
- TeLegendEntry legend(slices[i]);
- legend.group(i);
- legend.theme(id());
- legend_.push_back(legend);
- }
- return true;
-}
-
-bool TeExternalTheme::buildGrouping(const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec)
-{
- TeDatabase* db = remoteTheme_->layer()->database();
-
- if(!db || chr == TeNOCHRONON)
- return false;
-
- grouping_ = g;
-
- unsigned int i;
- vector<TeSlice> slices;
- vector<double> dValues; //inputvect
- vector<string> sValues; //svec
- double mean, sum;
- mean = sum = 0.;
- int nullValues = 0;
- string val;
-
- if (grouping_.groupMode_ == TeRasterSlicing)
- {
- int b = atoi(grouping_.groupAttribute_.name_.c_str());
- if (!remoteTheme_->layer()->raster() ||
- b < 0 ||
- b > remoteTheme_->layer()->raster()->params().nBands() ||
- grouping_.groupNumSlices_ <= 0)
- return false;
-
- if (grouping_.groupMaxVal_ == TeMINFLOAT)
- grouping_.groupMaxVal_ = remoteTheme_->layer()->raster()->params().vmax_[b];
-
- if (grouping_.groupMinVal_ == TeMAXFLOAT)
- grouping_.groupMinVal_ = remoteTheme_->layer()->raster()->params().vmin_[b];
-
- TeGroupByEqualStep(grouping_.groupMinVal_, grouping_.groupMaxVal_,
- grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- }
- else
- {
- string func;
- TeStatisticType statType = TeNOSTATISTIC;
- if (grouping_.groupMode_ == TeUniqueValue && grouping_.groupAttribute_.type_ == TeSTRING)
- func = "MIN";
- else
- func = grouping_.groupFunction_;
-
- if (func == "MIN")
- statType = TeMINVALUE;
- else if (func == "MAX")
- statType = TeMAXVALUE;
- else if (func == "MEAN")
- statType = TeMEAN;
- else if (func == "SUM")
- statType = TeSUM;
- else if (func == "COUNT")
- statType = TeCOUNT;
-
- // Set the flag that indicates the geometries must not be loaded
- bool loadGeometries = false;
-
- // Insert the attributes in a multimap that relates the attribute
- // representation and its statistic type
- TeGroupingAttr attrMMap;
- std::pair<TeAttributeRep, TeStatisticType> attr1 (
- TeAttributeRep(grouping_.groupAttribute_), statType);
- attrMMap.push_back(attr1);
-
- // Set querier parameters
- TeQuerierParams querierParams(loadGeometries, attrMMap);
- querierParams.setParams(this, chr);
-
- TeQuerier querier(querierParams);
-
- // Load instances based on the querier parameters given
- int numFrames = querier.getNumTimeFrames();
- TeSTInstance sti;
- string objId;
- TePropertyVector vec;
- mapObjValVec.resize(numFrames);
-
- for (int frame = 0; frame < numFrames; ++frame)
- {
- if (querier.loadInstances(frame) == false)
- continue;
-
- // Traverse all the instances
- while(querier.fetchInstance(sti))
- {
- objId = sti.objectId();
- vec = sti.getPropertyVector();
- val = vec[0].value_;
- dValues.push_back(atof(val.c_str()));
- sValues.push_back(val);
- map<string, string>& objValMap = mapObjValVec[frame];
- objValMap.insert(make_pair(objId, val));
- }
- }
-
- if(grouping_.groupMode_== TeEqualSteps)
- TeGroupByEqualStep(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- else if(grouping_.groupMode_== TeQuantil)
- TeGroupByQuantil(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- else if(grouping_.groupMode_== TeStdDeviation)
- {
- string m = Te2String(mean);
- TeGroupByStdDev(dValues.begin(), dValues.end(), grouping_.groupStdDev_, slices, m, grouping_.groupPrecision_);
- }
- else if(grouping_.groupMode_== TeUniqueValue)
- {
- if(grouping_.groupFunction_ == "COUNT")
- TeGroupByUniqueValue(sValues, TeINT, slices, grouping_.groupPrecision_);
- else
- TeGroupByUniqueValue(sValues, grouping_.groupAttribute_.type_, slices, grouping_.groupPrecision_);
- }
- }
-
- if(grouping_.groupNullAttr_ && nullValues > 0)
- {
- TeSlice ps;
- ps.count_ = nullValues;
- ps.from_ = "Missing Data";
- slices.push_back(ps);
- grouping_.groupNumSlices_ = slices.size() - 1;
- }
- else
- grouping_.groupNumSlices_ = slices.size();
-
- legend_.clear();
- for(i=0; i<slices.size(); ++i)
- {
- TeLegendEntry legend(slices[i]);
- legend.group(i);
- legend.theme(id());
- legend_.push_back(legend);
- }
-
- return true;
-}
-
-bool TeExternalTheme::saveGrouping(TeSelectedObjects selectedObjects)
-{
- return TeTheme::saveGrouping(sourceDB_, selectedObjects);
-}
-
-bool TeExternalTheme::saveLegendInCollection(TeSelectedObjects selectedObjects, std::string objectId)
-{
- return saveLegendInCollection(sourceDB_, selectedObjects, objectId);
-}
-
-bool TeExternalTheme::saveLegendInCollection(TeDatabase* db, TeSelectedObjects /* selectedObjects */, std::string objectId)
-{
- unsigned int i;
- if(grouping_.groupMode_ == TeNoGrouping)
- return false;
-
- TeAttrDataType type = grouping_.groupAttribute_.type_;
- TeLegendEntryVector legVec = legend_;
- string groupingAttr = grouping_.groupAttribute_.name_;
-
- string collectionTableRemote = remoteTheme_->collectionTable();
- string func;
-
- if(grouping_.groupFunction_.empty())
- func = " MIN";
- else
- func = grouping_.groupFunction_;
-
- if(grouping_.groupFunction_ == "COUNT")
- type = TeINT;
-
- string query = "SELECT MIN(" + collectionTableRemote + ".c_object_id)";
- if(grouping_.groupNormAttribute_.empty())
- query += ", "+ func +"(" + groupingAttr + ")" + remoteTheme_->sqlGridFrom();
- else
- query += ", "+ func +"(" + groupingAttr + ") / "+ func +"(" + grouping_.groupNormAttribute_ + ")" + remoteTheme_->sqlGridFrom();
-
- query += " GROUP BY " + collectionTableRemote + ".c_object_id";
-
- map<int, vector<string> > legMap;
-
- TeDatabasePortal* portal = remoteTheme_->layer()->database()->getPortal();
- if(portal->query(query) == false)
- {
- delete portal;
- return false;
- }
-
- vector<string> idVec;
- vector<string> nullIdVec;
- vector<string> valVec;
- while(portal->fetchRow())
- {
-
- string val = portal->getData(1);
- string oid = portal->getData(0);
- if (val.empty() == false)
- {
- idVec.push_back(oid);
- valVec.push_back(val);
- }
- else
- nullIdVec.push_back(oid);
- }
- if (grouping_.groupMode_ == TeUniqueValue)
- {
- unsigned int j = 0;
- while( j < idVec.size())
- {
- string val = valVec[j];
- string oid = idVec[j];
- if(type == TeREAL)
- {
- double a = atof(val.c_str());
- val = Te2String(a, grouping_.groupPrecision_);
- }
- else if(type == TeINT)
- {
- int a = atoi(val.c_str());
- val = Te2String(a);
- }
-
- unsigned int siz = legend_.size();
- if(grouping_.groupNullAttr_ && nullIdVec.size() > 0)
- --siz;
- for(i=0; i < siz; i++)
- {
- TeLegendEntry& leg = legend_[i];
- if(val == leg.from())
- {
- legMap[leg.id()].push_back(oid);
- break;
- }
- }
- j++;
- }
- }
- else
- {
- unsigned int j = 0;
- while(j < idVec.size())
- {
- string val = valVec[j];
- string oid = idVec[j];
- if(type == TeREAL)
- {
- double a = atof(val.c_str());
- val = Te2String(a, grouping_.groupPrecision_);
- }
-
- unsigned int siz = legend_.size();
- if(grouping_.groupNullAttr_ && !nullIdVec.empty())
- --siz;
- for(i=0; i < siz; i++)
- {
- TeLegendEntry& leg = legend_[i];
- int f = leg.from().find("mean");
- if(f >= 0)
- continue;
- double dval = atof(val.c_str());
- double dfrom = atof(leg.from().c_str());
- double dto = atof(leg.to().c_str());
- if(i < legend_.size()-1)
- {
- if(dval >= dfrom && dval < dto)
- {
- legMap[leg.id()].push_back(oid);
- break;
- }
- }
- else
- {
- if(dval >= dfrom && dval <= dto)
- {
- legMap[leg.id()].push_back(oid);
- break;
- }
- }
- }
- j++;
- }
- }
- delete portal;
-
- int legId = defaultLegend_.id();
- if (grouping_.groupNullAttr_)
- legId = legend_[legend_.size()-1].id();
- for(i = 0; i < nullIdVec.size(); ++i)
- {
- string oid = nullIdVec[i];
- legMap[legId].push_back(oid);
- }
-
- vector<string> svec;
- map<int, vector<string> > :: iterator it = legMap.begin();
- while(it != legMap.end())
- {
- // --- Generate In Clauses ----
- unsigned int i, j, k, size, chunkSize = 200, nChunks;
- string inClause;
- size = it->second.size();
- if (size % chunkSize)
- nChunks = size / chunkSize + 1;
- else
- nChunks = size / chunkSize;
-
- j = 0;
- for (k = 0; k < nChunks; ++k)
- {
- i = 0;
- inClause = "(";
- while (j < size && i < chunkSize)
- {
- inClause += "'" + db->escapeSequence(it->second[j]) + "',";
- i++;
- j++;
- }
- inClause[inClause.size() - 1] = ')';
- svec.push_back(inClause);
- }
-
- //--- generateInClause
-
- for(i=0; i<svec.size(); ++i)
- {
- string up = "UPDATE " + collectionTable_ + " SET c_legend_id = " + Te2String(it->first);
- up += " WHERE c_object_id IN " + svec[i];
- if (!objectId.empty())
- up += " AND c_object_id='"+objectId+"'";
- if(db->execute(up) == false)
- continue;
- }
- it++;
- svec.clear();
- }
- if(legend_.size())
- visibleRep_ = visibleRep_ | 0x40000000;
- else
- visibleRep_ = visibleRep_ | 0xbfffffff;
- string upVis = "UPDATE te_theme SET visible_rep=" + Te2String(visibleRep_) + " WHERE theme_id=" + Te2String(id());
-
- if(!db->execute(upVis))
- return false;
-
- loadObjectLegendMap();
-
- return true;
-}
-
-void TeExternalTheme::setLegendsForObjects()
-{
-}
-
-bool TeExternalTheme::generateLabelPositions(const std::string& /* objectId */)
-{
- throw;
- return false;
-}
-
-bool TeExternalTheme::deleteGrouping()
-{
- TeDatabase* db = sourceDB_;
- if(!db)
- return false;
-
- resetGrouping();
-
- //delete te_legend table
- if(!db->deleteLegend (this->id()))
- return false;
-
- //delete te_grouping table
- string sql = "DELETE FROM te_grouping WHERE theme_id= "+ Te2String(this->id());
- db->execute (sql);
-
- return true;
-}
-
-void TeExternalTheme::createRasterVisual(TeRaster* rst)
-{
- if (rasterVisual_)
- delete rasterVisual_;
-
- if (!rst)
- rst = remoteTheme_->layer()->raster();
-
- if (!rst)
- return;
-
- rasterVisual_ = new TeRasterTransform();
-
- if (rst->params().photometric_[0] == TeRasterParams::TePallete) // raster palette -> uses its palette
- {
- rasterVisual_->setTransfFunction(&TeRasterTransform::Pallete2ThreeBand);
- rasterVisual_->setLutSize(rst->params().lutr_.size());
- return;
- }
-
- if (visibleRep_ & 0x40000000 && // sliced raster -> generate the
- grouping_.groupMode_ == TeRasterSlicing) // appropriate palette
- {
- int band = atoi(grouping_.groupAttribute_.name_.c_str());
- rasterVisual_->setSrcBand(band);
- if (rst->params().dataType_[band] != TeUNSIGNEDCHAR)
- rasterVisual_->generateLUT(legend_, 1024, defaultLegend_.visual(TePOLYGONS)->color());
- else
- rasterVisual_->generateLUT(legend_, 256, defaultLegend_.visual(TePOLYGONS)->color());
- rasterVisual_->setTransfFunction(&TeRasterTransform::LUT2ThreeBand);
- return;
- }
-
- if (rst->params().dataType_[0] != TeUNSIGNEDCHAR) // non unsigned char -> generate linear transformation
- rasterVisual_->setLinearTransfParameters(rst->params().vmin_[0],rst->params().vmax_[0], 0, 255);
-
- if (rst->params().nBands() == 1)
- rasterVisual_->setTransfFunction(&TeRasterTransform::Mono2ThreeBand);
- else if (rst->params().nBands() == 3)
- rasterVisual_->setTransfFunction(&TeRasterTransform::ThreeBand2RGB);
- else
- rasterVisual_->setTransfFunction(&TeRasterTransform::Band2Band);
-}
-
-bool TeExternalTheme::addThemeTable(TeTable& table)
-{
- if( remoteTheme_ )
- return remoteTheme_->addThemeTable(table);
-
- return false;
-}
-
-void TeExternalTheme::addThemeTable(string tableName)
-{
- if( remoteTheme_ )
- return remoteTheme_->addThemeTable(tableName);
-
- return;
-}
-
-bool TeExternalTheme::isThemeTable(int tableId)
-{
- if( remoteTheme_ )
- return remoteTheme_->isThemeTable(tableId);
-
- return false;
-}
-
-bool TeExternalTheme::isThemeTable(string tableName)
-{
- if( remoteTheme_ )
- return remoteTheme_->isThemeTable(tableName);
-
- return false;
-}
-
-TeAttrTableVector& TeExternalTheme::attrTables()
-{
- if( remoteTheme_ )
- return remoteTheme_->attrTables();
- attTableVector_.clear();
- return attTableVector_;
-}
-
-bool TeExternalTheme::setAttTables(TeAttrTableVector& attrs)
-{
- if( remoteTheme_ )
- return remoteTheme_->setAttTables(attrs);
-
- return false;
-}
-
-bool TeExternalTheme::getAttTables(TeAttrTableVector& attrs, TeAttrTableType attType)
-{
- if(remoteTheme_)
- return remoteTheme_->getAttTables(attrs, attType);
-
- return false;
-}
-
-bool TeExternalTheme::getTable(TeTable& table, const string tableName)
-{
- if(remoteTheme_)
- return remoteTheme_->getTable(table, tableName);
-
- return false;
-}
-
-void TeExternalTheme::clearAttTableVector()
-{
- if(remoteTheme_)
- remoteTheme_->clearAttTableVector();
-}
-
-bool TeExternalTheme::getTemporalTable(TeTable& table)
-{
- if(remoteTheme_)
- return remoteTheme_->getTemporalTable(table);
-
- return false;
-}
-
-bool TeExternalTheme::removeThemeTable(unsigned int index)
-{
- if(remoteTheme_)
- return remoteTheme_->removeThemeTable(index);
-
- return false;
-}
-
-string TeExternalTheme::getTableName(const string& attrName)
-{
- if(remoteTheme_)
- return remoteTheme_->getTableName(attrName);
-
- return "";
-}
-
-string TeExternalTheme::getAttribute(unsigned int index)
-{
- if(remoteTheme_)
- return remoteTheme_->getAttribute(index);
-
- return "";
-}
-
-
-bool TeExternalTheme::loadThemeTables()
-{
- if(!remoteTheme_)
- return false;
-
- bool result = remoteTheme_->loadThemeTables();
-
- if(result)
- {
- clearAttTableVector();
- attrTables() = remoteTheme_->attrTables();
- }
-
- return result;
-}
-
-
-TeAttributeList TeExternalTheme::sqlAttList()
-{
- if(remoteTheme_)
- return remoteTheme_->sqlAttList();
-
- return TeAttributeList();
-}
-
-void TeExternalTheme::clearAttList()
-{
- if(remoteTheme_)
- return remoteTheme_->clearAttList();
-}
-
-TeAttributeList TeExternalTheme::sqlNumAttList()
-{
- if(remoteTheme_)
- return remoteTheme_->sqlNumAttList();
-
- return TeAttributeList();
-}
-
-void TeExternalTheme::clearNumAttList()
-{
- if(remoteTheme_)
- remoteTheme_->clearNumAttList();
-}
-
-string TeExternalTheme::sqlJoin()
-{
- if(remoteTheme_)
- return remoteTheme_->sqlJoin();
-
- return "";
-}
-
-string TeExternalTheme::sqlFrom()
-{
- if(remoteTheme_)
- return remoteTheme_->sqlFrom();
-
- return "";
-}
-
-vector<string>& TeExternalTheme::aliasVector()
-{
- if(remoteTheme_)
- return remoteTheme_->aliasVector();
- aliasVector_.clear();
- return aliasVector_;
-}
-
-void TeExternalTheme::loadAliasVector()
-{
- if(remoteTheme_)
- return remoteTheme_->loadAliasVector();
-
- return;
-}
-
-void TeExternalTheme::loadAttrLists()
-{
- if(!remoteTheme_)
- return;
-
- remoteTheme_->loadAttrLists();
-
- sqlAttList_.clear();
- sqlNumAttList_.clear();
-
- sqlAttList_ = remoteTheme_->sqlAttList();
- sqlNumAttList_ = remoteTheme_->sqlNumAttList();
-
-}
-
-bool TeExternalTheme::locatePolygon(TeCoord2D &pt, TePolygon &polygon, const double& tol)
-{
- if(!remoteTheme_)
- return false;
-
- return remoteTheme_->locatePolygon(pt, polygon, tol);
-}
-
-bool TeExternalTheme::locatePolygonSet(TeCoord2D &pt, double tol, TePolygonSet &polygons)
-{
- if(!remoteTheme_)
- return false;
-
- return remoteTheme_->locatePolygonSet(pt, tol, polygons);
-}
-
-bool TeExternalTheme::locateLine(TeCoord2D &pt, TeLine2D &line, const double& tol)
-{
- if(!remoteTheme_)
- return false;
-
- return remoteTheme_->locateLine(pt, line, tol);
-}
-
-bool TeExternalTheme::locatePoint(TeCoord2D &pt, TePoint &point, const double& tol)
-{
- if(!remoteTheme_)
- return false;
-
- return remoteTheme_->locatePoint(pt, point, tol);
-}
-
-bool TeExternalTheme::locateCell(TeCoord2D &pt, TeCell &c, const double& tol)
-{
- if(!remoteTheme_)
- return false;
-
- return remoteTheme_->locateCell(pt, c, tol);
-}
-
-bool TeExternalTheme::hasObjectsWithoutGeometries(TeGeomRep geomRep)
-{
- if(!remoteTheme_)
- return false;
-
- return remoteTheme_->hasObjectsWithoutGeometries(geomRep);
-}
-
-bool TeExternalTheme::removeObjectsWithoutGeometries(TeGeomRep geomRep)
-{
- if(!remoteTheme_)
- return false;
-
- return remoteTheme_->removeObjectsWithoutGeometries(geomRep);
-}
-
-int TeExternalTheme::createExternalThemeTable(TeDatabase* sourceDB)
-{
- if(!sourceDB)
- return 0;
-
- if(sourceDB->tableExist("te_external_theme"))
- return -1;
-
- TeAttributeList attList;
-
- TeAttribute att1;
- att1.rep_.name_ = "theme_id";
- att1.rep_.isAutoNumber_ = false;
- att1.rep_.isPrimaryKey_ = true;
- att1.rep_.null_ = false;
- att1.rep_.type_ = TeINT;
- att1.rep_.numChar_ = 0;
- attList.push_back(att1);
-
- TeAttribute att2;
- att2.rep_.name_ = "database_id";
- att2.rep_.isAutoNumber_ = false;
- att2.rep_.isPrimaryKey_ = false;
- att2.rep_.null_ = false;
- att2.rep_.type_ = TeINT;
- att2.rep_.numChar_ = 0;
- attList.push_back(att2);
-
- TeAttribute att3;
- att3.rep_.name_ = "external_theme_id";
- att3.rep_.isAutoNumber_ = false;
- att3.rep_.isPrimaryKey_ = false;
- att3.rep_.null_ = false;
- att3.rep_.type_ = TeINT;
- att3.rep_.numChar_ = 0;
- attList.push_back(att3);
-
- if(!sourceDB->createTable("te_external_theme", attList))
- return 0;
-
- return 1;
-}
-
-bool TeExternalTheme::populateCollection(std::string /* objectId */)
-{
- throw;
- return false;
-}
-
-void TeExternalTheme::createLegendMapId(std::map<int, int>& mapIdLegend)
-{
- mapIdLegend.clear();
-
- mapIdLegend[remoteTheme_->outOfCollectionLegend().id()] = outOfCollectionLegend().id();
- mapIdLegend[remoteTheme_->withoutDataConnectionLegend().id()] = withoutDataConnectionLegend().id();
- mapIdLegend[remoteTheme_->defaultLegend().id()] = defaultLegend().id();
- mapIdLegend[remoteTheme_->pointingLegend().id()] = pointingLegend().id();
- mapIdLegend[remoteTheme_->queryLegend().id()] = queryLegend().id();
- mapIdLegend[remoteTheme_->queryAndPointingLegend().id()] = queryAndPointingLegend().id();
-
- for (int i = 0; i < remoteTheme_->grouping().groupNumSlices_; ++i)
- {
- mapIdLegend[remoteTheme_->legend()[i].id()] = legend()[i].id();
- }
-
- return;
-}
-
-bool TeExternalTheme::copyRemoteCollection(std::map<int, int>& mapIdLegend)
-{
- if(mapIdLegend.empty())
- return false;
-//copy collectionTable
- TeDatabasePortal* remotePortal = remoteTheme_->layer()->database()->getPortal();
- string strSQL = "SELECT * from ";
- strSQL += remoteTheme_->collectionTable();
-
- if(remotePortal->query(strSQL))
- {
- while(remotePortal->fetchRow())
- {
- string c_obj_id = remotePortal->getData(0);
- int c_leg_id = atoi(remotePortal->getData(1));
- string lab_x = remotePortal->getData(2);
- string lab_y = remotePortal->getData(3);
-// string c_leg_own = remotePortal->getData(4);
- string c_leg_own = "0";
- string c_obj_stat = remotePortal->getData(5);
-
- int new_c_leg_id = mapIdLegend[c_leg_id];
-
- string strINS = "INSERT INTO ";
- strINS += this->collectionTable();
- strINS += " (c_object_id, c_legend_id, label_x, label_y, c_legend_own, c_object_status) ";
- strINS += "VALUES (";
- strINS += c_obj_id;
- strINS += ", ";
- strINS += Te2String(new_c_leg_id);
- strINS += ", ";
- strINS += lab_x;
- strINS += ", ";
- strINS += lab_y;
- strINS += ", ";
- strINS += c_leg_own;
- strINS += ", ";
- strINS += c_obj_stat;
- strINS += ")";
-
- if(!sourceDB_->execute(strINS))
- return false;
- }
- }
- else
- return false;
-
- remotePortal->freeResult();
- delete remotePortal;
-
-
-//copy collectionTableAux
- TeDatabasePortal* remotePortalAux = remoteTheme_->layer()->database()->getPortal();
- string strSQLAux = "SELECT * from ";
- strSQLAux += remoteTheme_->collectionAuxTable();
-
- if(remotePortalAux->query(strSQLAux))
- {
- while(remotePortalAux->fetchRow())
- {
- string c_obj_id = remotePortalAux->getData(0);
- string unique_id = remotePortalAux->getData(1);
- string grid_status = remotePortalAux->getData(2);
-
- string strINSAux = "INSERT INTO ";
- strINSAux += this->collectionAuxTable();
- strINSAux += " (object_id, unique_id, grid_status) ";
- strINSAux += "VALUES (";
- strINSAux += c_obj_id;
- strINSAux += ", ";
- strINSAux += unique_id;
- strINSAux += ", ";
- strINSAux += grid_status;
- strINSAux += ")";
-
- if(!sourceDB_->execute(strINSAux))
- return false;
- }
- }
- else
- return false;
-
- remotePortalAux->freeResult();
- delete remotePortalAux;
-
- return true;
-}
-
-
-
-bool TeExternalTheme::getRemoteThemeInfo(int& remoteThemeId, int& databaseId)
-{
- if(!sourceDB_)
- return false;
-
- std::string strSQL = " SELECT * FROM te_external_theme, te_database_connection ";
- strSQL += " WHERE te_external_theme.database_id = te_database_connection.connection_id ";
- strSQL += " AND theme_id = " + Te2String(id());
-
- TeDatabasePortal* dbPortal = sourceDB_->getPortal();
-
- if(!dbPortal)
- return false;
-
- if(!dbPortal->query(strSQL) || !dbPortal->fetchRow())
- {
- dbPortal->freeResult();
- delete dbPortal;
- return false;
- }
-
- databaseId = dbPortal->getInt("database_id");
- remoteThemeId = dbPortal->getInt("external_theme_id");
- string dbmsName = dbPortal->getData("dbms_name");
- string hostName = dbPortal->getData("host_name");
- string dbName = dbPortal->getData("database_name");
- string userName = dbPortal->getData("user_name");
- string userPass = dbPortal->getData("user_password");
- int port = dbPortal->getInt("port_number");
-
- TeDBConnection dbConn(hostName, dbName, userName, dbmsName, port, userPass, databaseId);
- dbConn.setDatabase(0);
- setRemoteDBConnection(dbConn);
-
- dbPortal->freeResult();
- delete dbPortal;
- return true;
-}
-
-bool
-TeExternalTheme::loadMetadata(TeDatabase* db)
-{
- if(remoteTheme_ || !db)
- return false;
-
- int remoteThemeId = -1;
- int remoteDBId = -1;
-
- this->setSourceDatabase(db);
-
- if(!getRemoteThemeInfo(remoteThemeId, remoteDBId))
- return false;
-
- TeDatabase* remotedb = TeDBConnectionsPool::instance().getDatabase(getRemoteDBConnection().getDbKey());
-
- if(!remotedb || !remotedb->isConnected())
- return false;
-
- TeThemeMap::iterator itTheme = remotedb->themeMap().find(remoteThemeId);
-
- if(itTheme != remotedb->themeMap().end())
- {
-// is theme already loaded?
- if(itTheme->second->getProductId()!=TeTHEME)
- return false;
- remoteTheme_ = static_cast<TeTheme*>(itTheme->second);
- }
- else
- {
-// if theme is not loaded... we load it.
- remoteTheme_ = new TeTheme();
- remoteTheme_->id(remoteThemeId);
- if(!remotedb->loadTheme(remoteTheme_))
- return false;
- }
-
- loadObjectLegendMap();
- return true;
-}
-
-bool TeExternalTheme::saveMetadata(TeDatabase* db)
-{
- if(!remoteTheme_ || !remoteTheme_->layer() || !remoteTheme_->layer()->database())
- return false;
-
- int idDatabase = this->getRemoteDBConnection().getId();
- int themeId = this->id();
- int remoteThemeId = remoteTheme_->id();
-
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- string sql = "SELECT * FROM te_external_theme WHERE theme_id = "+ Te2String(themeId);
- bool isUpdate = false;
- if(!portal->query(sql))
- {
- delete portal;
- return false;
- }
- if(portal->fetchRow())
- isUpdate = true;
- delete portal;
-
- string strSQL;
- if(isUpdate)
- {
- strSQL = "UPDATE te_external_theme SET ";
- strSQL += " theme_id = "+ Te2String(themeId);
- strSQL += ", ";
- strSQL += " database_id = "+ Te2String(idDatabase);
- strSQL += ", ";
- strSQL += " external_theme_id = "+ Te2String(remoteThemeId);
- strSQL += " WHERE theme_id = "+ Te2String(themeId);
- }
- else
- {
- strSQL = "INSERT INTO te_external_theme (theme_id, database_id, external_theme_id) VALUES (";
- strSQL += Te2String(themeId);
- strSQL += ", ";
- strSQL += Te2String(idDatabase);
- strSQL += ", ";
- strSQL += Te2String(remoteThemeId);
- strSQL += ")";
- }
-
- if(!db->execute(strSQL))
- return false;
-
- return true;
-}
-
-bool TeExternalTheme::eraseMetadata(TeDatabase* db)
-{
- int themeId = this->id();
-
- string strSQL;
- strSQL = " DELETE FROM te_external_theme ";
- strSQL += " WHERE theme_id = "+ Te2String(themeId);
-
- if(!db->execute(strSQL))
- return false;
- return true;
-}
-
diff --git a/src/terralib/kernel/TeExternalTheme.h b/src/terralib/kernel/TeExternalTheme.h
deleted file mode 100644
index 473260c..0000000
--- a/src/terralib/kernel/TeExternalTheme.h
+++ /dev/null
@@ -1,422 +0,0 @@
-/************************************************************************************
- TerraLib - a library for developing GIS applications.
-Copyright � 2001-2006 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/** \file TeExternalTheme.h
- \brief This file contains direct implementation of TeTheme in order to
- support themes from another TerraLib databases (remote databases).
-*/
-
-#ifndef __TERRALIB_INTERNAL_EXTERNALTHEME_H
-#define __TERRALIB_INTERNAL_EXTERNALTHEME_H
-
-#include <map>
-#include <string>
-
-#include "TeTheme.h"
-#include "TeDBConnection.h"
-
-/** \fn bool TeLoadConnectionsInfo(TeDatabase* sourceDB)
- \brief Loads all connections information from source database and populates Remote theme database index.
- \param sourceDB A connection to a TerraLib database that stores information about others databases that can be used by remote themes. (Input)
- */
-TL_DLL bool TeLoadConnectionsInfo(TeDatabase* sourceDB);
-
-
-//! A class that implements the external theme concept
-/*!
- A external theme is a theme stored in a remote TerraLib database.
- Some information about the external theme is stored in the local database, but
- its geometries and attributes are stored in the remote database.
-
- \sa TeTheme
-
- */
-class TL_DLL TeExternalTheme : public TeTheme
-{
- public:
-
- //! Constructor.
- TeExternalTheme(TeDatabase* sourceDB, const string& name = "", TeViewNode* parent = 0, const int& view = 0, const int& id = 0);
-
- //! Constructor
- TeExternalTheme(const TeViewNodeParams& params);
-
- //! Destructor.
- virtual ~TeExternalTheme();
-
- //! Copy constructor
- TeExternalTheme(const TeExternalTheme& rhs);
-
- //! Operator =
- TeExternalTheme& operator=(TeExternalTheme& rhs);
-
-
- /** @name Remote Theme Accessor Methods
- * Methods related to the remote theme reference.
- */
- //@{
- virtual void setSourceDatabase(TeDatabase* db);
-
- virtual TeDatabase* getSourceDatabase();
-
- virtual TeTheme* getRemoteTheme() const;
-
- virtual void setRemoteTheme(TeTheme* theme);
-
- virtual string getRemoteThemeName();
- //@}
-
-
- /** @name Object status containers
- * Methods to handle object status containers
- */
- //@{
- virtual void loadObjectLegendMap();
-
- virtual int getGridStatus(const int uniqueId, const std::string objectId);
-
- virtual int getObjectStatus(const std::string objectId);
-
- virtual bool setObjectLegendStatusMap(const std::string objId, const int status);
-
- virtual bool setObjectGridStatusMap(const std::string objId, const int uniqueId, const int status);
- //@}
-
- /** @name Layer accessor methods
- * Methods related to the layer that gives origin to this theme.
- */
- //@{
-
- /** \brief Returns the identification of the source layer.
- \note In a Remote Theme this will be always -1.
- */
- virtual int layerId();
-
- /** \brief Sets the identification of the source layer.
- \param i Layer identification value that will be used to set the source layer. (Input)
- \note In a Remote Theme this method does nothing.
- */
- virtual void layerId(int i);
-
- /** \brief Sets the layer that is the source of objects of the theme.
- \param layer A pointer to a TeLayer. (Input)
- */
- virtual void layer(TeLayer* layer);
-
- /** \brief Returns a pointer to the layer from which the theme get its objects.
- \note In a Remote Theme this method returns a NULL pointer.
- */
- virtual TeLayer* layer();
-
- //! Returns a pointer to the projection of the remote layer
- virtual TeProjection* getThemeProjection();
-
- //@}
-
- /** @name
- * Methods related to the restrictions over the theme used to generate this theme
- */
- //@{
-
- /** \brief Verifies if this theme has any kind of restrictions.
- \note In a Remote Theme this method always returns FALSE.
- */
- virtual bool hasRestriction();
-
- /** \brief Returns if there is an attribute restriction.
- \note In a Remote Theme this method always returns FALSE.
- */
- virtual bool hasAttrRest();
-
- /** \brief Returns TRUE if there is a temporal restriction defined in the theme.
- \note In a Remote Theme this method always returns FALSE.
- */
- virtual bool hasTemporalRest();
-
- /** \brief Returns TRUE if this theme has a spatial restriction.
- \note In a Remote Theme this method always returns FALSE.
- */
- virtual bool hasSpatialRest();
-
- /** \brief Returns the clause WHERE derived from the combination of all restricitions (spatial, attribute and temporal).
- \note In a Remote Theme this method always returns an empty string.
- */
- virtual string sqlWhereRestrictions(TeRepresentation* rep = 0);
-
- //@}
-
- /** @name Collection
- * Methods related to the materialization in the database of the theme as a collection of objects
- */
- //@{
-
- /** \brief Fills the sqlGridJoin_ and sqlGridFrom_ statements according to the status of the database.
- \note In a Remote Theme this method does nothing.
- */
- virtual void loadTablesJoin(const string& geomTable = "");
-
- /** \brief Returns a SQL JOIN statement to get all the attributes of the theme objects,
- the attributes of the collection table, and the attributes of the extended
- collection table.
- \note In a Remote Theme this method returns an empty string.
- */
- virtual string sqlGridJoin();
-
- /** \brief Returns a FROM clause of a SQL statement to get attributes of the theme objects,
- the attributes of the collection table, and the attributes of the
- extended collection table .
- \note In a Remote Theme this method returns an empty string.
- */
- virtual string sqlGridFrom(const string& geomTable="");
-
- //! Save the the theme parameters in the database.
- virtual bool save(TeDatabase* db);
-
- //! Save the the theme parameters in the database.
- virtual bool save();
-
- /** \brief Create the auxiliar collection table used to represent objects with multiple versions in time.
- \note In a Remote Theme this method creates a local auxiliary collection table.
- */
- virtual bool createCollectionAuxTable();
-
- /** \brief Populate the auxiliar collection table used to represent objects with multiple versions in time.
- \note In a Remote Theme this method populates the local auxiliary collection.
- */
- virtual bool populateCollectionAux(std::string objectId = "");
-
- //@}
-
- //! Save the grouping parameters in memory when there is no chronon.
- virtual bool buildGrouping(const TeGrouping& g, TeSelectedObjects selectedObjects = TeAll,
- vector<double>* dValuesVec = 0);
-
- //! Save the grouping parameters in memory when there is chronon.
- virtual bool buildGrouping(const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec);
-
- //! Build the grouping and associate each object to its group in the collection table.
- virtual bool saveGrouping(TeSelectedObjects selectedObjects = TeAll);
-
- //! Save the theme grouping legends in the collection table.
- virtual bool saveLegendInCollection(TeSelectedObjects selectedObjects = TeAll, std::string objectId = "");
-
- //! Save the theme grouping legends in the collection table
- virtual bool saveLegendInCollection(TeDatabase* db, TeSelectedObjects selectedObjects = TeAll, std::string objectId = "");
-
- ///! Set the legend id for each object of the theme.
- virtual void setLegendsForObjects();
-
- //! Generates a optimized position (x,y) in the spatial extention of each object to position label or graphs.
- virtual bool generateLabelPositions(const std::string& objectId = "");
-
- //! Delete grouping.
- virtual bool deleteGrouping();
-
- //! Creates an appropriate visual presentation to the raster of the theme.
- virtual void createRasterVisual(TeRaster* rst = 0);
-
- /** @name Attribute Tables
- * A theme can use one or more attribute tables of the layer that gives its data.
- * These methods are related to the manipulation of these tables.
- */
- //@{
-
- //! Add a new attribute table to a theme.
- virtual bool addThemeTable(TeTable& table);
-
- //! Add a new attribute table to a theme.
- virtual void addThemeTable(string tableName);
-
- //! Verify if an attribute table is part of a theme.
- virtual bool isThemeTable(int tableId);
-
- //! Verify if an attribute table is part of a theme.
- virtual bool isThemeTable(string tableName);
-
- //! Returns the list of attribute tables used by this theme.
- virtual TeAttrTableVector& attrTables();
-
- //! Sets the entire list of attribute tables used by this theme.
- virtual bool setAttTables(TeAttrTableVector& attrs);
-
- //! Returns a vector of attribute tables, of a specific type, used by this theme.
- virtual bool getAttTables(TeAttrTableVector& attrs, TeAttrTableType attType = TeAllAttrTypes);
-
- //! Returns a representation of an attribute table given name.
- virtual bool getTable(TeTable& table, const string tableName);
-
- //! Clears the list of attribute tables used by this theme.
- virtual void clearAttTableVector();
-
- /** \brief Returns the temporal attribute table of the theme (TeEvent or TeFixedGeomDynAttr).
- \note A theme supports only one temporal attribute table.
- */
- virtual bool getTemporalTable(TeTable& table);
-
- //! Removes an attribute table from the list of tables of a theme.
- virtual bool removeThemeTable(unsigned int index);
-
- //! Returns the the name of an attribute table that contains a given attribute.
- virtual string getTableName(const string& attrName);
-
- //! Returns the name of the index-th attribute resulting of the join of all attribute tables associated to the theme tables
- virtual string getAttribute(unsigned int index);
-
- //! Loads the theme tables in the database
- virtual bool loadThemeTables();
-
- //! Returns the list of attributes of theme tables.
- virtual TeAttributeList sqlAttList();
-
- //! Clears the list of attributes associated to the theme tables.
- virtual void clearAttList();
-
- //! Returns the list of numerical attributes of the theme tables.
- virtual TeAttributeList sqlNumAttList();
-
- //! Clears the list of numerical attributes associated to the theme tables.
- virtual void clearNumAttList();
-
- ///! Returns a SQL JOIN statement to reach to all attribute tables used by this theme.
- virtual string sqlJoin();
-
- //! Returns a SQL FROM CLAUSE that gives access to all attribute tables used by this theme.
- virtual string sqlFrom();
-
- //! Returns the alias vector of the names of the theme tables.
- virtual vector<string>& aliasVector();
-
- //! Fills aliasVector_.
- virtual void loadAliasVector();
-
- /** \brief Refresh list of attributes of all the theme tables.
- \note All attributes are stored into sqlAttList_ and numeric attributes are stored into sqlNumAttList_.
- */
- virtual void loadAttrLists();
- //@}
-
- /** @name Locate geometries
- * Returns the geometry(ies) of the theme given coordinate
- */
- //@{
-
- virtual bool locatePolygon(TeCoord2D &pt, TePolygon &polygon, const double& tol = 0.0);
- virtual bool locatePolygonSet(TeCoord2D &pt, double tol, TePolygonSet &polygons);
- virtual bool locateLine(TeCoord2D &pt, TeLine2D &line, const double& tol = 0.0);
- virtual bool locatePoint(TeCoord2D &pt, TePoint &point, const double& tol = 0.0);
- virtual bool locateCell(TeCoord2D &pt, TeCell &c, const double& tol = 0.0);
-
- //@}
-
- /** \brief Verifies if there are objects without geometries of a specific geometry representation.
- */
- virtual bool hasObjectsWithoutGeometries(TeGeomRep geomRep);
-
- /** \brief Removes the objects without geometries of a specific geometry representation.
- */
- virtual bool removeObjectsWithoutGeometries(TeGeomRep geomRep);
-
- /** \brief Creates a table to store information on how to connect to others databases and get remote theme.
- \param sourceDB A connection to a TerraLib database that stores information about others databases that can be used by remote themes. (Input)
- \return Returns 1 if the table was created, -1 if it already exists and 0 on error.
- */
- static int createExternalThemeTable(TeDatabase* sourceDB);
-
- //! Save the theme metadata in database.
- virtual bool saveMetadata(TeDatabase* db);
-
- //! Get information about the remote database connection
- TeDBConnection& getRemoteDBConnection() { return remoteDBConn_; }
-
- //! Set information about the remote database connection
- void setRemoteDBConnection(TeDBConnection& dbConn) { remoteDBConn_ = dbConn; }
-
- protected:
-
- /** \brief Fill the sqlJoin_ and sqlFrom_ .
- */
- //virtual void loadThemeTablesJoin();
-
- /** \brief Populate the collection table based in the theme restrictions.
- */
- virtual bool populateCollection(std::string objectId = "");
-
- /** \brief Populate map with relationateds ids from local theme and remote theme.
- */
- virtual void createLegendMapId(std::map<int, int>& mapIdLegend);
-
- /** \brief Copy the respective collection table from remoteTheme to localTheme.
- */
- virtual bool copyRemoteCollection(std::map<int, int>& mapIdLegend);
-
-
- /** \brief Retrieves remote theme information from the database.
- */
- bool getRemoteThemeInfo(int& remoteThemeId, int& databaseId);
-
- //! Load the external theme metadata from database.
- virtual bool loadMetadata(TeDatabase* db);
-
- //! Erase the theme metadata in database.
- virtual bool eraseMetadata(TeDatabase* db);
-
- protected:
- //! A pointer to a theme in a remote database.
- TeTheme* remoteTheme_;
-
- //! Information about the remote database connection
- TeDBConnection remoteDBConn_;
-
- //! A pointer to the source database (where the metadata is stored)
- TeDatabase* sourceDB_;
-};
-
-
-//! This class implements a factory to create external theme objects.
-class TL_DLL TeExternalThemeFactory : public TeViewNodeFactory
-{
-public:
- //! Constructor
- TeExternalThemeFactory() : TeViewNodeFactory((int)TeEXTERNALTHEME)
- {}
-
- //! Created theme objects
- TeViewNode* build(TeViewNodeParams* params)
- {
- TeViewNodeParams auxParams = *params;
- return new TeExternalTheme(auxParams);
- }
-
- //! Created theme objects
- TeViewNode* build()
- {
- return new TeExternalTheme(0);
- }
-};
-
-namespace
-{
- static TeExternalThemeFactory externalThemeFactory;
-};
-
-#endif // __TERRALIB_INTERNAL_REMOTETHEME_H
-
diff --git a/src/terralib/kernel/TeFactory.h b/src/terralib/kernel/TeFactory.h
deleted file mode 100644
index d6e86c5..0000000
--- a/src/terralib/kernel/TeFactory.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeFactory.h
- \brief This file deals with the Factory Pattern
-*/
-#ifndef __TERRALIB_INTERNAL_FACTORY_H
-#define __TERRALIB_INTERNAL_FACTORY_H
-
-#include <map>
-#include <string>
-
-using namespace std;
-
-//! Implements a template for the "TeFactory" pattern.
-/*
- The "factory" pattern is a technique for creating new
- instances of objects which defines an abstract interface,
- (represented by the "Make" module). The subclasses of
- factory decide which class to instantiate.
-
-
- Each subclass of factory "registers" itself at compile time;
- therefore, the addition of a new factory requires no change
- the parent class.
-
- \author Gilberto Camara
-*/
-template <class T, class Arg>
-class TeFactory
-{
-public:
-
-//! Dictionary of factories (indexed by name)
- typedef map<string, TeFactory<T,Arg>* > TeFactoryMap;
-
-//! Returns the single instance of the factory dictionay
- static TeFactoryMap& instance ()
- {
- static TeFactoryMap Fmap_;
- return Fmap_;
-
- }
-
- //! Normal Constructor
- TeFactory (const string& factoryName);
-
- virtual ~TeFactory() {}
-
- //! Virtual constructor using name
- static T* make ( string name, const Arg& arg );
-
- //! Virtual constructor using arguments
- static T* make ( const Arg& arg );
-
-
-protected:
-
- //! Builds a new type (should be implemented by descendants)
- virtual T* build ( const Arg& arg ) = 0;
-
-private:
- string Fname_;
-};
-
-// Initialisation of static variable
-//template <class T, class Arg>
-//TeFactory<T,Arg>::TeFactoryMap TeFactory<T,Arg>::Fmap_;
-
-
-// Constructor
-template <class T, class Arg>
-TeFactory<T,Arg>::TeFactory(const string& name):
- Fname_(name)
-{
- TeFactory<T,Arg>::instance()[name] = this;
-
-}
-
-// Destructor
-//template <class T, class Arg>
-//TeFactory<T,Arg>::~TeFactory<T,Arg> ()
-//{
- // Remove the object from the factory dictionary
- // Fmap_.erase ( Fname_ );
-//}
-
-//! Builds an object, based on the input parameters
-template <class T, class Arg>
-T*
-TeFactory<T,Arg>::make ( string name, const Arg& arg )
-{
- // try to find the name on the factory dictionary
- typename TeFactoryMap::iterator i = TeFactory<T,Arg>::instance().find ( name );
-
- // Not found ? return the Default Object
- if ( i == TeFactory<T,Arg>::instance().end() )
- return T::DefaultObject( arg );
-
- // Create an object, based on the input parameters
- return (*i).second->build ( arg );
- return 0;
-
-}
-
-//! Builds an object, based on the input parameters
-template <class T, class Arg>
-T*
-TeFactory<T,Arg>::make (const Arg& arg )
-{
- string name = arg.decName();
-
- // try to find the name on the factory dictionary
- typename TeFactoryMap::iterator i = TeFactory<T,Arg>::instance().find ( name );
-
- // Not found ? return the Default Object
- if ( i == TeFactory<T,Arg>::instance().end() )
- return T::DefaultObject( arg );
-
- // Create an object, based on the input parameters
- return (*i).second->build ( arg );
- return 0;
-
-}
-#endif
-
diff --git a/src/terralib/kernel/TeFragmentation.cpp b/src/terralib/kernel/TeFragmentation.cpp
deleted file mode 100644
index d56f26a..0000000
--- a/src/terralib/kernel/TeFragmentation.cpp
+++ /dev/null
@@ -1,666 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeFragmentation.h"
-#include "TeGeometryAlgorithms.h"
-#include <algorithm>
-
-using namespace std;
-
-// estrutura auxiliar para implementar o funtor de ordenacao do algoritmo sort da STL:
-// os pontos de intersecao de um segmento de uma dada linha eh agrupado usando esse funtor.
-struct ipRedOrder // XY order
-{
- bool operator()(const TeINTERSECTOR2::TeBoundaryIP& ip1, const TeINTERSECTOR2::TeBoundaryIP& ip2) const
- {
- if(ip1.redPartNum_ < ip2.redPartNum_)
- return true;
-
- if(ip1.redPartNum_ > ip2.redPartNum_)
- return false;
-
- if(ip1.redSegNum_ < ip2.redSegNum_)
- return true;
-
- if(ip1.redSegNum_ > ip2.redSegNum_)
- return false;
-
- return false;
- }
-};
-
-// estrutura auxiliar para implementar o funtor de ordenacao do algoritmo sort da STL:
-// os pontos de intersecao de um segmento de uma dada linha eh agrupado usando esse funtor.
-struct ipRedOrder2 // XY order
-{
- bool operator()(const TeINTERSECTOR2::TeBoundaryIP& ip1, const TeINTERSECTOR2::TeBoundaryIP& ip2) const
- {
- if(ip1.redPolNum_ < ip2.redPolNum_)
- return true;
-
- if(ip1.redPolNum_ > ip2.redPolNum_)
- return false;
-
- if(ip1.redPartNum_ < ip2.redPartNum_)
- return true;
-
- if(ip1.redPartNum_ > ip2.redPartNum_)
- return false;
-
- if(ip1.redSegNum_ < ip2.redSegNum_)
- return true;
-
- if(ip1.redSegNum_ > ip2.redSegNum_)
- return false;
-
- if(ip1.coords_[0].x_ < ip2.coords_[0].x_)
- return true;
-
- if(ip1.coords_[0].x_ > ip2.coords_[0].x_)
- return false;
-
- if(ip1.coords_[0].y_ < ip2.coords_[0].y_)
- return true;
-
- if(ip1.coords_[0].y_ > ip2.coords_[0].y_)
- return false;
-
- if(ip1.coords_.size() < ip2.coords_.size())
- return true;
-
- if(ip1.coords_.size() > ip2.coords_.size())
- return false;
-
- if((ip1.coords_.size() == 2) && (ip2.coords_.size() == 2))
- {
- if(ip1.coords_[1].x_ < ip2.coords_[1].x_)
- return true;
-
- if(ip1.coords_[1].x_ > ip2.coords_[1].x_)
- return false;
-
- if(ip1.coords_[1].y_ < ip2.coords_[1].y_)
- return true;
-
- if(ip1.coords_[1].y_ > ip2.coords_[1].y_)
- return false;
- }
-
- return false;
- }
-};
-
-// estrutura auxiliar para colocar os pontos de intersecao ao longo de um segment ordenados,
-// de modo a facilitar a fragmentacao do segmento.
-struct TeIPAux
-{
- double x_;
- double y_;
- int type_; //0 - Unico; 1 - Inicial de Overlap; 2 - Final de Overlap
-
- TeIPAux(const double& x, const double& y, const int& t)
- : x_(x), y_(y), type_(t)
- {
- }
-};
-
-// estrutura auxiliar para implementar o funtor de ordenacao do algoritmo sort da STL:
-// os pontos de intersecao de um segmento de uma dada linha serao ordenados por esse funtor.
-struct sortDist
-{
- TeCoord2D c_; // cordenada de referencia
-
- sortDist(const TeCoord2D& c)
- : c_(c)
- {
- }
-
- bool operator()(const TeIPAux& ip1, const TeIPAux& ip2) const
- {
- double dist1 = ((ip1.x_ - c_.x_) * (ip1.x_ - c_.x_)) + ((ip1.y_ - c_.y_) * (ip1.y_ - c_.y_));
- double dist2 = ((ip2.x_ - c_.x_) * (ip2.x_ - c_.x_)) + ((ip2.y_ - c_.y_) * (ip2.y_ - c_.y_));
- if(dist1 < dist2)
- return true;
- return false;
- }
-};
-
-
-// mario + gribeiro - 2006-03
-// remove pontos de intersecao com a mesma localizacao que foram reportados por segmentos diferentes,
-// deixandoo vetor "ips" na sequencia correta para uso da etapa de fragmentacao do segmento.
-// Essa rotin pode lancar uma excessao em um caso muito especial: um ponto final de overlap veio ante do ponto inicial de overlap.
-inline void cleanIntersections(TeINTERSECTOR2::TeVectorBoundaryIP& ips, const TeCoord2D& refCoord)
-{
- vector<TeIPAux> vecips;
- for(unsigned int i = 0; i < ips.size(); ++i)
- {
- if(ips[i].coords_.size() == 2)
- {
- double dist1 = ((ips[i].coords_[0].x_ - refCoord.x_) * (ips[i].coords_[0].x_ - refCoord.x_)) + ((ips[i].coords_[0].y_ - refCoord.y_) * (ips[i].coords_[0].y_ - refCoord.y_));
- double dist2 = ((ips[i].coords_[1].x_ - refCoord.x_) * (ips[i].coords_[1].x_ - refCoord.x_)) + ((ips[i].coords_[1].y_ - refCoord.y_) * (ips[i].coords_[1].y_ - refCoord.y_));
-
- if(dist1 < dist2)
- {
- TeIPAux ip1(ips[i].coords_[0].x_, ips[i].coords_[0].y_, 1);
- TeIPAux ip2(ips[i].coords_[1].x_, ips[i].coords_[1].y_, 2);
- vecips.push_back(ip1);
- vecips.push_back(ip2);
- }
- else
- {
- TeIPAux ip1(ips[i].coords_[0].x_, ips[i].coords_[0].y_, 2);
- TeIPAux ip2(ips[i].coords_[1].x_, ips[i].coords_[1].y_, 1);
- vecips.push_back(ip1);
- vecips.push_back(ip2);
- }
- }
- else
- {
- TeIPAux ip(ips[i].coords_[0].x_, ips[i].coords_[0].y_, 0);
- vecips.push_back(ip);
- }
- }
-
- sort(vecips.begin(), vecips.end(), sortDist(refCoord));
-
- TeINTERSECTOR2::TeVectorBoundaryIP newips;
-
- int cont = 0;
-
- TeLine2D l;
- TeLineSet lset;
-
- for(unsigned int i = 0; i < vecips.size(); ++i)
- {
- TeCoord2D c(vecips[i].x_, vecips[i].y_);
-
- if(vecips[i].type_ == 0)
- {
- if(l.size() > 0)
- {
- if(TeEquals(c, l[l.size() - 1]))
- {
- continue;
- }
- else if(cont == 0)
- {
- lset.add(l);
- l = TeLine2D();
- l.add(c);
- }
- else
- {
- l.add(c);
- }
- }
- else
- {
- l.add(c);
- }
- }
- else if(vecips[i].type_ == 1)
- {
- if(l.size() > 0)
- {
- if(TeEquals(c, l[l.size() - 1]))
- {
- ++cont;
- continue;
- }
- else if(cont == 0)
- {
- lset.add(l);
- l = TeLine2D();
- l.add(c);
- }
- else
- {
- l.add(c);
- }
- }
- else
- {
- l.add(c);
- }
-
- ++cont;
- }
- else //else if(vecips[i].type == 2)
- {
- if(l.size() > 0)
- {
- if(TeEquals(c, l[l.size() - 1]))
- {
- --cont;
- continue;
- }
- else if(cont == 0)
- {
- throw string("An overlap end point started before an overlap begin!"); // nao podia ter chegado ate aqui
- }
- else
- {
- l.add(c);
- }
- }
- else
- {
- l.add(c);
- }
-
- --cont;
- }
- }
-
- if(l.size() > 0)
- {
- lset.add(l);
- }
-
- for(unsigned int i = 0; i < lset.size(); ++i)
- {
- if(lset[i].size() == 1)
- {
- TeINTERSECTOR2::TeBoundaryIP newIp;
- newIp.coords_.push_back(lset[i][0]);
- newips.push_back(newIp);
- }
- else
- {
- for(unsigned int j = 1; j < lset[i].size(); ++j)
- {
- TeINTERSECTOR2::TeBoundaryIP newIp;
- newIp.coords_.push_back(lset[i][j-1]);
- newIp.coords_.push_back(lset[i][j]);
-
- newips.push_back(newIp);
- }
- }
- }
-
- ips.clear();
- ips = newips;
-}
-
-// rotina que fragmenta uma aresta se necessario: aplica-se no caso de segmentos que nao fazem overlap
-inline void TeFragmentSegmentByNonOverlapping(const TeCoord2D& s1, const TeCoord2D& /* s2 */,
- TeINTERSECTOR2::TeVectorBoundaryIP& ips,
- TeLine2D& currentFragment,
- TeLineSet& fragments)
-{
-// vamos deixar os pontos de intersecao numa sequencoa adequada para fragmentarmos este segmento
- cleanIntersections(ips, s1);
-
-
-// eh so fragmentar o segmento ateh o ultimo ponto de interseccao dele
- for(unsigned int k = 0; k < ips.size(); ++k)
- {
- if(TeEquals(ips[k].coords_[0], currentFragment[currentFragment.size() - 1])) // Se o ponto de interseccao esta sobre o vehrtice do segmento
- {
- // fragmenta a linha caso haja mais de um ponto nela
- if(currentFragment.size() > 1)
- {
- fragments.add(currentFragment);
-
- currentFragment = TeLine2D();
- currentFragment.add(ips[k].coords_[0]);
- }
- else
- {
- continue;
- }
- }
- else
- {
- currentFragment.add(ips[k].coords_[0]);
-
- fragments.add(currentFragment);
-
- currentFragment = TeLine2D();
- currentFragment.add(ips[k].coords_[0]);
- }
- }
-}
-
-// fragmenta uma aresta que possui pontos de intersecao de overlap
-inline void TeFragmentSegmentByOverlapping(const TeCoord2D& s1, const TeCoord2D& /* s2 */,
- TeINTERSECTOR2::TeVectorBoundaryIP& ips,
- TeLine2D& currentFragment,
- TeLineSet& fragments, TeLineSet& boundaryFragments)
-{
-// vamos deixar os pontos de intersecao numa sequencoa adequada para fragmentarmos este segmento
- cleanIntersections(ips, s1);
-
- unsigned int i = 0;
-
-// eh so fragmentar o segmento ateh o ultimo ponto de interseccao dele
- for(i = 0; i < ips.size(); ++i)
- {
- if(TeEquals(ips[i].coords_[0], currentFragment[currentFragment.size() - 1])) // Se o ponto de interseccao esta sobre o vehrtice do segmento
- {
- // fragmenta a linha caso haja mais de um ponto nela
- if(currentFragment.size() > 1)
- {
- fragments.add(currentFragment);
-
- currentFragment = TeLine2D();
-
- if(ips[i].coords_.size() == 2)
- {
- TeLine2D l;
- l.add(ips[i].coords_[0]);
- l.add(ips[i].coords_[1]);
-
- boundaryFragments.add(l);
-
- currentFragment.add(ips[i].coords_[1]);
- }
- else
- {
- currentFragment.add(ips[i].coords_[0]);
- }
- }
- else
- {
- if(ips[i].coords_.size() == 2)
- {
- TeLine2D l;
- l.add(ips[i].coords_[0]);
- l.add(ips[i].coords_[1]);
-
- boundaryFragments.add(l);
-
- currentFragment.clear();
- currentFragment.add(ips[i].coords_[1]);
- }
- }
- }
- else
- {
-
- currentFragment.add(ips[i].coords_[0]);
-
- if(ips[i].coords_.size() == 2)
- {
- fragments.add(currentFragment);
-
- currentFragment = TeLine2D();
-
- currentFragment.add(ips[i].coords_[1]);
-
- TeLine2D l;
- l.add(ips[i].coords_[0]);
- l.add(ips[i].coords_[1]);
-
- boundaryFragments.add(l);
- }
- else
- {
- fragments.add(currentFragment);
-
- currentFragment = TeLine2D();
-
- currentFragment.add(ips[i].coords_[0]);
- }
- }
- }
-}
-
-// Adiciona o ponto de intersecao ao fragmento corrente, decidindo entre um ponto de intersecao e o ponto original
-void TeAddPoint(TeLine2D& lFrag, TeLine2D& currentLine, TeINTERSECTOR2::TeVectorBoundaryIP& ipsAux, const unsigned int& j)
-{
- bool found = false;
-
- for(unsigned int i = 0; i < ipsAux.size(); ++i)
- {
- if(TeEquals(ipsAux[i].coords_[0], currentLine[j]))
- {
- lFrag.add(ipsAux[i].coords_[0]);
- found = true;
- break;
- }
- else if(ipsAux[i].coords_.size() == 2)
- {
- if(TeEquals(ipsAux[i].coords_[1], currentLine[j]))
- {
- lFrag.add(ipsAux[i].coords_[1]);
- found = true;
- break;
- }
- }
- }
-
- if(!found)
- lFrag.add(currentLine[j]);
-}
-
-// rotina principal de fragmentacao de linhas
-void TeFragmentBoundary(const TeLineSet& lines, TeINTERSECTOR2::TeVectorBoundaryIP& ips, TeLineSet& boundaryFragments, TeLineSet& fragments)
-{
-// informacoes sobre os pontos de intersecao
- unsigned int currentIP = 0;
- unsigned int nthIP = ips.size();
-
- // Informacoes sobre numero de linhas
- unsigned int nthLine = lines.size();
-
- // Ordena os pontos de intersecao
- sort(ips.begin(), ips.end(), ipRedOrder());
-
- for(unsigned int i = 0; i < nthLine; ++i)
- {
- if((currentIP < nthIP) && (ips[currentIP].redPartNum_ == i))
- {
- // Se a linha corrente possui um ponto de intersecao entao ela devera ser fragmentada
- TeLine2D& currentLine = lines[i];
-
- TeLine2D lFrag;
-
- //unsigned int currentSegment = 0;
- unsigned int nthSegment = currentLine.size() - 1;
-
- for(unsigned int j = 0; j < nthSegment; ++j)
- {
- if((currentIP < nthIP) && (j == ips[currentIP].redSegNum_) && (ips[currentIP].redPartNum_ == i)) // Se ainda tenho pontos de interseccao e
- { // o corrente pertence ao segmento atual
- // Copias todos os pontos de interseccao do segmento para
- // um vetor auxiliar e ja avanca o currentIP
- TeINTERSECTOR2::TeVectorBoundaryIP ipsAux;
-
- bool hasOverlap = false;
-
- while((currentIP < nthIP) && (ips[currentIP].redSegNum_ == j) && (ips[currentIP].redPartNum_ == i))
- {
- if(ips[currentIP].coords_.size() == 2)
- hasOverlap = true;
-
- ipsAux.push_back(ips[currentIP]);
-
- ++currentIP;
- }
-
- // Adiciona o primeiro ponto da linha na lista do fragmento atual: mas precisamos decidir entre o vertice original ou o de intersecao => preferimos o de intersecao para amarrar com o segmento que intercepta este segmento
- if((lFrag.size() == 0) || TeDisjoint(currentLine[j], lFrag[lFrag.size() - 1]))
- TeAddPoint(lFrag, currentLine, ipsAux, j);
-
- if(hasOverlap) // Se houverem pontos de interseccao que fazem overlap
- {
- TeFragmentSegmentByOverlapping(currentLine[j], currentLine[j + 1], ipsAux, lFrag, fragments, boundaryFragments);
- }
- else // Se nao houver pontos de interseccao que fazem overlap
- {
- TeFragmentSegmentByNonOverlapping(currentLine[j], currentLine[j + 1], ipsAux, lFrag, fragments);
- }
- }
- else
- {
- // Caso nao haja ponto de interseccao sobre o segmento,
- // apenas insere o ponto no fragmento de linha
- lFrag.add(currentLine[j]);
- }
- }
-
- if(lFrag.size() > 0)
- {
- if(TeDisjoint(currentLine[nthSegment], lFrag[lFrag.size() - 1]))
- {
- lFrag.add(currentLine[nthSegment]);
-
- fragments.add(lFrag);
- }
- else if(lFrag.size() > 1)
- {
- fragments.add(lFrag);
- }
- }
- }
- else
- {
- // Caso contrario, se a linha nao possui ponto de intersecao
- // eh so colocar ela na lista de linhas fragmentadas
- fragments.add(lines[i]);
- }
- }
-
- return;
-}
-
-// rotina principal de fragmentacao de poligonos
-void TeFragmentBoundary(const TePolygonSet& polygons, TeINTERSECTOR2::TeVectorBoundaryIP& ips, TeLineSet& boundaryFragments, vector<pair<unsigned int, unsigned int> >& boundaryFragmentsIds, TeLineSet& fragments, vector<pair<unsigned int, unsigned int> >& fragmentsIds)
-{
- // Informacoes sobre os pontos de intersecao
- unsigned int currentIP = 0;
- unsigned int nthIP = ips.size();
-
- // Ordena os pontos de intersecao
- sort(ips.begin(), ips.end(), ipRedOrder2());
-
- // Informacoes sobre numero de poligonos
- unsigned int nthPol = polygons.size();
-
- for(unsigned int polyIndex = 0; polyIndex < nthPol; ++polyIndex)
- {
- unsigned int nthLine = polygons[polyIndex].size();
-
- for(unsigned int ringIndex = 0; ringIndex < nthLine; ++ringIndex)
- {
-// temos intersecao no anel?
- if((currentIP < nthIP) && (ips[currentIP].redPartNum_ == ringIndex) && (ips[currentIP].redPolNum_ == polyIndex))
- {
- // Se a linha corrente possui um ponto de intersecao entao ela devera ser fragmentada
- TeLine2D& currentLine = polygons[polyIndex][ringIndex];
-
- TeLine2D lFrag;
-
- //unsigned int currentSegment = 0;
- unsigned int nthSegment = currentLine.size() - 1;
-
- TeCoord2D first(0,0);
-
- for(unsigned int j = 0; j < nthSegment; ++j)
- {
-// temos intersecao sobre o segmento corrente?
- if((currentIP < nthIP) && (j == ips[currentIP].redSegNum_) && (ips[currentIP].redPartNum_ == ringIndex) && (ips[currentIP].redPolNum_ == polyIndex)) // Se ainda tenho pontos de interseccao e
- {
- // Copias todos os pontos de interseccao do segmento para
- // um vetor auxiliar e ja avanca o currentIP
- TeINTERSECTOR2::TeVectorBoundaryIP ipsAux;
-
- bool hasOverlap = false;
-
- while((currentIP < nthIP) && (ips[currentIP].redSegNum_ == j) && (ips[currentIP].redPartNum_ == ringIndex) && (ips[currentIP].redPolNum_ == polyIndex))
- {
- if(ips[currentIP].coords_.size() == 2)
- hasOverlap = true;
-
- ipsAux.push_back(ips[currentIP]);
-
- ++currentIP;
- }
-
- // Adiciona o primeiro ponto da linha na lista do fragmento atual: mas precisamos decidir entre o vertice original ou o de intersecao => preferimos o de intersecao para amarrar com o segmento que intercepta este segmento
- if((lFrag.size() == 0) || TeDisjoint(currentLine[j], lFrag[lFrag.size() - 1]))
- TeAddPoint(lFrag, currentLine, ipsAux, j);
-
- if(hasOverlap) // Se houverem pontos de interseccao que fazem overlap
- {
- TeFragmentSegmentByOverlapping(currentLine[j], currentLine[j + 1], ipsAux, lFrag, fragments, boundaryFragments);
- }
- else // Se nao houver pontos de interseccao que fazem overlap
- {
- TeFragmentSegmentByNonOverlapping(currentLine[j], currentLine[j + 1], ipsAux, lFrag, fragments);
- }
- }
- else
- {
- // Caso nao haja ponto de interseccao sobre o segmento,
- // apenas insere o ponto no fragmento de linha
- lFrag.add(currentLine[j]);
- }
- }
-
- if(lFrag.size() > 0)
- {
- if(TeDisjoint(currentLine[0], lFrag[lFrag.size() - 1]))
- {
- lFrag.add(currentLine[0]);
-
- fragments.add(lFrag);
- }
- else if(lFrag.size() > 1)
- {
- fragments.add(lFrag);
- }
- }
- }
- else
- {
- // Caso contrario, se a linha nao possui ponto de intersecao
- // e so colocar ela na lista de linhas fragmentadas
- fragments.add(polygons[polyIndex][ringIndex]);
- }
-
- unsigned int numFragmentos = fragments.size();
-
- for(unsigned int fragIdxCount = fragmentsIds.size(); fragIdxCount < numFragmentos; ++fragIdxCount)
- fragmentsIds.push_back(pair<unsigned int, unsigned int>(polyIndex, ringIndex));
-
-
-//mario - 2006-03
- unsigned int numFragmentosFronteira = boundaryFragments.size();
-
- for(unsigned int fragIdxCount = boundaryFragmentsIds.size(); fragIdxCount < numFragmentosFronteira; ++fragIdxCount)
- {
- boundaryFragmentsIds.push_back(pair<unsigned int, unsigned int>(polyIndex, ringIndex));
- }
- }
- }
-
- return;
-}
-
diff --git a/src/terralib/kernel/TeFragmentation.h b/src/terralib/kernel/TeFragmentation.h
deleted file mode 100644
index 8228dae..0000000
--- a/src/terralib/kernel/TeFragmentation.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeFragmentation.h
- \brief This file contains Algorithms for Topological Operations.
- These data structures and algorithms MUST BE USED ONLY BY TerraLib kernel and should NOT be used by anyone because
- THIS IS FOR INTERNAL USE ONLY.
-*/
-
-#ifndef __TERRALIB_INTERNAL_FRAGMENTATION_H
-#define __TERRALIB_INTERNAL_FRAGMENTATION_H
-
-#include "TeGeometry.h"
-#include "TeIntersector.h"
-
-/** @defgroup FragmentAlgorithms Algorithms that performs fragmentation of lines
- @ingroup GeometryAlgorithms
- THIS IS FOR INTERNAL USE ONLY: TerraLib fragmentation algorithms.
- * @{
- */
-/** \brief Fragments the lines according intersection points (May rise an exception: you must use try and catch).
- \param lines The lines to fragment.
- \param ips The intersection points where the boundary will be fragmented.
- \param boundaryFragments Output list of segments in the boundary of another line.
- \param fragments Output list of line fragmemts.
-*/
-TL_DLL void TeFragmentBoundary(const TeLineSet& lines, TeINTERSECTOR2::TeVectorBoundaryIP& ips, TeLineSet& boundaryFragments, TeLineSet& fragments);
-
-/** Fragments the lines according intersection points (May rise an exception: you must use try and catch).
- \param polygons List of polygons (lines to be fragmented).
- \param ips Intersection points where the boundary will be fragmented.
- \param boundaryFragments Output list of segments in the boundary of another line.
- \param boundaryFragmentsIds Output list with the objects identifiers for each fragment (to be used by location, to decide in/out fragments).
- \param fragments Output list of line fragmemts.
- \param fragmentsIds Output list with the objects identifiers for each fragment (to be used by location, to decide in/out fragments).
-*/
-TL_DLL void TeFragmentBoundary(const TePolygonSet& polygons, TeINTERSECTOR2::TeVectorBoundaryIP& ips,
- TeLineSet& boundaryFragments, vector<pair<unsigned int, unsigned int> >& boundaryFragmentsIds, TeLineSet& fragments, vector<pair<unsigned int, unsigned int> >& fragmentsIds);
-
-/** @} */ // end of group FragmentAlgorithms
-
-#endif // __TERRALIB_INTERNAL_FRAGMENTATION_H
diff --git a/src/terralib/kernel/TeGTFactory.cpp b/src/terralib/kernel/TeGTFactory.cpp
deleted file mode 100644
index d5e02e1..0000000
--- a/src/terralib/kernel/TeGTFactory.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-#include "TeGTFactory.h"
-
-TeGTFactory::TeGTFactory( const std::string& factoryName )
-: TeFactory< TeGeometricTransformation, TeGTParams >( factoryName )
-{
-};
-
-TeGTFactory::~TeGTFactory()
-{
-};
diff --git a/src/terralib/kernel/TeGTFactory.h b/src/terralib/kernel/TeGTFactory.h
deleted file mode 100644
index 3d7e511..0000000
--- a/src/terralib/kernel/TeGTFactory.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeGTFactory.h
- \brief This file supports the implementation of Geometric transformation factories.
- \author Emiliano Ferreira Castejon <castejon at dpi.inpe.br>
-*/
-/**
- * @defgroup TeGTFactories Geometric transformation factories.
- * @ingroup Utils
- */
-
-#include "TeDefines.h"
-
-#ifndef TEGTFACTORIES_REGISTERED
- #define TEGTFACTORIES_REGISTERED
-
- #include "TeAffineGTFactory.h"
- #include "TeProjectiveGTFactory.h"
-#endif
-
-#ifndef TEGTFACTORY_H
- #define TEGTFACTORY_H
-
- #include "TeGeometricTransformation.h"
- #include "TeGTParams.h"
- #include "TeFactory.h"
-
- #include <string>
-
- /**
- * @brief This is the class for geometric transformations factory.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup TeGTFactories
- */
- class TL_DLL TeGTFactory :
- public TeFactory< TeGeometricTransformation, TeGTParams >
- {
- public :
-
- /**
- * Default Destructor
- */
- virtual ~TeGTFactory();
-
- protected :
-
- /**
- * Default constructor
- *
- * @param factoryName Factory name.
- */
- TeGTFactory( const std::string& factoryName );
- };
-
-#endif
-
-
-
diff --git a/src/terralib/kernel/TeGTParams.cpp b/src/terralib/kernel/TeGTParams.cpp
deleted file mode 100644
index 393385f..0000000
--- a/src/terralib/kernel/TeGTParams.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeGTParams.h"
-
-#include <float.h>
-
-TeGTParams::TeGTParams()
-{
- reset();
-}
-
-
-TeGTParams::TeGTParams( const TeGTParams& external )
-{
- operator=( external );
-}
-
-
-TeGTParams::~TeGTParams()
-{
- reset();
-}
-
-
-const TeGTParams& TeGTParams::operator=(
- const TeGTParams& external )
-{
- transformation_name_ = external.transformation_name_;
- out_rem_strat_ = external.out_rem_strat_;
- max_dmap_error_ = external.max_dmap_error_;
- max_imap_error_ = external.max_imap_error_;
- tiepoints_ = external.tiepoints_;
- direct_parameters_ = external.direct_parameters_;
- inverse_parameters_ = external.inverse_parameters_;
- maxIters_ = external.maxIters_;
- tolerance_ = external.tolerance_;
- useAdaptiveParams_ = external.useAdaptiveParams_;
- WMatrix_ = external.WMatrix_;
-
- return external;
-}
-
-
-std::string TeGTParams::decName() const
-{
- return transformation_name_;
-}
-
-
-void TeGTParams::reset()
-{
- transformation_name_ = "affine";
- out_rem_strat_ = NoOutRemotion;
- max_dmap_error_ = DBL_MAX;
- max_imap_error_ = DBL_MAX;
- maxIters_ = 20;
- tolerance_ = 0.0001;
- useAdaptiveParams_ = false;
-
- direct_parameters_.Clear();
- inverse_parameters_.Clear();
- tiepoints_.clear();
- WMatrix_.Clear();
-}
-
diff --git a/src/terralib/kernel/TeGTParams.h b/src/terralib/kernel/TeGTParams.h
deleted file mode 100644
index ef7485e..0000000
--- a/src/terralib/kernel/TeGTParams.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeGTParams.h
- \brief This file contains the definition of parameters necessary to build a TeGeometricTransformation instance.
-*/
-
-#include "TeDefines.h"
-
-#ifndef TEGTPARAMS_H
- #define TEGTPARAMS_H
-
- #include "TeMatrix.h"
- #include "TeCoord2D.h"
- #include "TeSharedPtr.h"
-
- #include <string>
-
- /**
- * @brief This is the class for geometric transformation parameters .
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup Utils
- */
- class TL_DLL TeGTParams
- {
- public :
-
- /**
- * @typedef TeSharedPtr< TeGTParams > pointer
- * Type definition for a TeGTParams instance pointer.
- */
- typedef TeSharedPtr< TeGTParams > pointer;
-
- /**
- * @enum OutRemStrategy
- * Outliers remotion strategy.
- */
- enum OutRemStrategy {
- /**
- * @brief No outliers remotion applied.
- */
- NoOutRemotion,
- /**
- * @brief Exaustive outliers remotion (all
- * possible tie-points combinations will be
- * tested.
- */
- ExaustiveOutRemotion,
- /**
- * @brief LOA (leave-worse-out) will
- * be performed.
- */
- LWAOutRemotion
- };
-
- /**
- * @brief Transformation name.
- *
- * @note Default value = affine.
- */
- std::string transformation_name_;
-
- /**
- * @brief The outliers remotion strategy.
- *
- * @note Default value = NoOutRemotion.
- */
- OutRemStrategy out_rem_strat_;
-
- /**
- * @brief The maximum allowed direct mapping error.
- *
- * @note Default value = Positive infinite.
- */
- double max_dmap_error_;
-
- /**
- * @brief The maximum allowed inverse mapping error.
- *
- * @note Default value = Positive infinite.
- */
- double max_imap_error_;
-
- /**
- * @brief The current direct mapping transformation parameters.
- * @note Default value = An empty matrix.
- */
- TeMatrix direct_parameters_;
-
- /**
- * @brief The current inverse mapping transformation parameters.
- * @note Default value = An empty matrix.
- */
- TeMatrix inverse_parameters_;
-
- /**
- * @brief The current transformation tie-points.
- * @note Default value = An empty vector.
- */
- std::vector< TeCoordPair > tiepoints_;
-
- /**
- * @brief The weight matrix used by least square method.
- *
- * @note Default value = empty matrix.
- */
- TeMatrix WMatrix_;
-
- /**
- * @brief The maximun number of iterations while processing.
- *
- * @note Default value = 20.
- */
- unsigned int maxIters_;
-
- /**
- * @brief The tolerance used while executing an iterative processing.
- *
- * @note Default value = 0.0001.
- */
- double tolerance_;
-
- /**
- * @brief Indicates whether use adaptive parameters or not.
- *
- * @note Default value = false.
- */
- bool useAdaptiveParams_;
-
- /**
- * @brief Default constructor
- */
- TeGTParams();
-
- /**
- * @brief Alternative constructor
- * @param external External reference.
- */
- TeGTParams( const TeGTParams& external );
-
- /**
- * @brief Default Destructor
- */
- ~TeGTParams();
-
- /**
- * @brief operator= implementation.
- *
- * @param external External reference.
- * @return A const reference to the external object instance.
- */
- const TeGTParams& operator=(
- const TeGTParams& external );
-
- /**
- * @brief This is for TeFactory compatibility.
- */
- std::string decName() const;
-
- /**
- * @brief Reset to the default parameters.
- */
- void reset();
-
- };
-
-#endif
diff --git a/src/terralib/kernel/TeGeometricTransformation.cpp b/src/terralib/kernel/TeGeometricTransformation.cpp
deleted file mode 100644
index 1eb4316..0000000
--- a/src/terralib/kernel/TeGeometricTransformation.cpp
+++ /dev/null
@@ -1,637 +0,0 @@
-/*
-TerraLib - a library for developing GIS applications.
-Copyright 2001, 2002, 2003 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular
-purpose. The library provided hereunder is on an "as is" basis, and the
-authors have no obligation to provide maintenance, support, updates,
-enhancements, or modifications.
-In no event shall INPE be held liable to any party
-for direct, indirect, special, incidental, or consequential damages arising
-out of the use of this library and its documentation.
-*/
-
-#include "TeGeometricTransformation.h"
-
-#include <TeAgnostic.h>
-
-#include <math.h>
-#include <float.h>
-
-#include <iostream>
-
-
-TeGeometricTransformation::TeGeometricTransformation()
-{
-}
-
-
-TeGeometricTransformation::~TeGeometricTransformation()
-{
-}
-
-
-void TeGeometricTransformation::getParameters( TeGTParams& params ) const
-{
- params = internal_params_;
-}
-
-
-bool TeGeometricTransformation::reset( const TeGTParams& newparams )
-{
- /* If previous calculated parameters were supplied, no need to do calcules */
-
- if( ( newparams.direct_parameters_.Nrow() > 0 ) &&
- ( newparams.direct_parameters_.Ncol() > 0 ) &&
- ( newparams.inverse_parameters_.Nrow() > 0 ) &&
- ( newparams.inverse_parameters_.Ncol() > 0 )
- ) {
-
- internal_params_ = newparams;
- return true;
- } else {
- /* No previous parameters given - Need to calculate the new transformation
- parameters */
-
- TEAGN_TRUE_OR_THROW( ( newparams.max_dmap_error_ >= 0 ),
- "Invalid maximum allowed direct mapping error" );
- TEAGN_TRUE_OR_THROW( ( newparams.max_imap_error_ >= 0 ),
- "Invalid maximum allowed inverse mapping error" );
-
- const unsigned int req_tie_pts_nmb = getMinRequiredTiePoints();
-
- if( newparams.tiepoints_.size() < req_tie_pts_nmb ) {
- return false;
- } else {
- internal_params_ = newparams;
-
- switch( newparams.out_rem_strat_ ) {
- case TeGTParams::NoOutRemotion :
- {
- if( computeParameters( internal_params_ ) ) {
-
- if( ( newparams.max_dmap_error_ >=
- getDirectMappingError( internal_params_ ) ) &&
- ( newparams.max_imap_error_ >=
- getInverseMappingError( internal_params_ ) ) ) {
-
- return true;
- }
- }
-
- break;
- }
- case TeGTParams::ExaustiveOutRemotion :
- {
- if( exaustiveOutRemotion( internal_params_ ) ) {
- return true;
- }
-
- break;
- }
- case TeGTParams::LWAOutRemotion :
- {
- if( LWAOutRemotion( internal_params_ ) ) {
- return true;
- }
-
- break;
- }
- default :
- {
- TEAGN_LOG_AND_THROW(
- "Invalid outliers remotion strategy" )
- break;
- }
-
- }
- }
- }
-
- internal_params_.reset();
-
- return false;
-}
-
-
-double TeGeometricTransformation::getDirectMappingError(
- const TeGTParams& params ) const
-{
- unsigned int tiepoints_size = params.tiepoints_.size();
-
- TEAGN_DEBUG_CONDITION( ( tiepoints_size > 0 ),
- "Invalid tie-points size" )
-
- double max_error = 0;
- double current_error = 0;
-
- for( unsigned int tpindex = 0 ; tpindex < tiepoints_size ; ++tpindex ) {
- current_error = getDirectMappingError( params.tiepoints_[ tpindex ],
- params );
-
- if( current_error > max_error ) {
- max_error = current_error;
- }
- }
-
- return max_error;
-}
-
-
-double TeGeometricTransformation::getInverseMappingError(
- const TeGTParams& params ) const
-{
- unsigned int tiepoints_size = params.tiepoints_.size();
-
- TEAGN_DEBUG_CONDITION( ( tiepoints_size > 0 ),
- "Invalid tie-points size" )
-
-
- double max_error = 0;
- double current_error = 0;
-
- for( unsigned int tpindex = 0 ; tpindex < tiepoints_size ; ++tpindex ) {
- current_error = getInverseMappingError( params.tiepoints_[ tpindex ],
- params );
-
- if( current_error > max_error ) {
- max_error = current_error;
- }
- }
-
- return max_error;
-}
-
-
-double TeGeometricTransformation::getDirectMappingError(
- const TeCoordPair& tie_point, const TeGTParams& params ) const
-{
- TeCoord2D direct_mapped_point;
-
- directMap( params, tie_point.pt1, direct_mapped_point );
-
- double diff_x = tie_point.pt2.x() - direct_mapped_point.x();
- double diff_y = tie_point.pt2.y() - direct_mapped_point.y();
-
- return hypot( diff_x, diff_y );
-}
-
-
-double TeGeometricTransformation::getInverseMappingError(
- const TeCoordPair& tie_point, const TeGTParams& params ) const
-{
- TeCoord2D inverse_mapped_point;
-
- inverseMap( params, tie_point.pt2, inverse_mapped_point );
-
- double diff_x = tie_point.pt1.x() - inverse_mapped_point.x();
- double diff_y = tie_point.pt1.y() - inverse_mapped_point.y();
-
- return hypot( diff_x, diff_y );
-}
-
-
-bool TeGeometricTransformation::recombineSeed( std::vector<unsigned int>& seed,
- const unsigned int& seedpos, const unsigned int& elements_nmb ) const
-{
- unsigned int seed_size = seed.size();
-
- if( seedpos >= seed_size ) {
- return false;
- }
-
- if( seed[ seedpos ] >= ( elements_nmb - seed_size + seedpos + 1 ) ) {
- if( seedpos == seed_size - 1 ) {
- return false;
- } else if( seedpos == 0 ) {
- return recombineSeed( seed, seedpos + 1, elements_nmb ) ;
- } else {
- return recombineSeed( seed, seedpos + 1, elements_nmb ) ;
- };
- } else if( seed[ seedpos ] == 0 ) {
- if( seedpos == 0 ) {
- seed[ seedpos ] = 1 ;
- return recombineSeed( seed, seedpos + 1, elements_nmb );
- } else if( seedpos == seed_size - 1 ) {
- seed[ seedpos ] = seed[ seedpos - 1 ] + 1;
- return true;
- } else {
- seed[ seedpos ] = seed[ seedpos - 1 ] + 1;
- seed[ seedpos + 1 ] = 0;
- return recombineSeed( seed, seedpos + 1, elements_nmb );
- }
- } else {
- if( seedpos == seed_size - 1 ) {
- seed[ seedpos ] = seed[ seedpos ] + 1;
- return true;
- } else if( seedpos == 0 ) {
- if( recombineSeed( seed, seedpos + 1, elements_nmb ) ) {
- return true;
- } else {
- seed[ seedpos ] = seed[ seedpos ] + 1;
- seed[ seedpos + 1 ] = 0;
- return recombineSeed( seed, seedpos + 1, elements_nmb );
- }
- } else {
- if( recombineSeed( seed, seedpos + 1, elements_nmb ) ) {
- return true;
- } else {
- seed[ seedpos ] = seed[ seedpos ] + 1;
- seed[ seedpos + 1 ] = 0;
- return recombineSeed( seed, seedpos + 1, elements_nmb );
- }
- }
- }
-}
-
-
-TeGeometricTransformation* TeGeometricTransformation::DefaultObject(
- const TeGTParams& )
-{
- throw TeException( UNKNOWN_ERROR_TYPE,
- "Trying to create an invalid TeGemetricTransformation instance" );
-
- return 0;
-};
-
-
-bool TeGeometricTransformation::exaustiveOutRemotion(
- TeGTParams& params )
-{
- TEAGN_DEBUG_CONDITION( ( params.out_rem_strat_ ==
- TeGTParams::ExaustiveOutRemotion ),
- "Inconsistent outliers remotion strategy" )
-
- const unsigned int req_tie_pts_nmb = getMinRequiredTiePoints();
-
- /* Initiating seed */
-
- std::vector<unsigned int> comb_seed_vec;
-
- for( unsigned int comb_seed_vec_index = 0 ;
- comb_seed_vec_index < req_tie_pts_nmb ;
- ++comb_seed_vec_index ) {
-
- comb_seed_vec.push_back( 0 );
- }
-
- /* Trying to find the best tie-points by building
- the transformation with the highest number of
- tie-points, but with an acceptable mapping error */
-
- std::vector< TeCoordPair > best_tie_points;
-
- const unsigned int tiepoints_size = params.tiepoints_.size();
- unsigned int tiepoints_index = 0;
- bool point_already_present = false;
- TeGTParams curr_params = params;
-
- while( recombineSeed( comb_seed_vec, 0, tiepoints_size ) ) {
- /* Extracting tie-points from the original vector */
-
- curr_params.tiepoints_.clear();
-
- for( unsigned int comb_seed_vec_index_2 = 0 ;
- comb_seed_vec_index_2 < req_tie_pts_nmb ;
- ++comb_seed_vec_index_2 ) {
-
- curr_params.tiepoints_.push_back(
- params.tiepoints_[ comb_seed_vec[ comb_seed_vec_index_2 ] -
- 1 ] );
- }
-
- /* Trying to generate a valid transformation */
-
- if( computeParameters( curr_params ) ) {
-
- if( ( params.max_dmap_error_ >= getDirectMappingError(
- curr_params ) ) &&
- ( params.max_imap_error_ >= getInverseMappingError(
- curr_params ) ) ) {
-
- /* Trying to insert more tie-points into current
- transformation */
-
- for( tiepoints_index = 0 ; tiepoints_index < tiepoints_size ;
- ++tiepoints_index ) {
-
- /* Verifying if the current tie-point is already present */
-
- point_already_present = false;
-
- for( unsigned int comb_seed_vec_index_3 = 0 ;
- comb_seed_vec_index_3 < req_tie_pts_nmb ;
- ++comb_seed_vec_index_3 ) {
-
- if( tiepoints_index == (
- comb_seed_vec[ comb_seed_vec_index_3 ] - 1 ) ) {
-
- point_already_present = true;
- break;
- }
- }
-
- if( ! point_already_present ) {
- curr_params.tiepoints_.push_back(
- params.tiepoints_[ tiepoints_index ] );
-
- /* Verifying if the new tie-point insertion does not generate
- an invalid transformation */
-
- if( computeParameters( curr_params ) ) {
-
- if( ( params.max_dmap_error_ <
- getDirectMappingError( curr_params ) ) ||
- ( params.max_imap_error_ <
- getInverseMappingError( curr_params ) ) ) {
-
- curr_params.tiepoints_.pop_back();
- }
- } else {
- curr_params.tiepoints_.pop_back();
- }
- }
- }
-
- /* A valid transformation was generated, now verifying if the
- number of tie-poits is greater then the current best
- transformation
- */
-
- if( curr_params.tiepoints_.size() > best_tie_points.size() ) {
- best_tie_points = curr_params.tiepoints_;
- }
- }
- }
- }
-
- if( best_tie_points.size() >= req_tie_pts_nmb ) {
- curr_params.tiepoints_ = best_tie_points;
-
- if( computeParameters( curr_params ) ) {
- if( ( params.max_dmap_error_ >= getDirectMappingError(
- curr_params ) ) &&
- ( params.max_imap_error_ >= getInverseMappingError(
- curr_params ) ) ) {
-
- params = curr_params;
-
- return true;
- }
- }
- }
-
- return false;
-}
-
-
-bool TeGeometricTransformation::LWAOutRemotion(
- TeGTParams& params )
-{
- TEAGN_DEBUG_CONDITION( ( params.out_rem_strat_ ==
- TeGTParams::LWAOutRemotion ),
- "Inconsistent outliers remotion strategy" )
-
- const unsigned int req_tie_pts_nmb = getMinRequiredTiePoints();
-
- if( params.tiepoints_.size() == req_tie_pts_nmb ) {
- return computeParameters( params );
- } else if( params.tiepoints_.size() > req_tie_pts_nmb ) {
-
- /* Computing the initial global transformation */
-
- if( ! computeParameters( params ) ) {
- return false;
- }
-
- if( ( getDirectMappingError( params ) <=
- params.max_dmap_error_ ) &&
- ( getInverseMappingError( params ) <=
- params.max_imap_error_ ) ) {
-
- /* This transformation has no outliers */
-
- return true;
- }
-
- /* Global vars */
-
- const double max_dmap_error = params.max_dmap_error_;
- const double max_imap_error = params.max_imap_error_;
-
- TeGTParams params_aux = params;
-
- TeGTParams best_params;
- double best_params_dmap_error = DBL_MAX;
- double best_params_imap_error = DBL_MAX;
-
- unsigned int tpindex = 0;
- unsigned int tpsize = 0;
- double curr_dmap_error = 0;
- double curr_imap_error = 0;
- TeCoordPair* curr_tp_ptr = 0;
- TeCoordPair* curr_canditate_tp_ptr = 0;
- bool transformation_not_updated = false;
-
- /* vectors with direct and inverse mapping errors for
- the current transformation */
- std::vector< double > curr_trans_dmap_err_vec;
- curr_trans_dmap_err_vec.reserve( params.tiepoints_.size() );
- std::vector< double > curr_trans_imap_err_vec;
- curr_trans_imap_err_vec.reserve( params.tiepoints_.size() );
-
- /* The min and max values from the vectors above */
-
- double curr_trans_dmap_err_vec_min = 0;
- double curr_trans_dmap_err_vec_max = 0;
- double curr_trans_dmap_err_vec_range = 0;
- double curr_trans_imap_err_vec_min = 0;
- double curr_trans_imap_err_vec_max = 0;
- double curr_trans_imap_err_vec_range = 0;
-
- /* A map of tie-points pointers ordered by the mean of
- normalized direct and inverse mapping errors */
- std::map< double, TeCoordPair* > aux_tps_map;
-
- std::map< double, TeCoordPair* >::const_reverse_iterator
- aux_tps_map_it;
- std::map< double, TeCoordPair* >::const_reverse_iterator
- aux_tps_map_it_end;
-
- /* Iterating over the current transformation tie-points */
-
- while( params.tiepoints_.size() > req_tie_pts_nmb ) {
- tpsize = params.tiepoints_.size();
- transformation_not_updated = true;
-
- /* Calculating the two mapping errors vectors */
-
- curr_trans_dmap_err_vec_min = DBL_MAX;
- curr_trans_dmap_err_vec_max = ( -1.0 ) * DBL_MAX;
- curr_trans_imap_err_vec_min = DBL_MAX;
- curr_trans_imap_err_vec_max = ( -1.0 ) * DBL_MAX;
-
- for( tpindex = 0 ; tpindex < tpsize ; ++tpindex ) {
- curr_trans_dmap_err_vec[ tpindex ] =
- getDirectMappingError( params.tiepoints_[ tpindex ],
- params );
- if( curr_trans_dmap_err_vec_min >
- curr_trans_dmap_err_vec[ tpindex ] ) {
-
- curr_trans_dmap_err_vec_min =
- curr_trans_dmap_err_vec[ tpindex ];
- }
- if( curr_trans_dmap_err_vec_max <
- curr_trans_dmap_err_vec[ tpindex ] ) {
-
- curr_trans_dmap_err_vec_max =
- curr_trans_dmap_err_vec[ tpindex ];
- }
-
- curr_trans_imap_err_vec[ tpindex ] =
- getInverseMappingError( params.tiepoints_[ tpindex ],
- params );
- if( curr_trans_imap_err_vec_min >
- curr_trans_imap_err_vec[ tpindex ] ) {
-
- curr_trans_imap_err_vec_min =
- curr_trans_imap_err_vec[ tpindex ];
- }
- if( curr_trans_imap_err_vec_max <
- curr_trans_imap_err_vec[ tpindex ] ) {
-
- curr_trans_imap_err_vec_max =
- curr_trans_imap_err_vec[ tpindex ];
- }
- }
-
- curr_trans_dmap_err_vec_range = curr_trans_dmap_err_vec_max -
- curr_trans_dmap_err_vec_min;
- if( curr_trans_dmap_err_vec_range == 0.0 ) {
- curr_trans_dmap_err_vec_range = 1.0;
- }
-
- curr_trans_imap_err_vec_range = curr_trans_imap_err_vec_max -
- curr_trans_imap_err_vec_min;
- if( curr_trans_imap_err_vec_range == 0 ) {
- curr_trans_imap_err_vec_range = 1.0;
- }
-
- /* Creating a map with the current tie-points ordered
- by the normalized mapping errors means */
-
- aux_tps_map.clear();
-
- for( tpindex = 0 ; tpindex < tpsize ; ++tpindex ) {
- aux_tps_map[
- (
- (
- (
- curr_trans_dmap_err_vec[ tpindex ] -
- curr_trans_dmap_err_vec_min
- )
- / curr_trans_dmap_err_vec_range
- )
- +
- (
- (
- curr_trans_imap_err_vec[ tpindex ] -
- curr_trans_imap_err_vec_min
- )
- / curr_trans_imap_err_vec_range
- )
- )
- ] = &(params.tiepoints_[ tpindex ]);
- }
-
- /* Generating all possible transformations without
- each tie-point */
-
- aux_tps_map_it = aux_tps_map.rbegin();
- aux_tps_map_it_end = aux_tps_map.rend();
-
- while( aux_tps_map_it != aux_tps_map_it_end ) {
- curr_canditate_tp_ptr = aux_tps_map_it->second;
-
- /* Generating a transformation parameters without the
- current tie-point */
-
- params_aux.tiepoints_.clear();
- params_aux.direct_parameters_.Clear();
- params_aux.inverse_parameters_.Clear();
-
- for( tpindex = 0 ; tpindex < tpsize ; ++tpindex ) {
- curr_tp_ptr = &(params.tiepoints_[ tpindex ]);
-
- if( curr_tp_ptr != curr_canditate_tp_ptr ) {
- params_aux.tiepoints_.push_back( *curr_tp_ptr );
- }
- }
-
- /* Trying to generate a transformation without the current
- tie-point with tpindex index */
-
- if( computeParameters( params_aux ) ) {
- curr_dmap_error = getDirectMappingError( params_aux );
- curr_imap_error = getInverseMappingError( params_aux );
-
- if( ( best_params_dmap_error > curr_dmap_error ) &&
- ( best_params_imap_error > curr_imap_error ) ) {
-
- best_params_dmap_error = curr_dmap_error;
- best_params_imap_error = curr_imap_error;
- best_params = params_aux;
-
- params = params_aux;
-
- transformation_not_updated = false;
-
- break; /* break the current tie-points loop */
- }
- }
-
- ++aux_tps_map_it;
- }//while( aux_tps_map_it != aux_tps_map_it_end ) {
-
- if( transformation_not_updated ) {
- /* There is no way to improve the current transformation
- since all tie-points were tested */
-
- break; /* break the loop */
- } else {
- if( ( max_dmap_error >= best_params_dmap_error ) &&
- ( max_imap_error >= best_params_imap_error ) ) {
-
- /* A valid transformation was found */
- break;
- }
- }
- }//while( params.tiepoints_.size() > req_tie_pts_nmb ) {
-
- if( ( best_params.tiepoints_.size() >= req_tie_pts_nmb ) &&
- ( max_dmap_error >= best_params_dmap_error ) &&
- ( max_imap_error >= best_params_imap_error ) ) {
-
- params = best_params;
-
- return true;
- } else {
- return false;
- }
- }
-
- return false;
-}
-
-
diff --git a/src/terralib/kernel/TeGeometricTransformation.h b/src/terralib/kernel/TeGeometricTransformation.h
deleted file mode 100644
index bb3dff8..0000000
--- a/src/terralib/kernel/TeGeometricTransformation.h
+++ /dev/null
@@ -1,322 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeGeometricTransformation.h
- \brief Geometric trasformations base class.
-*/
-
-#ifndef TEGEOMETRICTRANSFORMATION_H
- #define TEGEOMETRICTRANSFORMATION_H
-
- #include "TeDefines.h"
- #include "TeCoord2D.h"
- #include "TeMatrix.h"
- #include "TeGTParams.h"
- #include "TeSharedPtr.h"
- #include "TeAgnostic.h"
-
- #include <vector>
-
- /**
- * @brief This is the base class to deal with a geometric trasformation
- * direct and inverse mapping the tie-points TeCoordPair::pt1 space into
- * TeCoordPair::pt2 space.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup Utils
- */
- class TL_DLL TeGeometricTransformation {
- public :
-
- /**
- * @typedef TeSharedPtr< TeGeometricTransformation > pointer
- * Type definition for a TeGeometricTransformation instance pointer.
- */
- typedef TeSharedPtr< TeGeometricTransformation > pointer;
-
- /**
- * @brief Default Destructor
- */
- virtual ~TeGeometricTransformation();
-
- /**
- * @brief Direct mapping ( from pt1 space into pt2 space ).
- *
- * @param pt1 pt1 coordinate.
- * @param pt2 pt2 coordinate.
- */
- inline void directMap( const TeCoord2D& pt1, TeCoord2D& pt2 ) const
- {
- TEAGN_DEBUG_CONDITION(
- ( internal_params_.direct_parameters_.Ncol() > 0 ),
- "Invalid number of parameters columns" )
- TEAGN_DEBUG_CONDITION(
- ( internal_params_.direct_parameters_.Nrow() > 0 ),
- "Invalid number of parameters rows" )
-
- directMap( internal_params_, pt1, pt2 );
- };
-
- /**
- * @brief Inverse mapping ( from pt2 space into pt1 space ).
- *
- * @param pt2 pt2 coordinate.
- * @param pt1 pt1 coordinate.
- */
- inline void inverseMap( const TeCoord2D& pt2,
- TeCoord2D& pt1 ) const
- {
- TEAGN_DEBUG_CONDITION(
- ( internal_params_.inverse_parameters_.Ncol() > 0 ),
- "Invalid number of parameters columns" )
- TEAGN_DEBUG_CONDITION(
- ( internal_params_.inverse_parameters_.Nrow() > 0 ),
- "Invalid number of parameters rows" )
-
- inverseMap( internal_params_, pt2, pt1 );
- };
-
- /**
- * @brief Reset the current transformation following the new supplied
- * parameters.
- *
- * @param newparams The new parameters.
- * @return true if OK, false on errors.
- */
- bool reset( const TeGTParams& newparams );
-
- /**
- * @brief Returns a copy of the current internal transformation parameters.
- *
- * @param params The internal parameters copy.
- */
- void getParameters( TeGTParams& params ) const;
-
- /**
- * @brief Calculates the current transformation maximum direct mapping
- * error ( from pt1 space into pt2 space ).
- *
- * @return The current maximum direct mapping error.
- */
- inline double getDirectMappingError() const
- {
- TEAGN_DEBUG_CONDITION(
- ( internal_params_.tiepoints_.size() > 0 ),
- "Invalid tie-points vector size" )
-
- return getDirectMappingError( internal_params_ );
- };
-
- /**
- * @brief Calculates the current transformation maximum inverse mapping
- * error ( from pt2 space into pt1 space ).
- *
- * @return The current maximum inverse mapping error.
- */
- inline double getInverseMappingError() const
- {
- TEAGN_DEBUG_CONDITION(
- ( internal_params_.tiepoints_.size() > 0 ),
- "Invalid tie-points vector size" )
-
- return getInverseMappingError( internal_params_ );
- };
-
- /**
- * @brief Calculates the direct mapping error for the supplied tie-point
- * ( from pt1 space into pt2 space ).
- *
- * @param tie_point The tie-point.
- * @return The current direct mapping error.
- */
- inline double getDirectMappingError( const TeCoordPair& tie_point ) const
- {
- TEAGN_DEBUG_CONDITION(
- ( internal_params_.tiepoints_.size() > 0 ),
- "Invalid tie-points vector size" )
-
- return getDirectMappingError( tie_point, internal_params_ );
- };
-
- /**
- * @brief Calculates the inverse mapping error for the supplied tie-point
- * ( from pt2 space into pt1 space ).
- *
- * @param tie_point The tie-point.
- * @return The current inverse mapping error.
- */
- inline double getInverseMappingError( const TeCoordPair& tie_point ) const
- {
- TEAGN_DEBUG_CONDITION(
- ( internal_params_.tiepoints_.size() > 0 ),
- "Invalid tie-points vector size" )
-
- return getInverseMappingError( tie_point, internal_params_ );
- };
-
- /**
- * @brief Returns the minimum number of required tie-points for the current
- * transformation.
- *
- * @return The minimum number of required tie-points for the current
- * transformation.
- */
- virtual unsigned int getMinRequiredTiePoints() const = 0;
-
- /**
- * @brief Returns a default object.
- *
- * @return A default object.
- */
- static TeGeometricTransformation* DefaultObject(
- const TeGTParams& );
-
- protected :
-
- /**
- * @brief Default Constructor.
- */
- TeGeometricTransformation();
-
- /**
- * @brief Direct mapping ( from pt1 space into pt2 space ).
- *
- * @param params Transformation parameters.
- * @param pt1 pt1 coordinate.
- * @param pt2 pt2 coordinate.
- */
- virtual void directMap( const TeGTParams& params,
- const TeCoord2D& pt1, TeCoord2D& pt2 ) const = 0;
-
- /**
- * @brief Inverse mapping ( from pt2 space into pt1 space ).
- *
- * @param params Transformation parameters.
- * @param pt2 pt2 coordinate.
- * @param pt1 pt1 coordinate.
- */
- virtual void inverseMap( const TeGTParams& params,
- const TeCoord2D& pt2,
- TeCoord2D& pt1 ) const = 0;
-
- /**
- * @brief Calculate the transformation parameters following the
- * new supplied tie-points.
- *
- * @param params Transformation parameters.
- * @return true if OK, false on errors.
- */
- virtual bool computeParameters( TeGTParams& params ) = 0;
-
- /**
- * @brief Calculates maximum direct mapping error for the supplied
- * parameters ( from pt1 space into pt2 space ).
- *
- * @param params Transformation parameters.
- * @return The maximum direct mapping error for the supplied parameters.
- */
- double getDirectMappingError( const TeGTParams& params ) const;
-
- /**
- * @brief Calculates maximum inverse mapping error for the supplied
- * parameters ( from pt2 space into pt1 space ).
- *
- * @param params Transformation parameters.
- * @return The maximum inverse mapping error for the supplied parameters.
- */
- double getInverseMappingError( const TeGTParams& params ) const;
-
- /**
- * @brief Calculates the direct mapping error for the supplied tie-point.
- * ( from pt1 space into pt2 space ).
- *
- * @param tie_point The tie-point.
- * @param params Transformation parameters.
- * @return The current maximum direct mapping error.
- */
- double getDirectMappingError( const TeCoordPair& tie_point,
- const TeGTParams& params ) const;
-
- /**
- * @brief Calculates the inverse mapping error for the supplied tie-point.
- * ( from pt2 space into pt1 space ).
- *
- * @param tie_point The tie-point.
- * @param params Transformation parameters.
- * @return The current maximum inverse mapping error.
- */
- double getInverseMappingError( const TeCoordPair& tie_point,
- const TeGTParams& params ) const;
-
- private :
-
- /**
- * @brief The current internal parameters.
- */
- TeGTParams internal_params_;
-
- /**
- * @brief Operator= overload.
- *
- * @param external External instance reference.
- *
- * @return The external instance reference.
- */
- const TeGeometricTransformation& operator=(
- const TeGeometricTransformation& ) { return *this; };
-
- /**
- * @brief Recombine a seed vector without repetition (the number of combined
- * elements on each iteration will follow the vectors size.
- *
- * @param seed Seed vector.
- * @param elements_nmb Number of elements to be permutated
- * @param seedpos Location inside the seed vector where to begin
- * the permutation.
- * @return TRUE if a permutation was made, FALSE if no more
- * permutation are left to made.
- *
- * @note All initial fields must be set to value 0 for the initial seed.
- */
- bool recombineSeed( std::vector<unsigned int>& seed,
- const unsigned int& seedpos, const unsigned int& elements_nmb ) const;
-
- /**
- * @brief Exaustive outliers remotion strategy (All tie-points
- * combinations will be tested).
- * @param params The current transformation parameters.
- * @return TRUE if OK, false on errors.
- */
- bool exaustiveOutRemotion( TeGTParams& params );
-
- /**
- * @brief Leave-worse-out outliers remotion strategy
- * (On each iteration the worse tie-point will be
- * removed).
- * @param params The current transformation parameters.
- * @return TRUE if OK, false on errors.
- */
- bool LWAOutRemotion( TeGTParams& params );
-
- };
-
-#endif
-
diff --git a/src/terralib/kernel/TeGeometry.cpp b/src/terralib/kernel/TeGeometry.cpp
index 5abf4c1..f8ce3f0 100644
--- a/src/terralib/kernel/TeGeometry.cpp
+++ b/src/terralib/kernel/TeGeometry.cpp
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#include "TeGeometry.h"
#include "TeException.h"
diff --git a/src/terralib/kernel/TeGeometry.h b/src/terralib/kernel/TeGeometry.h
index 15095f6..1a8b0e4 100644
--- a/src/terralib/kernel/TeGeometry.h
+++ b/src/terralib/kernel/TeGeometry.h
@@ -1,25 +1,14 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
+
/*! \file TeGeometry.h
\brief This file contains structures and definitions about geometries support in TerraLib
*/
diff --git a/src/terralib/kernel/TeGeometryAlgorithms.cpp b/src/terralib/kernel/TeGeometryAlgorithms.cpp
deleted file mode 100644
index 10736aa..0000000
--- a/src/terralib/kernel/TeGeometryAlgorithms.cpp
+++ /dev/null
@@ -1,2834 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeAssertions.h"
-#include "TeGeometryAlgorithms.h"
-#include "TeDefines.h"
-
-#include "TeIntersector.h"
-#include "TeFragmentation.h"
-
-#include <algorithm>
-#include <set>
-
-
-using namespace std;
-
-//---------- Local Functions ans Structures ----------//
-
-//! Instead of using arctan, use this to compare angles, so given two points return a number to be used in place of the angle formed by the segment.
-double Theta(const TeCoord2D& c1, const TeCoord2D& c2)
-{
- register double dx = c2.x() - c1.x();
- register double ax = fabs(dx);
- register double dy = c2.y() - c1.y();
- register double ay = fabs(dy);
- register double t = 0.0;
-
- if((dx == 0.0) && (dy == 0.0))
- t = 0.0;
- else
- t = dy / (ax + ay);
-
- if(dx < 0.0)
- t = 2 - t;
- else
- if(dy < 0.0)
- t = 4.0 + t;
-
- return t * 90.0;
-}
-
-//! This struct is used for compare angles between two points and an anchor.
-struct ThetaOrder
-{
- //! A fixed coordinate to be used to compare.
- TeCoord2D anchor;
-
- ThetaOrder(const TeCoord2D& c)
- : anchor(c)
- {
- }
-
- // Return true if c1 and anchor has a smaller angle than c2 and anchor.
- bool operator()(const TeCoord2D& c1, const TeCoord2D& c2) const
- {
- register double t1 = Theta(anchor, c1);
- register double t2 = Theta(anchor, c2);
-
- if(t1 < t2)
- return true;
-
- if(t1 > t2)
- return false;
-
- if(c1.x() < c2.x())
- return true;
-
- if(c1.x() > c2.x())
- return false;
-
- return false;
- }
-};
-
-/*! \struct xOrder
- \brief Returns true if c1 < c2 otherwise, returns false.
- */
-template<class T> struct xOrder
-{
- bool operator()(T c1, T c2)
- {
- if(c1.x() < c2.x())
- return true;
-
- if(c1.x() > c2.x())
- return false;
-
- if(c1.y() < c2.y())
- return true;
-
- return false;
- }
-};
-
-/*! \fn double TeArea(TeLinearRing& r);
- \brief This function returns twice the area of a ring treated as a simple polygon (no holes).
- \param r The ring.
-
- This function returns twice the area of a ring treated as a simple polygon (no holes).
- May return a negative number => it will be used in Orientation tests.
-*/
-double Te2Area(const TeLinearRing& r)
-{
- double S2 = 0.0;
-
- TeLinearRing::iterator it = r.begin();
- TeLinearRing::iterator end = r.end() - 1;
- while(it != end)
- {
- S2 += (it->x() + (it + 1)->x()) * ((it + 1)->y() - it->y());
- ++it;
- }
-
- return S2;
-}
-
-/*! \fn short TeConverseRelation(const short& rel)
- \brief This function returns the complements relation of one given relation.
- \param rel The relation.
-*/
-inline short ConverseRelation(const short& rel)
-{
- switch(rel)
- {
- case TeCOVEREDBY : return TeCOVERS;
- case TeWITHIN : return TeCONTAINS;
- case TeCOVERS : return TeCOVEREDBY;
- case TeCONTAINS : return TeWITHIN;
- default : return rel;
- }
-}
-
-/*! \fn bool MayTouches(const TeLine2D& lRed, const TeLine2D& lBlue, TeINTERSECTOR2::TeReportTree& report)
- \brief This function verifies if the two lines may touches.
- \param lRed The first line.
- \param lBlue The second line.
- \param report The intersection point list.
-*/
-bool MayTouches(const TeLine2D& lRed, const TeLine2D& lBlue, TeINTERSECTOR2::TeVectorBoundaryIP& report)
-{
- if(lRed.isRing() && lBlue.isRing())
- return false;
-
- TeINTERSECTOR2::TeVectorBoundaryIP::iterator it = report.begin();
- TeINTERSECTOR2::TeVectorBoundaryIP::iterator it_end = report.end();
-
-
- // Get the boundaries' coordinate.
- TeCoord2D line1_boundary1 = lRed[0];
- TeCoord2D line1_boundary2 = lRed[lRed.size() - 1u];
-
- TeCoord2D line2_boundary1 = lBlue[0];
- TeCoord2D line2_boundary2 = lBlue[lBlue.size() - 1u];
-
- // Verifies if intersection points are on boundary of one of the blue line
- while(it != it_end)
- { // Get intersection point coordinate.
-
- for(unsigned int i = 0; i < it->coords_.size(); ++i)
- {
- TeCoord2D ip_coord = it->coords_[i];
-
- if(lRed.isRing())
- {
- if(!(TeEquals(ip_coord, line2_boundary1) || TeEquals(ip_coord, line2_boundary2)))
- return false;
- }
- else if(lBlue.isRing())
- {
- if(!(TeEquals(ip_coord, line1_boundary1) || TeEquals(ip_coord, line1_boundary2)))
- return false;
- }
- else
- {
- if(!(TeEquals(ip_coord, line1_boundary1) || TeEquals(ip_coord, line1_boundary2) || TeEquals(ip_coord, line2_boundary1) || TeEquals(ip_coord, line2_boundary2)))
- return false;
- }
- }
-
- ++it;
- }
-
- return true; // The lines touches.
-}
-
-/*! \fn short Relation(const TeLine2D& lRed, const TeLine2D& lBlue, TeINTERSECTOR2::TeReportTree& report, const short& relation)
- \brief This function returns the relation between two lines.
- \param lRed The first line.
- \param lBlue The second line.
- \param report The intersection point list.
- \param relation The relation that stop the search.
-
- This function returns the relation between lines. May be: TeDISJOINT, TeTOUCHES, TeWITHIN, TeCROSSES, TeCOVEREDBY, TeEQUALS.
- Obs: Doesn't do box elimination. You must implement the test in your own functions.
-*/
-short Relation(const TeLine2D& lRed, const TeLine2D& lBlue, TeINTERSECTOR2::TeVectorBoundaryIP& report, const short& relation)
-{
- if(report.size() == 0u)
- return TeDISJOINT;
-
- // Do fragmentation
- //bool hasContour = false; // This will decide between CROSSES and OVERLAPS.
-
- bool mayTouches = MayTouches(lRed, lBlue, report);
-
- // Stop to check, because touches can't occur anymore
- if(relation == TeTOUCHES && !mayTouches)
- return TeUNDEFINEDREL;
-
-
- TeLineSet redFragments;
- TeLineSet redBoundaryFragments;
- TeLine2D lRedAux;
- lRedAux.copyElements(lRed);
- TeLineSet lSet; lSet.add(lRedAux);
-
- TeFragmentBoundary(lSet, report, redBoundaryFragments, redFragments);
-
- unsigned int redFragmentsSize = redFragments.size();
-
- short mask = TeUNKNOWNPOSITION;
-
- if(redBoundaryFragments.size() > 0u)
- mask |= TeINSIDE;
-
- // Do a position test for each fragment and stop if all relations have been found.
- for(unsigned int j = 0u; j < redFragmentsSize; ++j)
- {
- TeCoord2D middle;
-
- if(redFragments[j].size() == 2u) // If the fragment has two points I need to check the middle point of this fragment.
- TeGetMiddlePoint(redFragments[j][0u], redFragments[j][1u], middle);
- else // If the fragment has more than two points so I check one point between the end points.
- middle = redFragments[j][(unsigned int)((double(redFragments[j].size()) / 2.0 + 0.5)) - 1];
-
- if(TeIsOnLine(middle, lBlue))
- mask |= TeINSIDE;
- else
- mask |= TeOUTSIDE;
-
- if((mask & TeOUTSIDE) && (mask & TeINSIDE))
- break;
- }
-
- // If the intersection is only at end points and there is no part of red line inside blue line so they touches
- if(mayTouches && mask == TeOUTSIDE)
- {
- return TeTOUCHES;
- }
-
- // Stop to check, because touches can't occur anymore
- if(relation == TeTOUCHES)
- return TeUNDEFINEDREL;
-
-
- // if there is no fragments in line blue interiors, so line red cross line blue
- if(mask == TeOUTSIDE)
- return TeCROSSES;
-
- // Stop to check, because crosses can't occur anymore
- if(relation == TeCROSSES)
- return TeUNDEFINEDREL;
-
- TeCoord2D firstRedCoord = lRed[0];
- TeCoord2D lastRedCoord = lRed[lRed.size() - 1];
-
- TeCoord2D firstBlueCoord = lBlue[0];
- TeCoord2D lastBlueCoord = lBlue[lBlue.size() - 1];
-
-
- // If there is no part of red line outside blue line => must decide within, covered by and equals
- if(!(mask & TeOUTSIDE))
- {
- // So, if we arrived here, blue line contains red line, but needs to decide between equal, coveredby and within.
-
- if(TeEquals(firstRedCoord, firstBlueCoord) || TeEquals(firstRedCoord, lastBlueCoord))
- {
- if(TeEquals(lastRedCoord, firstBlueCoord) || TeEquals(lastRedCoord, lastBlueCoord))
- {
- return TeEQUALS;
- }
- else
- {
- if(lBlue.isRing())
- return TeWITHIN;
- else
- return TeCOVEREDBY;
- }
- }
-
- if(TeEquals(lastRedCoord, firstBlueCoord) || TeEquals(lastRedCoord, lastBlueCoord))
- {
- if(lBlue.isRing())
- return TeWITHIN;
- else
- return TeCOVEREDBY;
- }
-
- return TeWITHIN;
- }
-
- return TeUNDEFINEDREL;
-}
-
-/*! \fn short Relation(const TeLine2D& line, const TeLinearRing& ring, const short& relation)
- \brief This function returns the relation between a line and a linear ring (treated as a simple polygon with no holes).
- \param line The line.
- \param ring The simple polygon ring.
-
- This function returns how the points of input line are related with interior, boundary, and
- exterior of polygon. The mask may be a combination of the following values: TeOUTSIDE, TeINSIDE and TeBOUNDARY.
- Obs: Do box elimination.
-*/
-short Relation(const TeLine2D& line, const TeLinearRing& ring)
-{
- if(TeDisjoint(line.box(), ring.box()))
- return TeOUTSIDE;
-
- TeINTERSECTOR2::TeVectorBoundaryIP report;
-
- if(TeINTERSECTOR2::TeSafeIntersections(line, ring, report))
- {
- short mask = TeBOUNDARY; // It will be at least intersections between boundaries.
-
- // Fragments line.
- TeLineSet lSet;
- TeLineSet boundaryFragments;
- TeLine2D lineAux;
- lineAux.copyElements(line);
- TeLineSet auxLineSet; auxLineSet.add(lineAux);
-
- TeFragmentBoundary(auxLineSet, report, boundaryFragments, lSet);
-
-
- unsigned int lSetSize = lSet.size();
-
- // Do a position test for each fragment and stop if al relations has been found.
- for(unsigned int j = 0; j < lSetSize; ++j)
- {
- TeCoord2D middle;
-
- if(lSet[j].size() == 2) // If the fragment has two points I need to check the middle point of this fragment.
- TeGetMiddlePoint(lSet[j][0], lSet[j][1], middle);
- else // If the fragment has more than two points so I check one point between the end points.
- middle = lSet[j][(unsigned int)((double(lSet[j].size()) / 2.0 + 0.5)) - 1];
-
-
- mask |= TeRelation(middle, ring);
-
- if((mask & TeOUTSIDE) && (mask & TeINSIDE))
- break;
- }
-
- return mask;
- }
- else
- return TeRelation(line[0], ring); // Needs to test only one point of the line, and its location defines the line location.
-}
-
-/*! \fn short TopologicRelation(const TeLine2D& line, const TeLinearRing& r)
- \brief This function returns the relation between a line and a linear ring (treated as a simple polygon with no holes).
- \param line The line.
- \param r The simple polygon ring.
-
- This function returns the topologic relation between the line and
- the ring. The result may be: DISJOINT, WITHIN, TOUCHES, CROSSES or COVERED BY.
- Obs: Doesn't do box elimination. Just uses from TeRelation.
-*/
-short TopologicRelation(const TeLine2D& line, const TeLinearRing& r)
-{
- short mask = Relation(line, r);
-
- if(mask & TeBOUNDARY) // TOUCHES or CROSSES or COVERED BY
- {
- if(mask & TeOUTSIDE) // TOUCHES or CROSSES
- {
- if(mask & TeINSIDE)
- return TeCROSSES;
- else
- return TeTOUCHES;
- }
- else // COVERED BY
- return TeCOVEREDBY;
-
- }
- else // DISJOINT or WITHIN
- {
- if(mask & TeINSIDE)
- return TeWITHIN;
- else
- return TeDISJOINT;
- }
-}
-
-/*! \fn short TopologicRelation(const TeLinearRing& rRed, const TeLinearRing& rBlue)
- \brief This function returns the relationship between two rings (treated as simple polygons with no holes).
- \param rRed The ring to test relationship.
- \param rBlue The ring to test relationship.
-
- This function returns the relationship between two rings.
-*/
-short TopologicRelation(const TeLinearRing& rRed, const TeLinearRing& rBlue)
-{
- // See the intersection between the points of rRed and the three components of rBlue (Boundary, Exterior, Interior)
- short rel = Relation(rRed, rBlue);
-
- if((rel & TeOUTSIDE) && (rel & TeINSIDE) && (rel & TeBOUNDARY))
- return TeOVERLAPS;
-
- if((rel & TeOUTSIDE) && !(rel & TeINSIDE) && (rel & TeBOUNDARY))
- {
- if(TeWithinOrCoveredByOrEquals(rBlue.box(), rRed.box()))
- {
- short rel_aux = Relation(rBlue, rRed);
-
- if((rel_aux & TeINSIDE) && !(rel_aux & TeOUTSIDE) && (rel_aux & TeBOUNDARY))
- return TeCOVERS;
- }
-
- return TeTOUCHES;
- }
-
- if((rel & TeOUTSIDE) && !(rel & TeINSIDE) && !(rel & TeBOUNDARY))
- {
- if(TeWithinOrCoveredByOrEquals(rBlue.box(), rRed.box()))
- {
- if(TeRelation(rBlue[0], rRed) == TeINSIDE)
- return TeCONTAINS;
- }
-
- return TeDISJOINT;
- }
-
- if(!(rel & TeOUTSIDE) && (rel & TeINSIDE) && !(rel & TeBOUNDARY))
- return TeWITHIN;
-
- if(!(rel & TeOUTSIDE) && (rel & TeINSIDE) && (rel & TeBOUNDARY))
- return TeCOVEREDBY;
-
- if(rel == TeBOUNDARY)
- return TeEQUALS;
-
- return TeINTERSECTS;
-}
-
-/*! \fn short TeTopologicRelation(const TeLinearRing& rRed, const TeLinearRing& rBlue, vector<TeLinearRing>& rings, short& rel)
- \brief This function returns the relationship between the ring and the polygon inner rings.
- \param rRed The ring to test relationship.
- \param pBlue The polygon to test relationship.
- \param rings Inner rings from blue polygon that is inside or is covered by red external polygon.
- \param rel The relation between external red ring and external blue ring.
-
- This function returns the relationship between the ring and the polygon inner rings.
-*/
-short LookAtInnerRings(const TeLinearRing& rRed, const TePolygon& pBlue, vector<TeLinearRing>& rings, short& rel)
-{
- register unsigned int i = 1;
- register unsigned int nRings = pBlue.size();
-
- for(; i < nRings; ++i)
- {
- switch(TopologicRelation(rRed, pBlue[i]))
- {
- case TeCOVEREDBY : return TeTOUCHES;
-
- case TeWITHIN : return TeDISJOINT;
-
- case TeOVERLAPS : return TeOVERLAPS;
-
- case TeEQUALS : return TeTOUCHES;
-
- case TeDISJOINT : continue; // this ring is outside the external ring, so it doesn't contribute to the relationship.
-
- case TeTOUCHES : rel = TeCOVEREDBY; // change rel if rel is within.
- continue;
-
- case TeCOVERS : rings.push_back(pBlue[i]);
- rel = TeCOVEREDBY;
- break;
-
- case TeCONTAINS : rings.push_back(pBlue[i]);
- break;
- }
- }
-
- return TeUNDEFINEDREL;
-}
-
-/*! \fn short TestInnerRings(const TePolygon& pRed, vector<TeLinearRing>& rings)
- \brief This function returns the relationship between the ring and the polygon inner rings.
- \param pRed The inner rings from pRed to test relationship.
- \param rings Inner rings from blue polygon that is inside or is covered by red external polygon.
-
- This function returns the relationship between the inner ring of pRed and the inner rings in rings.
-*/
-short TestInnerRings(const TePolygon& pRed, vector<TeLinearRing>& rings)
-{
- unsigned int nRedRings = pRed.size();
- unsigned int nBlueRings = rings.size();
-
- if((nRedRings - 1) != nBlueRings)
- return TeOVERLAPS;
-
- unsigned int i = 1;
- unsigned int j = 0;
-
- bool find = false;
-
- set<unsigned int> blueRingsProcessed;
-
- set<unsigned int> redRingsContainsCovers;
-
- short rel = 0;
-
- for(; i < nRedRings; ++i)
- {
- find = false;
-
- for(j = 0; j < nBlueRings; ++j)
- {
- if(blueRingsProcessed.find(j) != blueRingsProcessed.end())
- continue;
-
- switch(TopologicRelation(pRed[i], rings[j]))
- {
- case TeDISJOINT : continue; // so it doesn't contribute to the relationship yet.
-
- case TeEQUALS :
- rel |= TeEQUALS;
- blueRingsProcessed.insert(j);
- find = true;
- break;
-
- case TeCONTAINS :
- if(redRingsContainsCovers.find(i) != redRingsContainsCovers.end())
- return TeOVERLAPS;
-
- rel |= TeCONTAINS;
-
- redRingsContainsCovers.insert(i);
- blueRingsProcessed.insert(j);
- find = true;
- break;
-
- case TeCOVERS :
- if(redRingsContainsCovers.find(i) != redRingsContainsCovers.end())
- return TeOVERLAPS;
-
- rel |= TeCOVERS;
-
- redRingsContainsCovers.insert(i);
- blueRingsProcessed.insert(j);
- find = true;
- break;
-
-
- default : return TeOVERLAPS;
- }
-
- if(find)
- break;
- }
-
- if(!find)
- return TeOVERLAPS;
- }
-
- return rel;
-}
-
-//---------- Topological Function ----------//
-
-// EQUALS
-template<> bool TeEquals(const TeCoord2D& c1, const TeCoord2D& c2)
-{
- if(TeGeometryAlgorithmsPrecision::IsDifferent(c1.x(), c2.x()))
- return false;
-
- if(TeGeometryAlgorithmsPrecision::IsDifferent(c1.y(), c2.y()))
- return false;
-
- return true;
-}
-
-template<> bool TeEquals(const TePoint& p1, const TePoint& p2)
-{
- return TeEquals(p1.location(), p2.location());
-}
-
-template<> bool TeEquals(const TeLine2D& redLine, const TeLine2D& blueLine)
-{
- if(TeEquals(redLine.box(), blueLine.box()))
- return TeRelation(redLine, blueLine, TeEQUALS) == TeEQUALS;
- else
- return false;
-}
-
-template<> bool TeEquals(const TePolygon& redPol, const TePolygon& bluePol)
-{
- if(TeEquals(redPol.box(), bluePol.box()))
- {
- if(redPol.size() != bluePol.size())
- return false;
-
- return TeRelation(redPol, bluePol) == TeEQUALS;
- }
- else
- return false;
-}
-
-template<> bool TeEquals( const TePolygonSet& ps1, const TePolygonSet& ps2 )
-{
- if( ps1.size() == ps2.size() ) {
- TePolygonSet::iterator it1 = ps1.begin();
- TePolygonSet::iterator it1_end = ps1.end();
- TePolygonSet::iterator it2 = ps2.begin();
-
- while( it1 != it1_end ) {
- if( ! TeEquals( (*it1), (*it2) ) ) {
- return false;
- }
-
- ++it1;
- ++it2;
- }
-
- return true;
- } else {
- return false;
- }
-}
-
-template<> bool TeEquals(const TeBox& bx1, const TeBox& bx2)
-{
- if(TeGeometryAlgorithmsPrecision::IsDifferent(bx1.x1(), bx2.x1()))
- return false;
-
- if(TeGeometryAlgorithmsPrecision::IsDifferent(bx1.y1(), bx2.y1()))
- return false;
-
- if(TeGeometryAlgorithmsPrecision::IsDifferent(bx1.x2(), bx2.x2()))
- return false;
-
- if(TeGeometryAlgorithmsPrecision::IsDifferent(bx1.y2(), bx2.y2()))
- return false;
-
- return true;
-}
-
-template<> bool TeEquals(const TeCell& cell1, const TeCell& cell2)
-{
- return TeEquals(cell1.box(), cell2.box());
-}
-
-
-// DISJOINT
-bool TeDisjoint(const TeCoord2D& c1, const TeCoord2D& c2)
-{
- if(TeGeometryAlgorithmsPrecision::IsDifferent(c1.x(), c2.x()))
- return true;
-
- if(TeGeometryAlgorithmsPrecision::IsDifferent(c1.y(), c2.y()))
- return true;
-
- return false;
-}
-
-bool TeDisjoint(const TeCoord2D& c, const TeBox& b)
-{
- // c to the right of b
- if(TeGeometryAlgorithmsPrecision::IsGreater(c.x(), b.x2()))
- return true;
-
- // c to the left of b
- if(TeGeometryAlgorithmsPrecision::IsGreater(b.x1(), c.x()))
- return true;
-
- // c is above b
- if(TeGeometryAlgorithmsPrecision::IsGreater(c.y(), b.y2()))
- return true;
-
- // c is below b
- if(TeGeometryAlgorithmsPrecision::IsGreater(b.y1(), c.y()))
- return true;
-
- return false;
-}
-
-bool TeDisjoint(const TeBox& bx1, const TeBox& bx2)
-{
- // B1 to the right of B2
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx1.x1(), bx2.x2()))
- return true;
-
- // B1 to the left of B2
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx2.x1(), bx1.x2()))
- return true;
-
- // B2 is above B1
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx2.y1(), bx1.y2()))
- return true;
-
- // B2 is below B1
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx1.y1(), bx2.y2()))
- return true;
-
- return false;
-}
-
-bool TeDisjoint(const TeCoord2D& c, const TeLine2D& l)
-{
- return TeRelation(c, l) == TeOUTSIDE;
-}
-
-bool TeDisjoint(const TeCoord2D& c, const TePolygon& pol)
-{
- return TeRelation(c, pol) == TeOUTSIDE;
-}
-
-bool TeDisjoint(const TePoint& p1, const TePoint& p2)
-{
- return TeDisjoint(p1.location(), p2.location());
-}
-
-bool TeDisjoint(const TePoint& p, const TeLine2D& l)
-{
- return TeDisjoint(p.location(), l);
-}
-
-bool TeDisjoint(const TePoint& p, const TePolygon& pol)
-{
- return TeDisjoint(p.location(), pol);
-}
-
-bool TeDisjoint(const TeLine2D& redLine, const TeLine2D& blueLine)
-{
- if(TeDisjoint(redLine.box(), blueLine.box()))
- return true;
-
- return !TeINTERSECTOR2::TeIntersects(redLine, blueLine);
-}
-
-bool TeDisjoint(const TeLine2D& l, const TePolygon& pol)
-{
- if(TeDisjoint(l.box(), pol.box()))
- return true;
-
- return TeRelation(l, pol) == TeDISJOINT;
-}
-
-bool TeDisjoint(const TePolygon& redPol, const TePolygon& bluePol)
-{
- if(TeDisjoint(redPol.box(), bluePol.box()))
- return true;
- else
- return TeRelation(redPol, bluePol) == TeDISJOINT;
-}
-
-bool TeDisjoint(const TeCell& cell1, const TeCell& cell2)
-{
- return TeDisjoint(cell1.box(), cell2.box());
-}
-
-bool TeDisjoint(const TeCell& cell, const TeLine2D& line)
-{
- return TeDisjoint(line, TeMakePolygon(cell.box()));
-}
-
-bool TeDisjoint(const TeCell& cell, const TePolygon& pol)
-{
- return TeDisjoint(pol, TeMakePolygon(cell.box()));
-}
-
-bool TeDisjoint(const TeCell& cell, const TePoint& point)
-{
- return TeDisjoint(point.location(), cell.box());
-}
-
-
-// INTERSECTS
-
-template<> bool TeIntersects(const TeCoord2D& c, const TeBox& b)
-{
- // c to the right of b
- if(TeGeometryAlgorithmsPrecision::IsGreater(c.x(), b.x2()))
- return false;
-
- // c to the left of b
- if(TeGeometryAlgorithmsPrecision::IsGreater(b.x1(), c.x()))
- return false;
-
- // c is above b
- if(TeGeometryAlgorithmsPrecision::IsGreater(c.y(), b.y2()))
- return false;
-
- // c is below b
- if(TeGeometryAlgorithmsPrecision::IsGreater(b.y1(), c.y()))
- return false;
-
- return true;
-}
-
-template<> bool TeIntersects(const TePoint& p, const TeBox& b)
-{
- return TeIntersects(p.location(), b);
-}
-
-template<> bool TeIntersects(const TeBox& bx1, const TeBox& bx2)
-{
- // B1 to the right of B2
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx1.x1(), bx2.x2()))
- return false;
-
- // B1 to the left of B2
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx2.x1(), bx1.x2()))
- return false;
-
- // B2 is above B1
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx2.y1(), bx1.y2()))
- return false;
-
- // B2 is below B1
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx1.y1(), bx2.y2()))
- return false;
-
- return true;
-}
-
-
-// TOUCHES
-bool TeTouches(const TeCoord2D& c, const TeLine2D& l)
-{
- return TeRelation(c, l) == TeBOUNDARY;
-}
-
-bool TeTouches(const TeCoord2D& c, const TePolygon& pol)
-{
- return TeRelation(c, pol) == TeBOUNDARY;
-}
-
-bool TeTouches(const TePoint& p, const TeLine2D& l)
-{
- return TeTouches(p.location(), l);
-}
-
-bool TeTouches(const TePoint& p, const TePolygon& pol)
-{
- return TeTouches(p.location(), pol);
-}
-
-bool TeTouches(const TeLine2D& redLine, const TeLine2D& blueLine)
-{
- if(TeDisjoint(redLine.box(), blueLine.box()))
- return false;
-
- return TeRelation(redLine, blueLine, TeTOUCHES) == TeTOUCHES;
-}
-
-bool TeTouches(const TeLine2D& l, const TePolygon& pol)
-{
- if(TeDisjoint(l.box(), pol.box()))
- return false;
-
- return TeRelation(l, pol) == TeTOUCHES;
-}
-
-bool TeTouches(const TePolygon& redPol, const TePolygon& bluePol)
-{
- if(TeDisjoint(redPol.box(), bluePol.box()))
- return false;
-
- return TeRelation(redPol, bluePol) == TeTOUCHES;
-}
-
-bool TeTouches(const TeBox& bx1, const TeBox& bx2)
-{
- // bx1 may touches its right wall in bx2 left wall
- // or bx1 may touches its left wall in bx2 right wall
- if(TeGeometryAlgorithmsPrecision::IsEqual(bx1.x2(), bx2.x1()) || TeGeometryAlgorithmsPrecision::IsEqual(bx1.x1(), bx2.x2()))
- {
- // bx1 is below bx2
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx2.y1(), bx1.y2()))
- return false;
-
- // bx1 is above bx2
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx1.y1(), bx2.y2()))
- return false;
-
- // touches
- return true;
- }
-
- // bx1 may touches its bottom wall in bx2 top wall
- // or bx1 may touches its top wall in bx2 bottom wall
- if(TeGeometryAlgorithmsPrecision::IsEqual(bx1.y1(), bx2.y2()) || TeGeometryAlgorithmsPrecision::IsEqual(bx1.y2(), bx2.y1()))
- {
- // bx1 is left of bx2
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx2.x1(), bx1.x2()))
- return false;
-
- // bx1 is right of bx2
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx1.x1(), bx2.x2()))
- return false;
-
- // touches
- return true;
- }
-
- // doesn't touches
- return false;
-}
-
-bool TeTouches(const TeCell& c1, const TeCell& c2)
-{
- return TeTouches(c1.box(), c2.box());
-}
-
-bool TeTouches(const TeLine2D& line, const TeCell& cell)
-{
- return TeTouches(line, TeMakePolygon(cell.box()));
-}
-
-bool TeTouches(const TeCell& c1, const TePolygon& poly)
-{
- return TeTouches (poly, TeMakePolygon(c1.box()));
-}
-
-bool TeTouches(const TePoint& point,const TeCell& c1)
-{
- return TeTouches(point.location(), TeMakePolygon(c1.box()));
-}
-
-
-// CROSSES
-bool TeCrosses(const TeLine2D& redLine, const TeLine2D& blueLine)
-{
- if(TeDisjoint(redLine.box(), blueLine.box()))
- return false;
- else
- return TeRelation(redLine, blueLine, TeCROSSES) == TeCROSSES;
-}
-
-bool TeCrosses(const TeLine2D& l, const TePolygon& pol)
-{
- if(TeDisjointOrTouches(l.box(), pol.box()))
- return false;
- else
- return TeRelation(l, pol) == TeCROSSES;
-}
-
-bool TeCrosses(const TeLine2D& l, const TeCell& cell)
-{
- return TeCrosses(l, TeMakePolygon(cell.box()));
-}
-
-
-// WITHIN
-bool TeWithin(const TeCoord2D& c1, const TeCoord2D& c2)
-{
- return TeEquals(c1, c2);
-}
-
-bool TeWithin(const TeCoord2D& c, const TeBox& b)
-{
- // c to the right of b left wall AND c to the left of b right wall
- // AND c below b top wall AND c above b bottom wall => then c is on b interior.
- return (TeGeometryAlgorithmsPrecision::IsGreater(c.x(), b.x1()) && TeGeometryAlgorithmsPrecision::IsGreater(b.x2(), c.x()) && TeGeometryAlgorithmsPrecision::IsGreater(b.y2(), c.y()) && TeGeometryAlgorithmsPrecision::IsGreater(c.y(), b.y1()));
-}
-
-bool TeWithin(const TeCoord2D& c, const TeLine2D& l)
-{
- return TeRelation(c, l) == TeINSIDE;
-}
-
-bool TeWithin(const TeCoord2D& c, const TePolygon& pol)
-{
- return TeRelation(c, pol) == TeINSIDE;
-}
-
-bool TeWithin(const TePoint& p1, const TePoint& p2)
-{
- return TeWithin(p1.location(), p2.location());
-}
-
-bool TeWithin(const TePoint& p, const TeLine2D& l)
-{
- return TeWithin(p.location(), l);
-}
-
-bool TeWithin(const TePoint& p, const TePolygon& pol)
-{
- return TeWithin(p.location(), pol);
-}
-
-bool TeWithin(const TeLine2D& redLine, const TeLine2D& blueLine)
-{
- if(TeWithinOrCoveredByOrEquals(redLine.box(), blueLine.box()))
- return TeRelation(redLine, blueLine, TeWITHIN) == TeWITHIN;
- else
- return false;
-}
-
-bool TeWithin(const TeLine2D& l, const TePolygon& pol)
-{
- if(TeWithinOrCoveredByOrEquals(l.box(), pol.box()))
- return TeRelation(l, pol) == TeWITHIN;
-
-
- return false;
-}
-
-bool TeWithin(const TePolygon& redPol, const TePolygon& bluePol)
-{
- if(TeWithinOrCoveredByOrEquals(redPol.box(), bluePol.box()))
- return TeRelation(redPol, bluePol) == TeWITHIN;
- else
- return false;
-}
-
-bool TeWithin(const TeBox& bx1, const TeBox& bx2)
-{
- // bx1 left wall is left of or on bx2 left wall
- if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx2.x1(), bx1.x1()))
- return false;
-
- // bx1 right wall is right of or on bx2 right wall
- if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx1.x2(), bx2.x2()))
- return false;
-
- // bx1 is below bx2 or on.
- if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx2.y1(), bx1.y1()))
- return false;
-
- // bx1 is above bx2 or on
- if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx1.y2(), bx2.y2()))
- return false;
-
- return true;
-}
-
-bool TeWithin(const TeCell& cell1, const TeCell& cell2)
-{
- return TeWithin(cell1.box(), cell2.box());
-}
-
-bool TeWithin(const TeLine2D& line, const TeCell& cell)
-{
- return TeWithin(line, TeMakePolygon(cell.box()));
-}
-
-
-bool TeWithin(const TeCell& cell, const TePolygon& poly)
-{
- return TeWithin(TeMakePolygon(cell.box()), poly);
-}
-
-bool TeWithin(const TePoint& point, const TeCell& cell)
-{
- return TeWithin(point.location(), cell.box());
-}
-
-
-// OVERLAPS
-bool TeOverlaps(const TeLine2D& redLine, const TeLine2D& blueLine)
-{
- if(TeDisjoint(redLine.box(), blueLine.box()))
- return false;
- else
- return TeRelation(redLine, blueLine, TeOVERLAPS) == TeOVERLAPS;
-}
-
-bool TeOverlaps(const TePolygon& redPol, const TePolygon& bluePol)
-{
- //if(TeDisjoint(redPol.box(), bluePol.box()))
- if(TeDisjointOrTouches(redPol.box(), bluePol.box()))
- return false;
- else
- return TeRelation(redPol, bluePol) == TeOVERLAPS;
-}
-
-bool TeOverlaps(const TeCell& cell1, const TeCell& cell2)
-{
- return TeOverlaps(TeMakePolygon(cell1.box()), TeMakePolygon(cell2.box()));
-}
-
-bool TeOverlaps(const TeCell& cell, const TePolygon& poly)
-{
- return TeOverlaps(TeMakePolygon(cell.box()), poly);
-}
-
-
-// COVERED BY
-bool TeCoveredBy(const TeLine2D& redLine, const TeLine2D& blueLine)
-{
- if(TeWithinOrCoveredByOrEquals(redLine.box(), blueLine.box()))
- return TeRelation(redLine, blueLine, TeCOVEREDBY) == TeCOVEREDBY;
- else
- return false;
-}
-
-bool TeCoveredBy(const TeLine2D& l, const TePolygon& pol)
-{
- if(TeWithinOrCoveredByOrEquals(l.box(), pol.box()))
- return TeRelation(l, pol) == TeCOVEREDBY;
- else
- return false;
-}
-
-bool TeCoveredBy(const TePolygon& redPol, const TePolygon& bluePol)
-{
- if(TeWithinOrCoveredByOrEquals(redPol.box(), bluePol.box()))
- return TeRelation(redPol, bluePol) == TeCOVEREDBY;
- else
- return false;
-}
-
-bool TeCoveredBy(const TeCell& cell1, const TeCell& cell2)
-{
- return TeCoveredBy(TeMakePolygon(cell1.box()), TeMakePolygon(cell2.box()));
-}
-
-bool TeCoveredBy(const TePolygon& poly, const TeCell& cell)
-{
- return TeCoveredBy(poly, TeMakePolygon(cell.box()));
-}
-
-bool TeCoveredBy(const TeLine2D& line, const TeCell& cell)
-{
- return TeCoveredBy(line, TeMakePolygon(cell.box()));
-}
-
-//---------- Box Tests ----------//
-
-bool TeDisjointOrTouches(const TeBox& bx1, const TeBox& bx2)
-{
- // B1 to the right of or on B2
- if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx1.x1(), bx2.x2()))
- return true;
-
- // B1 to the left of or on B2
- if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx2.x1(), bx1.x2()))
- return true;
-
- // B2 is above or on B1
- if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx2.y1(), bx1.y2()))
- return true;
-
- // B2 is below or on B1
- if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx1.y1(), bx2.y2()))
- return true;
-
- return false;
-}
-
-template<>
-bool TeWithinOrCoveredByOrEquals(const TeBox& bx1, const TeBox& bx2)
-{
- // bx1 left wall is left of bx2 left wall
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx2.x1(), bx1.x1()))
- return false;
-
- // bx1 right wall is right of bx2 right wall
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx1.x2(), bx2.x2()))
- return false;
-
- // bx1 is below bx2
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx2.y1(), bx1.y1()))
- return false;
-
- // bx1 is above bx2
- if(TeGeometryAlgorithmsPrecision::IsGreater(bx1.y2(), bx2.y2()))
- return false;
-
- return true;
-}
-
-template<>
-bool TeWithinOrCoveredByOrEquals(const TeLine2D& line1, const TeLine2D& line2)
-{
- if(TeWithinOrCoveredByOrEquals(line1.box(), line2.box()))
- {
- short r;
- short rel = TeRelation(line1, line1, r);
-
- if((rel&TeWITHIN) || (rel&TeCOVEREDBY) || (rel&TeEQUALS))
- return true;
-
- return false;
- }
- return false;
-}
-
-template<>
-bool TeWithinOrCoveredByOrEquals(const TeLine2D& line1, const TePolygon& pol)
-{
- if(TeWithinOrCoveredByOrEquals(line1.box(), pol.box()))
- {
- short rel = TeRelation(line1, pol);
-
- if((rel&TeWITHIN) || (rel&TeCOVEREDBY))
- return true;
-
- return false;
- }
- return false;
-}
-
-template<>
-bool TeWithinOrCoveredByOrEquals(const TePolygon& pol1, const TePolygon& pol2)
-{
- if(TeWithinOrCoveredByOrEquals(pol1.box(), pol2.box()))
- {
- short rel = TeRelation(pol1, pol2);
-
- if((rel&TeWITHIN) || (rel&TeCOVEREDBY) || (rel&TeEQUALS))
- return true;
-
- return false;
- }
- return false;
-}
-
-
-bool TeWithinOrTouches(const TeCoord2D& c, const TeCoord2D& c1, const TeCoord2D& c2)
-{
- // c is to the right of c1 and c2
- if(TeGeometryAlgorithmsPrecision::IsGreater(c.x(), c1.x()) && TeGeometryAlgorithmsPrecision::IsGreater(c.x(), c2.x()))
- return false;
-
- // c is above c1 and c2
- if(TeGeometryAlgorithmsPrecision::IsGreater(c.y(), c1.y()) && TeGeometryAlgorithmsPrecision::IsGreater(c.y(), c2.y()))
- return false;
-
- // c is to the left of c1 and c2
- if(TeGeometryAlgorithmsPrecision::IsSmaller(c.x(), c1.x()) && TeGeometryAlgorithmsPrecision::IsSmaller(c.x(), c2.x()))
- return false;
-
- // c is below c1 and c2
- if(TeGeometryAlgorithmsPrecision::IsSmaller(c.y(), c1.y()) && TeGeometryAlgorithmsPrecision::IsSmaller(c.y(), c2.y()))
- return false;
-
- return true;
-}
-
-
-//---------- Intersection Functions ----------//
-
-bool TeIntersection(const TeBox& bx1, const TeBox& bx2, TeBox& bout)
-{
- if(TeDisjoint(bx1, bx2))
- return false;
-
- double x1 = MAX(bx1.x1(),bx2.x1());
- double x2 = MIN(bx1.x2(),bx2.x2());
- double y1 = MAX(bx1.y1(),bx2.y1());
- double y2 = MIN(bx1.y2(),bx2.y2());
-
- bout = TeBox(x1, y1, x2, y2);
-
- return true;
-}
-
-TeCoordPairVect TeGetIntersections(const TePolygon &poly, const double& y)
-{
- TeCoordPairVect Segments;
- vector<double> crossList, segListInY;
- unsigned int nholes = poly.size();
-
- //for each ring of the polygon
- for (unsigned int count=0; count<nholes; count++ )
- {
- TeLinearRing coords = poly[count];
- //for each segment of the ring
- for (unsigned int j=0; j < (coords.size() - 1); j++ )
- {
- // Get one segment
- TeCoord2D coord0 = coords[j];
- TeCoord2D coord1 = coords[j+1];
-
- bool yflag0 = ( coord0.y() > y );
- bool yflag1 = ( coord1.y() > y );
-
- //treating a special case: when the segment touches or is ON the y axe
- //if there is a special case, we must test if the middle point
- //of each segment is inside or outside of the polygon
- if((coord0.y()!=y) && (coord1.y()==y))
- {
- bool pointsInY = true;
- bool lowerY1 = coord0.y()<y;
- unsigned int i = j+2;
-
- TeCoord2D lastPointInY;
- TeCoord2D firstPointOutY = coord1;
-
- while(pointsInY)
- {
- lastPointInY = firstPointOutY;
-
- // Get the next point
- if(i>=coords.size())
- i=1;
- firstPointOutY = coords[i];
- ++i;
-
- //Verify if it is on the y axe
- pointsInY = firstPointOutY.y()==y;
- }
-
- bool lowerY2 = firstPointOutY.y()<y;
- //the segment touches the y axe only in one point and cross the axe Y
- if((lastPointInY==coord1) && (lowerY1!=lowerY2))
- crossList.push_back(coord1.x());
- else
- {
- segListInY.push_back (coord1.x());
- segListInY.push_back (lastPointInY.x());
- }
- }
- else if(coord0.y()==y)
- continue;
- // line crosses ring horizontally
- else if ( yflag0 != yflag1 )
- {
- double slope = ( coord1.x() - coord0.x() ) / ( coord1.y() - coord0.y());
- double xcross = ( y - coord0.y() )* slope + coord0.x();
- crossList.push_back (xcross);
- }
- }
- }
-
- if(crossList.empty())
- crossList = segListInY;
- else if(!segListInY.empty())
- {
- //insert segListInY in the cross list
- for(unsigned i=0; i<segListInY.size(); ++i)
- crossList.push_back (segListInY[i]);
-
- sort (crossList.begin(), crossList.end());
-
- vector<double> aux;
- //Verify if the segment middle point intersects the polygon
- for(unsigned i=1; i<crossList.size(); ++i)
- {
- //calculates the middle point
- double x0 = crossList[i-1];
- double x1 = crossList[i];
- double x = x0 + (x1-x0)/2;
-
- TeCoord2D pt (x, y);
- if (!TeDisjoint(pt, poly))
- {
- aux.push_back (x0);
- aux.push_back (x1);
- }
- }
- crossList.clear();
- crossList = aux;
- }
-
- // Sort the x-intersections
- sort (crossList.begin(), crossList.end());
-
- // Make the result segments
- vector<double>::iterator it = crossList.begin();
- while ( it != crossList.end())
- {
- TeCoordPair cp;
-
- cp.pt1 = TeCoord2D ( (*it), y);
- ++it;
- if ( it == crossList.end() )
- break;
-
- cp.pt2 = TeCoord2D ( (*it), y);
- ++it;
-
- Segments.push_back ( cp );
- }
- return Segments;
-}
-
-//---------- Union Operators ----------//
-
-TeBox TeUnion(const TeBox& bx1, const TeBox& bx2)
-{
- double x1 = MIN(bx1.x1(), bx2.x1());
- double y1 = MIN(bx1.y1(), bx2.y1());
-
- double x2 = MAX(bx1.x2(), bx2.x2());
- double y2 = MAX(bx1.y2(), bx2.y2());
-
- return TeBox(x1, y1, x2, y2);
-}
-
-
-//---------- Localization Functions ----------//
-
-bool TePointInPoly(const TeCoord2D& c, const TeLinearRing& r)
-{
- if(r.size() < 4)
- return false;
-
- register double ty, tx;
-
- register const unsigned int nVertices = r.size();
-
- register bool inside_flag = false;
-
- register int j, yflag0, yflag1;
-
- TeLinearRing::iterator vtx0, vtx1;
-
- tx = c.x();
- ty = c.y();
-
- vtx0 = r.end() - 2;
-
- yflag0 = (vtx0->y() >= ty);
-
- vtx1 = r.begin();
-
- for(j = nVertices; --j; )
- {
- yflag1 = (vtx1->y() >= ty);
-
- if(yflag0 != yflag1)
- {
- if(((vtx1->y() - ty) * (vtx0->x() - vtx1->x()) >=
- (vtx1->x() - tx) * (vtx0->y() - vtx1->y())) == yflag1)
- {
- inside_flag = !inside_flag ;
- }
- }
-
- yflag0 = yflag1 ;
- vtx0 = vtx1 ;
- vtx1++;
- }
-
- return inside_flag;
-}
-
-bool TeIsOnSegment(const TeCoord2D& c, const TeCoord2D& c1, const TeCoord2D& c2)
-{
- if(TeWithinOrTouches(c, c1, c2))
- {
- bool aux = false;
-
- return TeINTERSECTOR2::TeCCW(c1, c2, c, aux) == TeNOTURN;
- }
-
- return false;
-}
-
-bool TeIsOnLine(const TeCoord2D& c, const TeLine2D& l)
-{
- if(l.size() < 2)
- return false;
-
- if(TeDisjoint(c, l.box()))
- return false;
-
- TeLine2D::iterator it = l.begin();
-
- unsigned int nstep = l.size() - 1;
-
- for(unsigned int i = 0; i < nstep; ++i)
- {
- if(TeIsOnSegment(c, *(it), *(it + 1)))
- return true;
-
- ++it;
- }
-
- return false;
-}
-
-bool TeLocateLineSegment (TeCoord2D& pin, TeLine2D& line, int& segment, double /*tol*/)
-{
- if (line.size() < 2)
- return false;
-
- TeCoord2D pout;
-
- segment = 0;
- double min_dist = TeMinimumDistance(line[0], line[1], pin, pout);
-
- for (unsigned int i = 2; i < line.size(); i++)
- {
- double dist;
- if ((dist = TeMinimumDistance (line[i-1],line[i], pin, pout)) < min_dist)
- {
- min_dist = dist;
- segment = i - 1;
- }
- }
-
- return true;
-}
-
-
-//---------- Area Functions ----------//
-
-template<> double TeGeometryArea(const TePolygon& p)
-{
- if(p.size() > 0)
- {
- TePolygon::iterator it = p.begin();
-
- double area = fabs(Te2Area(*it));
-
- ++it;
-
- // subtract inner rings area.
- while(it != p.end())
- {
- area -= fabs(Te2Area(*it));
- ++it;
- }
-
- return (area / 2.0);
- }
-
- return 0.0;
-}
-
-template<> double TeGeometryArea(const TePolygonSet& ps)
-{
- TePolygonSet::iterator it = ps.begin();
-
- double area = 0.0;
-
- while(it != ps.end())
- {
- area += TeGeometryArea(*it);
- ++it;
- }
-
- return (area);
-}
-
-template<> double TeGeometryArea(const TeBox& b)
-{
- return ((b.x2() - b.x1()) * (b.y2() - b.y1()));
-}
-
-template<> double TeGeometryArea(const TeMultiGeometry& mGeom)
-{
- if(mGeom.hasPolygons())
- {
- TePolygonSet pSet;
- mGeom.getGeometry(pSet);
- return TeGeometryArea(pSet);
- }
- else if(mGeom.hasCells())
- {
- TeCellSet cSet;
- mGeom.getGeometry(cSet);
- return TeGeometryArea(cSet);
- }
- return 0.;
-}
-
-//---------- ConvexHull ----------//
-
-//! If we have the two end point equals, so we remove it.
-void removeDuplicatedCoords(vector<TeCoord2D>& coordSet)
-{
- if(coordSet[0] == coordSet[coordSet.size() - 1])
- coordSet.erase(coordSet.end() - 1);
-
- return;
-}
-
-// Return a linear ring that is the convex hull of a given list of coords
-TePolygon ConvexHull(vector<TeCoord2D>& coordSet)
-{
- // sorting the coords
- std::sort(coordSet.begin(), coordSet.end(), xOrder<TeCoord2D>());
-
- register unsigned int i = 0;
- register unsigned int n = coordSet.size();
-
- TeLine2D upperHull;
- TeLine2D lowerHull;
-
- lowerHull.add(coordSet[0]);
- lowerHull.add(coordSet[1]);
-
- unsigned int count = 2;
-
- bool aux = false;
-
- for(i = 2; i < n; ++i)
- {
- lowerHull.add(coordSet[i]);
-
- ++count;
-
- while(count > 2 && TeINTERSECTOR2::TeCCW(lowerHull[count - 3], lowerHull[count - 2], lowerHull[count - 1], aux) <= TeNOTURN)
- {
- lowerHull.erase(count - 2);
- --count;
- }
- }
-
- upperHull.add(coordSet[n - 1]);
- upperHull.add(coordSet[n - 2]);
-
- count = 2;
-
- for(i = n - 2; i > 0; --i)
- {
- upperHull.add(coordSet[i - 1]);
- ++count;
-
- while(count > 2 && TeINTERSECTOR2::TeCCW(upperHull[count - 3], upperHull[count - 2], upperHull[count - 1], aux) <= TeNOTURN)
- {
- upperHull.erase(count - 2);
- --count;
- }
- }
-
-
- upperHull.erase(0);
- upperHull.erase(upperHull.size() - 1);
-
- lowerHull.copyElements(upperHull);
- lowerHull.add(lowerHull[0]);
-
- TeLinearRing aux_ring(lowerHull);
- TePolygon p;
- p.add(aux_ring);
- return p;
-}
-
-template<class T> TePolygon TeConvexHull(const T& coordSet)
-{
- // creates an auxiliary line with the points of the ring
- vector<TeCoord2D> aux;
-
- typename T::iterator it = coordSet.begin();
-
- while(it != coordSet.end())
- {
- aux.push_back(*it);
- ++it;
- }
-
- // removes duplicated coords from structs like ring
- removeDuplicatedCoords(aux);
-
- return ConvexHull(aux);
-}
-
-template<> TePolygon TeConvexHull(const TePolygon& p)
-{
- vector<TeCoord2D> coords;
- back_insert_iterator<vector<TeCoord2D> > it(coords);
- // Copy the first ring of each polygon without the last point (that is equals to the first).
-
- copy(p[0].begin(), p[0].end() - 1, it);
-
- return ConvexHull(coords);
-}
-
-template<> TePolygon TeConvexHull(const TePolygonSet& ps)
-{
- vector<TeCoord2D> coords;
- back_insert_iterator<vector<TeCoord2D> > it(coords);
- // Copy the first ring of each polygon without the last point (that is equals to the first).
-
- TePolygonSet::iterator it_ps = ps.begin();
- while(it_ps != ps.end())
- {
- TeLinearRing r = (*it_ps)[0];
- copy(r.begin(), r.end() - 1, it);
- ++it_ps;
- }
-
- return ConvexHull(coords);
-}
-
-template<> TePolygon TeConvexHull(const TePointSet& ps)
-{
- vector<TeCoord2D> coords;
- // Copy the first ring of each polygon without the last point (that is equals to the first).
-
- TePointSet::iterator itr = ps.begin();
-
- while(itr != ps.end())
- {
- coords.push_back(itr->location());
-
- ++itr;
- }
-
- return ConvexHull(coords);
-}
-
-//---------- Utilities Functions ----------//
-
-
-
-//---------- Validation Functions ----------//
-
-bool TeIsConvex(const TeLinearRing& ring)
-{
- bool aux = false;
-
- short orientation = TeINTERSECTOR2::TeCCW(*(ring.end() - 2), ring[0], ring[1], aux);
-
- const unsigned int nStep = ring.size() - 1;
-
- for(unsigned int i = 1; i < nStep; ++i)
- {
- short this_orientation = TeINTERSECTOR2::TeCCW(ring[i-1], ring[i], ring[i+1], aux);
-
- if(this_orientation == TeNOTURN)
- continue;
-
- if((orientation != TeNOTURN) && (orientation != this_orientation))
- return false;
-
- orientation = this_orientation;
- }
-
- return true;
-}
-
-short TeOrientation(const TeLinearRing& r)
-{
- double area = Te2Area(r);
-
- if(area > 0.0)
- return TeCOUNTERCLOCKWISE;
-
- if(area < 0.0)
- return TeCLOCKWISE;
-
- return TeNOTURN;
-}
-
-void TeGetMiddlePoint(const TeCoord2D &first, const TeCoord2D &last, TeCoord2D &middle)
-{
- double lenght,parts,curlenght,incx,incy,
- deltax,deltay,dx,dy;
- short i,nparts;
-
- lenght = TeDistance(first,last);
- if(lenght == 0.)
- {
- middle = first;
- return;
- }
-
- nparts = 2;
- parts = lenght/2.;
-// verify segment orientation
- if(first.x() < last.x())
- incx = 1.;
- else
- incx = -1.;
-
- if(first.y() < last.y())
- incy = 1.;
- else
- incy = -1.;
-
- curlenght = 0.;
- deltax = fabs(first.x()-last.x());
- deltay = fabs(first.y()-last.y());
- for(i=0;i<(nparts-1);i++)
- {
- curlenght = curlenght + parts;
- // vertical segment
- if(first.x() == last.x())
- {
- middle = TeCoord2D(first.x(),first.y()+(curlenght*incy));
- continue;
- }
-
- // horizontal segment
- if(first.y() == last.y())
- {
- middle = TeCoord2D(first.x()+(curlenght*incx),first.y());
- continue;
- }
-
- // inclined segment
-
- // calculating X coordinate
- dx = curlenght*deltax/lenght;
-
- // calculating Y coordinate
- dy = curlenght*deltay/lenght;
- middle = TeCoord2D(first.x()+(dx*incx),first.y()+(dy*incy));
- }
-}
-
-//---------- Metric Functions ----------//
-
-double TeDistance(const TeCoord2D& c1, const TeCoord2D& c2)
-{
- return sqrt(((c2.x() - c1.x()) * (c2.x() - c1.x())) + ((c2.y()-c1.y()) * (c2.y() - c1.y())));
-}
-
-double TeLength(const TeLine2D& l)
-{
- double len = 0.0;
-
- unsigned int nStep = l.size() - 1;
-
- for(unsigned int i = 0 ; i < nStep; ++i)
- len += TeDistance(l[i], l[i+1]);
-
- return len;
-}
-
-double TePerpendicularDistance(const TeCoord2D& first, const TeCoord2D& last, const TeCoord2D& pin, TeCoord2D &pinter)
-{
- double d12,xmin,ymin;
-
- double xi = first.x();
- double xf = last.x();
- double yi = first.y();
- double yf = last.y();
- double x = pin.x();
- double y = pin.y();
-
- double dx = xf - xi;
- double dy = yf - yi;
- double a2 = (y - yi) * dx - (x - xi)*dy;
-
- if(dx==0. && dy==0.)
- {
- d12= sqrt(((x - xi) * (x - xi)) + ((y - yi) * (y - yi)));
- d12 *= d12;
- }
- else
- d12= a2 * a2 / (dx * dx + dy * dy);
-
- if (dx == 0.)
- {
- xmin = xi;
- ymin = y;
- }
- else if (dy == 0.)
- {
- xmin = x;
- ymin = yi;
- }
- else
- {
- double alfa = dy / dx;
- xmin = (x + alfa * (y - yi) + alfa * alfa * xi) / (1. + alfa * alfa);
- ymin = (x - xmin) / alfa + y;
- }
-
- pinter = TeCoord2D(xmin, ymin);
- return (sqrt(d12));
-}
-
-double TeMinimumDistance (const TeCoord2D& first, const TeCoord2D& last, const TeCoord2D& pin, TeCoord2D& pout, double /*tol*/)
-{
- TeCoord2D pinter;
- TeBox sbox(MIN(first.x(),last.x()),
- MIN(first.y(),last.y()),
- MAX(first.x(),last.x()),
- MAX(first.y(),last.y()));
-
- double d = TePerpendicularDistance (first, last, pin, pinter);
- double dmin = TeMAXFLOAT;
-
- // Perpendicular minimum distance point was found.
- if (TeIntersects (pinter, sbox))
- {
- dmin = d;
- pout = pinter;
- }
- else
- {
- // Perpendicular minimum distance point could not be found.
- // The segment vertices distances will analyzed
- double d1 = TeDistance (first, pin);
- double d2 = TeDistance (last, pin);
- if (d1 <= d2)
- {
- dmin = d1;
- pout = first;
- }
- else if (d2 < dmin)
- {
- dmin = d2;
- pout = last;
- }
- }
-
- return dmin;
-}
-
-
-//---------- Relation Functions ----------//
-
-short TeRelation(const TeCoord2D& c, const TeLine2D& l)
-{
- if(TeEquals(c, l[0]) || TeEquals(c, l[l.size() - 1]))
- {
- // Ring doesn't have bundaries, only interiors.
- if(l.isRing())
- return TeINSIDE;
-
- return TeBOUNDARY;
- }
-
- if(TeIsOnLine(c, l))
- return TeINSIDE;
-
- return TeOUTSIDE;
-}
-
-short TeRelation(const TeCoord2D& c, const TeLinearRing& r)
-{
- if(TeDisjoint(c, r.box()))
- return TeOUTSIDE;
-
- if(TeIsOnLine(c, r))
- return TeBOUNDARY;
-
- if(TePointInPoly(c, r))
- return TeINSIDE;
- else
- return TeOUTSIDE;
-}
-
-short TeRelation(const TeCoord2D& c, const TePolygon& pol)
-{
- short rel = TeRelation(c, pol[0]);
-
- if(rel != TeINSIDE)
- return rel;
- else // If point is inside exterior ring
- {
- unsigned int size = pol.size();
-
- for(unsigned int i = 1; i < size; ++i)
- {
- rel = TeRelation(c, pol[i]);
-
- switch(rel)
- {
- // If point is inside a hole so it is on polygon's outside.
- case TeINSIDE : return TeOUTSIDE;
-
- // If point is on boundary so it is on polygon's boundary.
- case TeBOUNDARY : return TeBOUNDARY;
- }
- }
- }
-
- // If the point is inside exterior ring and is not on one of the holes so it is in polygon's interior.
- return TeINSIDE;
-}
-
-short TeRelation(const TePoint& p, const TePolygon& pol)
-{
- return (TeRelation(p.location(), pol));
-}
-
-short TeRelation(const TeCoord2D& c, const TePolygonSet& pSet)
-{
- if(TeDisjoint(c, pSet.box()))
- return TeOUTSIDE;
-
- unsigned int size = pSet.size();
-
- for(unsigned int i = 0; i < size; ++i)
- {
- short rel = TeRelation(c, pSet[i]);
-
- if(rel & TeINSIDE)
- return TeINSIDE;
-
- if(rel & TeBOUNDARY)
- return TeBOUNDARY;
- }
-
- return TeOUTSIDE;
-}
-
-short TeRelation(const TeLine2D& lRed, const TeLine2D& lBlue, const short& relation)
-{
- TeINTERSECTOR2::TeVectorBoundaryIP report;
-
- if(TeINTERSECTOR2::TeSafeIntersections(lRed, lBlue, report))
- {
- short rel = Relation(lRed, lBlue, report, relation);
-
- // Stop to check, because touches can't occur anymore
- if((relation == TeTOUCHES || relation == TeCROSSES) && rel != relation)
- return TeUNDEFINEDREL;
-
- if(rel != TeUNDEFINEDREL)
- return rel;
-
- TeINTERSECTOR2::TeVectorBoundaryIP::iterator it = report.begin();
- TeINTERSECTOR2::TeVectorBoundaryIP::iterator it_end = report.end();
-
- for(unsigned int i = 0; i < report.size(); ++i)
- {
- swap(report[i].redPartNum_, report[i].bluePartNum_);
- swap(report[i].redSegNum_, report[i].blueSegNum_);
- }
-
- rel = Relation(lBlue, lRed, report, relation);
-
- if(rel != TeUNDEFINEDREL)
- return ConverseRelation(rel);
- else
- return TeOVERLAPS;
- }
- else
- return TeDISJOINT;
-}
-
-short TeRelation(const TeLine2D& line, const TePolygon& pol)
-{
- short rel = TopologicRelation(line, pol[0]);
-
- if(rel & TeTOUCHES || rel & TeCROSSES || rel & TeDISJOINT)
- return rel;
-
- // If relation is WITHIN or COVERED BY we need to test inner rings.
- register unsigned int i = 1;
- register unsigned int nRings = pol.size();
-
- for(; i < nRings; ++i)
- {
- short rel_aux = TopologicRelation(line, pol[i]);
-
- switch(rel_aux)
- {
- case TeCROSSES : return TeCROSSES;
-
- case TeCOVEREDBY : return TeTOUCHES;
-
- case TeTOUCHES : rel = TeCOVEREDBY;
- break; // Needs to check other holes.
-
- case TeWITHIN : return TeDISJOINT;
-
- case TeDISJOINT : break; // Keeps rel and check other inner rings
- }
- }
-
- return rel;
-}
-
-short TeRelation(const TePolygon& pRed, const TePolygon& pBlue)
-{
-
- short rel = TopologicRelation(pRed[0], pBlue[0]);
-
- if(rel & TeTOUCHES || rel & TeOVERLAPS || rel & TeDISJOINT)
- return rel;
-
-
- short rel_external_ring = TeUNDEFINEDREL;
-
- bool converse = false;
-
- vector<TeLinearRing> innerRingsToTest;
-
- switch(rel)
- {
- case TeWITHIN :
- case TeCOVEREDBY :
- // if pBlue has inner rings.
- if(pBlue.size() > 1)
- {
- rel_external_ring = LookAtInnerRings(pRed[0], pBlue, innerRingsToTest, rel);
- }
- else // else if it hasn't
- {
- if(pRed.size() > 1) // but pRed has
- return TeOVERLAPS; // they overlaps
- else
- return rel;
- }
- break;
-
- case TeCONTAINS :
- case TeCOVERS :
- // if pRed has inner rings.
- if(pRed.size() > 1)
- {
- rel_external_ring = LookAtInnerRings(pBlue[0], pRed, innerRingsToTest, rel);
- }
- else // else if it hasn't
- {
- if(pBlue.size() > 1) // but pBlue has
- return TeOVERLAPS; // they overlaps
- else
- return rel;
- }
-
- converse = true;
- break;
-
- case TeEQUALS :
- if(pRed.size() != pBlue.size())
- return TeOVERLAPS;
-
- if(pRed.size() == 1 && pBlue.size() == 1)
- return rel;
-
- for(unsigned int k = 1; k < pBlue.size(); k++)
- innerRingsToTest.push_back(pBlue[k]);
-
- rel_external_ring = TeUNDEFINEDREL;
- }
-
- if(rel_external_ring != TeUNDEFINEDREL)
- return rel_external_ring;
-
- // If we are here, so we need to test
- if(converse) // COVERS or CONTAINS
- {
- if(pBlue.size() == 1 && innerRingsToTest.size() == 0)
- return rel;
-
- // The result may be: overlap or equals.
- short rel_aux = TestInnerRings(pBlue, innerRingsToTest);
-
- if(rel_aux & TeOVERLAPS)
- return TeOVERLAPS;
-
- if(rel_aux & TeCOVERS)
- return TeCOVERS;
-
- if(rel_aux & TeCONTAINS)
- return TeCONTAINS;
- }
- else // EQUALS, COVERED BY or WITHIN
- {
- if(pRed.size() == 1 && innerRingsToTest.size() == 0)
- return rel;
-
- short rel_aux = TestInnerRings(pRed, innerRingsToTest);
-
- if(rel_aux & TeOVERLAPS)
- return TeOVERLAPS;
-
- if((rel_aux == TeEQUALS) && (rel == TeEQUALS))
- return TeEQUALS;
-
- if((rel_aux & TeCOVERS) || (rel_aux & TeEQUALS))
- return TeCOVEREDBY;
-
- if(rel_aux & TeCONTAINS)
- {
- if((rel == TeEQUALS) || (rel == TeCOVEREDBY))
- return TeCOVEREDBY;
-
- return TeWITHIN;
- }
- }
-
- return TeUNDEFINEDREL;
-}
-
-
-//---------- Generate Geometry Functions ----------//
-
-TePolygon TeMakePolygon(const TeBox& b)
-{
- TeLine2D l;
-
- l.add(b.lowerLeft());
- l.add(TeCoord2D(b.x2(), b.y1()));
- l.add(b.upperRight());
- l.add(TeCoord2D(b.x1(), b.y2()));
- l.add(b.lowerLeft());
- l.setBox(b);
-
- TePolygon p;
- p.add(TeLinearRing(l));
- p.setBox(b);
-
- return p;
-}
-
-TeLinearRing TeSimpleClosedPath(const TePointSet& pSet)
-{
- TeLine2D l;
-
- for(register unsigned int i = 0; i < pSet.size(); ++i)
- l.add(pSet[i].location());
-
- ThetaOrder tr(pSet[0].location());
-
- std::sort(l.begin(), l.end(), tr);
-
- l.add(l[0]);
-
- return TeLinearRing(l);
-}
-
-
-//---------- Nearest ----------//
-
-bool TeNearest ( TeCoord2D& pt, TeNodeSet& ns , int& k, const double& tol)
-{
- double d,dmin = TeMAXFLOAT;
- bool flag = false;
-
- k = -1;
- for (unsigned int i=0; i < ns.size() ; i++)
- {
- d = TeDistance (pt, ns[i].location());
- if ( d <= tol && d < dmin)
- {
- dmin = d;
- k = i;
- flag = true;
- }
- }
- return flag;
-}
-
-bool TeNearest ( TeCoord2D& pt, TePointSet& ps , int& k, const double& tol)
-{
- double d,dmin = TeMAXFLOAT;
- bool flag = false;
-
- k = -1;
- for (unsigned int i=0; i < ps.size() ; i++)
- {
- d = TeDistance (pt, ps[i].location());
- if ( d <= tol && d < dmin)
- {
- dmin = d;
- k = i;
- flag = true;
- }
- }
- return flag;
-}
-
-bool TeNearest ( TeCoord2D& pt, TeTextSet& ts , int& k, const double& tol)
-{
- double d,dmin = TeMAXFLOAT;
- bool flag = false;
-
- k = -1;
- for (unsigned int i=0; i < ts.size() ; i++)
- {
- d = TeDistance (pt, ts[i].location());
- if ( d <= tol && d < dmin)
- {
- dmin = d;
- k = i;
- flag = true;
- }
- }
- return flag;
-}
-
-bool TeNearest(TeCoord2D& pt, TeLineSet& ls , int& k, TeCoord2D& pi, const double& tol)
-{
- double d,dmin = TeMAXFLOAT;
- bool flag = false;
-
- k = -1;
- for (unsigned int i=0 ; i<ls.size() ; i++)
- {
- TeLine2D line = ls[i];
- TeBox lb = line.box();
- TeBox box(lb.x1()-tol,lb.y1()-tol,lb.x2()+tol,lb.y2()+tol);
- if (TeIntersects(pt, box))
- {
- for (unsigned int j=0 ; j<line.size()-1 ; j++)
- {
- TeCoord2D pinter;
- TeBox sbox(MIN(line[j].x(),line[j+1].x()),
- MIN(line[j].y(),line[j+1].y()),
- MAX(line[j].x(),line[j+1].x()),
- MAX(line[j].y(),line[j+1].y()));
- d = TePerpendicularDistance (line[j],line[j+1],pt, pinter);
- if((d <= tol) && (d < dmin) && TeIntersects(pinter, sbox))
- {
- dmin = d;
- k = i;
- pi = pinter;
- flag = true;
- }
- }
- }
- }
- return flag;
-}
-
-
-bool TeNearest (TeCoord2D& pt,TeLineSet& ls, int& lindex, TeCoord2D& pout, double& dmin, const double& tol)
-{
- bool flag = false;
- TeCoord2D pinter;
-
- dmin = TeMAXFLOAT;
- lindex = -1;
-
- for (unsigned int i = 0 ; i < ls.size(); i++)
- {
- TeLine2D line = ls[i];
-
- for (unsigned int j = 0 ; j < line.size() - 1 ; j++)
- {
- double d = TeMinimumDistance (line[j], line[j + 1], pt, pinter, tol);
- if (d < dmin)
- {
- lindex = i;
- pout = pinter;
- dmin = d;
- flag = true;
- }
- }
- }
- return flag;
-}
-
-bool TeNearest(TeCoord2D& pt, TePolygonSet& ps , int& k, const double& /*tol*/)
-{
- bool flag = false;
-
- k = -1;
-
- TePoint ptaux(pt);
-
- for (unsigned int i=0; i < ps.size() ; i++)
- {
- if (TeIntersects(ptaux,ps[i]))
- {
- k = i;
- flag = true;
- }
- }
- return flag;
-}
-
-bool TeNearestByPoints ( TeCoord2D& pt, TeLineSet& ls , int& k, double& dist, const double& tol)
-{
- double d,dmin = TeMAXFLOAT;
- bool flag = false;
-
- k = -1;
- for (unsigned int i=0 ; i<ls.size() ; i++)
- {
- TeLine2D line = ls[i];
- TeBox lb = line.box();
- TeBox box(lb.x1()-tol,lb.y1()-tol,lb.x2()+tol,lb.y2()+tol);
- if (TeIntersects (pt,box))
- {
- for (unsigned int j=0 ; j<line.size()-1 ; j++)
- {
- d = TeDistance (line[j],pt);
- if ( d <= tol && d < dmin )
- {
- dmin = d;
- dist = dmin;
- k = i;
- flag = true;
- }
- }
- }
- }
- return flag;
-}
-
-
-//---------- TIN ----------//
-
-bool TeFindTriangleCenter(const TeCoord2D& vert0, const TeCoord2D& vert1, const TeCoord2D& vert2, TeCoord2D& pc )
-{
- if ( vert0 == vert1 || vert0 == vert2 )
- return false; // pontos sao iguais-> retorna
-
- // calcula o coeficiente angular perpendicular a reta 1
- bool perpvert1 = false, // perpendicular vertical ao segmento 1
- perpvert2 = false; // perpendicular vertical ao segmento 2
- double m1 = 10., m2 =10.; // normais aos segmentos 1 e 2
- double prcsion = 1.0e-10; // Precision to be used for equal comparison
- double oldPrcsion = TePrecision::instance().precision();
- TePrecision::instance().setPrecision(prcsion);
-
- if ( TeCoord2D( 0., vert0.y() ) == TeCoord2D( 0., vert1.y() ) )
- perpvert1 = true;
- else
- m1 = -(vert1.x() - vert0.x()) / (vert1.y() - vert0.y());
-
-// calcula o coeficiente angular da perpendicular a reta 2
- if ( TeCoord2D( 0., vert1.y() ) == TeCoord2D( 0., vert2.y() ) )
- perpvert2 = true;
- else
- m2 = -(vert2.x() - vert1.x()) / (vert2.y() - vert1.y());
-
- TePrecision::instance().setPrecision(oldPrcsion);
-// Caso as retas sejam coincidentes, uma circunferencia
-// nao eh definida
- if (fabs( m1 - m2 ) > prcsion)
- {
-
-// passou pelos testes: os pontos definem uma circunferencia
-// calculo do ponto medio do segmento ponto0-ponto1 (segmento 1)
- TeCoord2D ptm1 = vert0;
- ptm1 += vert1;
- ptm1.scale ( 0.5, 0.5);
-
-// calculo do ponto medio do segmento ponto1-ponto2 (segmento 2)
- TeCoord2D ptm2 = vert1;
- ptm2 += vert2;
- ptm2.scale ( 0.5, 0.5);
-
-// calculo das coordenadas do centro: ponto de interseccao das mediatrizes
-// dos segmentos ponto0-ponto1 e ponto1-ponto2
- if (perpvert1 == true)
- {
- pc.x( ptm1.x() );
- pc.y( ptm2.y() + m2 * ( pc.x() - ptm2.x() ) );
- }
- else if (perpvert2 == true)
- {
- pc.x( ptm2.x() );
- pc.y( ptm1.y() + m1 * ( pc.x() - ptm1.x() ) );
- }
- else
- {
- pc.x( (m1*ptm1.x() - m2*ptm2.x() - ptm1.y() + ptm2.y())/(m1-m2) );
- pc.y( ptm1.y() + m1 * ( pc.x() - ptm1.x() ) );
- }
- return true;
- }
- return false;
-}
-
-bool TeLineSimplify(TeLine2D& ptlist, double snap, double maxdist)
-{
-// If snap is zero, don't worry
- if (snap == 0.0)
- return true;
-// If line is too short do nothing
- int npts = ptlist.size();
- if ( npts <= 3 )
- return true;
- int npte = npts;
-
- double snap2 = maxdist*maxdist;
- TeLine2D vxy;
- vxy.copyElements(ptlist);
-
-// Check for islands before defining number of points to be used
- int npt;
- if ( ptlist.last() == vxy.first() )
- npt = npte - 1;
- else
- npt = npte;
- ptlist.clear();
-
-// initialize variables
- int i = 0;
- int numa = 0;
- int numpf = npt - 1;
-
-// define anchor
- TeCoord2D axy = vxy[numa];
-
-// define floating point
- TeCoord2D pfxy = vxy[numpf];
-
- while (numa < (npt-1))
- {
- bool retv (false);
- double aa1 = 0.;
- double a = 0.;
- double b = 0.;
-// Compute coeficients of straight line y=ax+b
- if (pfxy.x() == axy.x())
- retv = true;
- else
- {
- a = (pfxy.y() - axy.y())/(pfxy.x() - axy.x());
- b = pfxy.y() - a * pfxy.x();
- aa1 = sqrt(a * a + 1.);
- }
-
- double d = 0;
- double dmax = 0;
- int numdmax = numpf;
-
- int k;
- for (k = numa + 1; k <= numpf; k++)
- {
-// Distance between point and line
- if (retv)
- d = fabs(axy.x() - vxy[k].x());
- else
- d = fabs(vxy[k].y() - a*vxy[k].x() - b)/aa1;
-
- if (d > dmax)
- {
- dmax = d;
- numdmax = k;
- }
- }
-
- if (dmax <= snap)
- {
-// Store selected point
- if (i > (npt-1))
- return false;
- vxy[i++] = axy;
-
- double axbx = pfxy.x()-axy.x();
- double ayby = pfxy.y()-axy.y();
- double dist2 = axbx*axbx + ayby*ayby;
- if (dist2 > snap2)
- {
- for (k = numpf; k > numa+1; k--)
- {
- axbx = vxy[k].x()-axy.x();
- ayby = vxy[k].y()-axy.y();
- dist2 = axbx*axbx + ayby*ayby;
- if (dist2 < snap2)
- break;
- }
-// Shift anchor
- numa = k;
- axy = vxy[k];
- }
- else
- {
-// Shift anchor
- numa = numpf;
- axy = vxy[numpf];
- }
- numpf = npt - 1;
- }
- else
- {
-// Shift floating point
- numpf = numdmax;
- }
-
- pfxy = vxy[numpf];
- }
-
-// Store results
- vxy[i] = vxy[numa];
- npts = i+1;
-
- if ( vxy[i] == vxy[i-1] )
- npts = i;
-
- for (i = 0; i < npts; i++)
- ptlist.add( vxy[i] );
-
-// Case islands
- if (vxy[0] == vxy[npte-1])
- ptlist.add( vxy[0] );
-
- return true;
-}
-
-bool TeSegmentsIntersectPoint(const TeCoord2D& fr0, const TeCoord2D& to0, const TeCoord2D& fr1, const TeCoord2D& to1, TeCoord2D& pi)
-{
-// Adapted from TWO-DIMENSIONAL CLIPPING: A VECTOR-BASED APPROACH
-// Hans J.W. Spoelder, Fons H. Ullings in:
-// Graphics Gems I, pp.701,
-
- double a, b, c,
- px, py, lx, ly, lpx, lpy,
- s;
-
- px = to0.x() - fr0.x();
- py = to0.y() - fr0.y();
- lx = to1.x() - fr1.x();
- ly = to1.y() - fr1.y();
- lpx = fr0.x() - fr1.x();
- lpy = fr0.y() - fr1.y();
-
- a = py * lx - px * ly;
- b = lpx * ly - lpy * lx;
- c = lpx * py - lpy * px;
-
- if (a == 0) // Linhas paralelas
- return false;
- else
- {
- if (a > 0)
- {
- if ((b < 0) || (b > a) || (c < 0) || (c > a))
- return false;
- }
- else
- {
- if ((b > 0) || (b < a) || (c > 0) || (c < a))
- return false;
- }
- s = b/a;
- pi.x(fr0.x() + (px*s));
- pi.y(fr0.y() + (py*s));
- }
- return true;
-}
-
-//---------- Curve ----------//
-
-/*! \fn void TeSwap(TePoint &p1, TePoint &p2)
- \brief Swaps to points.
- \param p1 The first point.
- \param p2 The second point.
-*/
-void TeSwap(TePoint& p1, TePoint& p2)
-{
- TePoint temp;
-
- temp = p1;
- p1 = p2;
- p2 = temp;
-
- return;
-}
-
-bool TeGetCenter(TePoint p1, TePoint p2, TePoint p3, TePoint& center)
-{
- double x, y;
- double ma=0., mb= 0.;
- bool result = true;
-
- //we don't want infinite slopes, or 0 slope for line 1, since we'll divide by "ma" below
- if ((p1.location().x()==p2.location().x()) || (p1.location().y()==p2.location().y()))
- TeSwap(p2,p3);
-
- if (p2.location().x()==p3.location().x())
- TeSwap(p1,p2);
-
- if (p1.location().x()!=p2.location().x())
- ma=(p2.location().y()-p1.location().y())/(p2.location().x()-p1.location().x());
- else
- result=false;
-
- if (p2.location().x()!=p3.location().x())
- mb=(p3.location().y()-p2.location().y())/(p3.location().x()-p2.location().x());
- else
- result=false;
-
- if ((ma==0) && (mb==0))
- result=false;
-
- if (result)
- {
- x=(ma*mb*(p1.location().y()-p3.location().y())+mb*(p1.location().x()+p2.location().x())-ma*(p2.location().x()+p3.location().x()))/(2*(mb-ma));
- y=-(x-(p1.location().x()+p2.location().x())/2)/ma + (p1.location().y()+p2.location().y())/2;
-
- double w= x; //TeRound(x);
- double z= y; //TeRound(y);
- TeCoord2D coord(w,z);
- center.add(coord);
- }
- return result;
-}
-
-double TeGetRadius(TePoint& p1, TePoint& p2, TePoint& p3)
-{
- double s,a,b,c, result;
- a=sqrt(pow(p1.location().x()-p2.location().x(),2)+pow(p1.location().y()-p2.location().y(),2)); //sqr: square of the param
- b=sqrt(pow(p2.location().x()-p3.location().x(),2)+pow(p2.location().y()-p3.location().y(),2));
- c=sqrt(pow(p3.location().x()-p1.location().x(),2)+pow(p3.location().y()-p1.location().y(),2));
- s=(a+b+c)/2;
- result=(a*b*c)/(4*sqrt(s*(s-a)*(s-b)*(s-c)));
- return result;
-}
-
-bool TeGenerateArc(TePoint& p1, TePoint& p2, TePoint& p3, TeLine2D& arcOut, const short& NPoints)
-{
- TePoint center;
- double radius;
-
- if(!TeGetCenter(p1, p2, p3, center))
- return false;
-
- radius = TeGetRadius(p1, p2, p3);
-
- //calculate the distance between the points p1 and p3
- double length = TeDistance(p1.location(),p3.location());
-
- double val = length/(2*radius);
- if(val>1)
- return false;
-
- //calculate the angle (in radians) between the segments (p1 - p3) in the circle center
- //asin : arco seno
- //http://mathforum.org/dr.math/faq/faq.circle.segment.html#7
- double thetaR = 2 * asin(val);
-
- //calculate the variation of the angle in radians for each point
- double deltaR = thetaR/(NPoints+1);
-
- //verify if is counterclockwise or clockwise
- TeLine2D line;
- line.add(p1.location());
- line.add(p2.location());
- line.add(p3.location());
- line.add(p1.location());
- TeLinearRing ring(line);
-
- short orient = TeOrientation(ring);
-
- //calculate the coseno e seno of the angle (beta) between the circle center (horizontal segment) and the first point
- //http://mathforum.org/library/drmath/view/55327.html
- double cosBeta = (p1.location().x()-center.location().x())/radius;
- double sinBeta = (p1.location().y()-center.location().y())/radius;
-
- //rela�es trigonom�ricas
- //sin(x+y) = sin(x)cos(y) + cos(x)sin(y),
- //cos(x+y) = cos(x)cos(y) - sin(x)sin(y),
- //sin(x-y) = sin(x)cos(y) - cos(x)sin(y),
- //cos(x-y) = cos(x)cos(y) + sin(x)sin(y),
-
- arcOut.add(p1.location());
- double angle = deltaR;
- for (int i=0; i<(NPoints+1); i++)
- {
- double x = 0.,y = 0.;
- if(orient==TeCOUNTERCLOCKWISE)
- {
- //c = h + r*cos(B+A),
- //d = k + r*sin(B+A),
- x = center.location().x() + radius * ((cosBeta*cos(angle))-(sinBeta*sin(angle))); //cos(beta+angle)
- y = center.location().y() + radius * ((sinBeta*cos(angle))+(cosBeta*sin(angle))); //sin(beta+angle)
- }
- else if (orient==TeCLOCKWISE)
- {
- //c = h + r*cos(B-A),
- //d = k + r*sin(B-A),
- x = center.location().x() + radius * ((cosBeta*cos(angle))+(sinBeta*sin(angle))); //cos(beta-angle)
- y = center.location().y() + radius * ((sinBeta*cos(angle))-(cosBeta*sin(angle))); //sin(beta-angle)
- }
-
- TeCoord2D coord(x,y);
- arcOut.add(coord);
- angle += deltaR;
- }
- arcOut.add(p3.location());
- return true;
-}
-
-bool TeGenerateCircle(TePoint& center, const double& radius, TeLine2D& circle, const short& NPoints)
-{
- //angle (in radians) of the circumference (2*Pi)
- double thetaR = 2 * 3.14159;
-
- //calculate the variation of the angle in radians for each point
- double deltaR = thetaR/(NPoints+1);
-
- //calculate a point P1 of the circumference
- TePoint p1(center.location().x()+radius, center.location().y());
-
- //calculate the coseno e seno of the angle (beta) between the center and the point P1
- //http://mathforum.org/library/drmath/view/55327.html
- double cosBeta = 1;
- double sinBeta = 0;
-
- //rela�es trigonom�ricas
- //sin(x+y) = sin(x)cos(y) + cos(x)sin(y),
- //cos(x+y) = cos(x)cos(y) - sin(x)sin(y),
- //sin(x-y) = sin(x)cos(y) - cos(x)sin(y),
- //cos(x-y) = cos(x)cos(y) + sin(x)sin(y),
-
- circle.add(p1.location());
- double angle = deltaR;
- for (int i=0; i<(NPoints+1); i++)
- {
- double x,y;
-
- //TeCOUNTERCLOCKWISE
- //c = h + r*cos(B+A),
- //d = k + r*sin(B+A),
-
- x = center.location().x() + radius * ((cosBeta*cos(angle))-(sinBeta*sin(angle))); //cos(beta+angle)
- y = center.location().y() + radius * ((sinBeta*cos(angle))+(cosBeta*sin(angle))); //sin(beta+angle)
-
- TeCoord2D coord(x,y);
- circle.add(coord);
- angle += deltaR;
- }
- circle.add(p1.location());
- return true;
-}
-
-double TeGetPrecision(TeProjection* proj)
-{
- if(!proj)
- return 0.000000001;
-
- if(proj->units() == "Meters")
- {
- return 0.001;
- }
-
- return 0.000000001; // Lat/Long e NoProjection
-}
-
-
diff --git a/src/terralib/kernel/TeGeometryAlgorithms.h b/src/terralib/kernel/TeGeometryAlgorithms.h
deleted file mode 100644
index 886e51f..0000000
--- a/src/terralib/kernel/TeGeometryAlgorithms.h
+++ /dev/null
@@ -1,1019 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeGeometryAlgorithms.h
- \brief This file contains Algorithms for Topological Operations.
- \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
-*/
-#ifndef __TERRALIB_INTERNAL_GEOMETRYALGORITHMS_H
-#define __TERRALIB_INTERNAL_GEOMETRYALGORITHMS_H
-
-#include "TeGeometry.h"
-#include "TeMultiGeometry.h"
-
-#include "TePrecision.h"
-#include "TeProjection.h"
-
-//! Intersection coordinates of two segments.
-typedef vector<TeCoord2D> TeIntersCoordsVec;
-
-/** @defgroup GeometryAlgorithms Geometry algorithms
- TerraLib geometry algorithms.
- @{
-*/
-
-/** @defgroup TopologicalOperators Topological operators
- @ingroup GeometryAlgorithms
- Functions that test topologival relation between two objects.
-\verbatim
- The topological operators are based on the intersection of interior, exterior and boundary of geometries:
- ------------------------------------------------------------------------------------------------------------------
- | TeGeometry | INTERIOR | BOUNDARY | EXTERIOR |
- ------------------------------------------------------------------------------------------------------------------
- | TePoint | The point itself | Empty | Everything except interior |
- | TeLine2D | All points except the end points | The two end points | Everything except interior and boundary |
- | TeLinearRing | All points | Empty | Everything except interior and boundary |
- | TePolygon | Everything between the external | All rings | Everything except interior and boundary |
- | | ring and the inner rings | | |
- ------------------------------------------------------------------------------------------------------------------
-
-We use:
- - I: for Interior
- - E: for Exterior
- - B: for Boundary
- - inter: Intersects
- - ^: AND
- - v: OR
- - A = refer to two-dimensional geometries (TePolygon and TePolygonSet)
- - L = refer to one-dimensional geometries (TeLine2D and TeLineSet)
- - P = refer to 0-dimensional geometries (TePoint and TePointSet)
- \endverbatim
-@{
-*/
-
-/** @defgroup TeEquals Equals test
- @ingroup TopologicalOperators
- Check if one object is equal another object.
-\verbatim
- Applies to: P/P, L/L and A/A.
- TeEquals(x, y) => (x inter y = x) ^ (y inter x = y)
- (B(x) inter I(y) = false) ^ (B(x) inter E(y) = false)
-\endverbatim
-@{
-*/
-//! If a specialized function is not used, returns false.
-template<class T1, class T2>
-inline bool TeEquals(const T1& /*o1*/, const T2& /*o2*/)
-{
- return false;
-}
-
-//! Check if coordinate 1 and coordinate 2 are equal
-template<>
-TL_DLL bool TeEquals(const TeCoord2D& c1, const TeCoord2D& c2);
-
-//! Check if point 1 and point 2 are equal
-template<>
-TL_DLL bool TeEquals(const TePoint& p1, const TePoint& p2);
-
-//! Check if lineRed and lineBlue are equal
-template<>
-TL_DLL bool TeEquals(const TeLine2D& redLine, const TeLine2D& blueLine);
-
-//! Check if polygon red and polygon blue are equal
-template<>
-TL_DLL bool TeEquals(const TePolygon& redPol, const TePolygon& bluePol);
-
-//! Check if polygonset1 and polygonset1 are equal
-template<>
-TL_DLL bool TeEquals( const TePolygonSet& ps1, const TePolygonSet& ps2 );
-
-//! Check if box 1 and box 2 are equal
-template<>
-TL_DLL bool TeEquals(const TeBox& bx1, const TeBox& bx2);
-
-//! Check if cell 1 and cell 2 are equal
-template<>
-TL_DLL bool TeEquals(const TeCell& cell1, const TeCell& cell2);
-/** @} */
-
-/** @defgroup TeDisjoint Disjoint test
- @ingroup TopologicalOperators
- Check if two objects are disjoint.
-\verbatim
- Applies to all geometries.
- TeDisjoint(x, y) => (x inter y = false)
- (I(x) inter I(y) = false) ^ (I(x) inter B(y) = false) ^ (B(x) inter I(y) = false) ^ (B(x) inter B(y) = false)
-\endverbatim
-@{
-*/
-//! Check if coordinate cl and coordinate c2 are disjoint
-TL_DLL bool TeDisjoint(const TeCoord2D& c1, const TeCoord2D& c2);
-
-//! Check if coordinate and box are disjoint
-TL_DLL bool TeDisjoint(const TeCoord2D& c, const TeBox& b);
-
-//! Check if box 1 and box 2 are disjoint
-TL_DLL bool TeDisjoint(const TeBox& bx1, const TeBox& bx2);
-
-//! Check if coordinate and line are disjoint
-TL_DLL bool TeDisjoint(const TeCoord2D& c, const TeLine2D& l);
-
-//! Check if coordinate and polygon are disjoint
-TL_DLL bool TeDisjoint(const TeCoord2D& c, const TePolygon& pol);
-
-//! Check if point l and point 2 are disjoint
-TL_DLL bool TeDisjoint(const TePoint& p1, const TePoint& p2);
-
-//! Check if point and object are disjoint
-TL_DLL bool TeDisjoint(const TePoint& p, const TeLine2D& l);
-
-//! Check if point and object are disjoint
-TL_DLL bool TeDisjoint(const TePoint& p, const TePolygon& pol);
-
-//! Check if lines are disjoint
-TL_DLL bool TeDisjoint(const TeLine2D& redLine, const TeLine2D& blueLine);
-
-//! Check if line and polygon are disjoint
-TL_DLL bool TeDisjoint(const TeLine2D& l, const TePolygon& pol);
-
-//! Check if polygons are disjoint
-TL_DLL bool TeDisjoint(const TePolygon& redPol, const TePolygon& bluePol);
-
-//! Check if cell 1 and cell 2 are disjoint
-TL_DLL bool TeDisjoint(const TeCell& cell1, const TeCell& cell2);
-
-//! Check if cell and line are disjoint
-TL_DLL bool TeDisjoint(const TeCell& cell, const TeLine2D& line);
-
-//! Check if cell and polygon are disjoint
-TL_DLL bool TeDisjoint(const TeCell& cell, const TePolygon& pol);
-
-//! Check if cell and point are disjoint
-TL_DLL bool TeDisjoint(const TeCell& cell, const TePoint& point);
-/** @} */
-
-
-/** @defgroup TeIntersects Intersects test
- @ingroup TopologicalOperators
- Check if one object intersects another object.
-\verbatim
- Applies to all geometries.
- TeIntersects(x, y) => !TeDisjoint(x, y)
- => (I(x) inter I(y) = true) v (I(x) inter B(y) = true) v (B(x) inter I(y) = true) v (B(x) inter B(y) = true)
-\endverbatim
-@{
-*/
-//! If a specialized function is not used, returns the disjoint negation
-
-template<class T1, class T2>
-bool TeIntersects(const T1& o1, const T2& o2)
-{
- return !TeDisjoint(o1, o2);
-}
-
-//! Check if coordinate and box intersects
-template<>
-TL_DLL bool TeIntersects(const TeCoord2D& c, const TeBox& b);
-
-//! Check if point and box intersects
-template<>
-TL_DLL bool TeIntersects(const TePoint& p, const TeBox& b);
-
-//! Check if boxes intersects
-template<>
-TL_DLL bool TeIntersects(const TeBox& bx1, const TeBox& bx2);
-/** @} */
-
-
-/** @defgroup TeTouches Touch test
- @ingroup TopologicalOperators
- Check if two objects touches.
-\verbatim
- Applies to A/A, L/L, L/A, P/A, P/L.
- TeTouches(x, y) => (I(x) inter I(y) = false) ^ (x inter y = true)
- => (I(x) inter I(y) = false) ^ ((B(x) inter I(y) = true) v (I(x) inter B(y) = true) v (B(x) inter B(y) = true))
- \endverbatim
- @{
-*/
-
-//! Check if coordinate and line touches
-TL_DLL bool TeTouches(const TeCoord2D& c, const TeLine2D& l);
-
-//! Check if coordinate and polygon touches
-TL_DLL bool TeTouches(const TeCoord2D& c, const TePolygon& pol);
-
-//! Check if point and object touches
-TL_DLL bool TeTouches(const TePoint& p, const TeLine2D& l);
-
-//! Check if point and object touches
-TL_DLL bool TeTouches(const TePoint& p, const TePolygon& pol);
-
-//! Check if line and line touches
-TL_DLL bool TeTouches(const TeLine2D& redLine, const TeLine2D& blueLine);
-
-//! Check if line and polygon
-TL_DLL bool TeTouches(const TeLine2D& l, const TePolygon& pol);
-
-//! Check if polygons touches
-TL_DLL bool TeTouches(const TePolygon& redPol, const TePolygon& bluePol);
-
-//! Check if boxes touches
-TL_DLL bool TeTouches(const TeBox& bx1, const TeBox& bx2);
-
-//! Check if cells touches
-TL_DLL bool TeTouches(const TeCell& c1, const TeCell& c2);
-
-//! Check if cell and line touches
-TL_DLL bool TeTouches(const TeLine2D& line, const TeCell& cell);
-
-//! Check if cell and polygon touches
-TL_DLL bool TeTouches(const TeCell& c1, const TePolygon& poly);
-
-//! Check if cell and point touches
-TL_DLL bool TeTouches( const TePoint& point, const TeCell& c1);
-/** @} */
-
-/** @defgroup TeCrosses Crosses test
- @ingroup TopologicalOperators
- Check if one object crosses another object.
-\verbatim
- TeCrosses(x, y) => dim(I(x) inter I(y)) = (max(dim(I(x)), dim(I(y))) - 1) ^ (x inter y != x) ^ (x inter y != y)
- Case 1: x = TeLine2D and y = TePolygon
- => (I(x) inter I(y) = true) ^ (I(x) inter E(y) = true)
- Case 2: x = TeLine2D and y = TeLine2D
- => dim(I(x) inter I(y)) = 0
-\endverbatim
-@{
-*/
-
-//! Check if red line crosses blue line
-TL_DLL bool TeCrosses(const TeLine2D& redLine, const TeLine2D& blueLine);
-
-//! Check if line crosses polygon
-TL_DLL bool TeCrosses(const TeLine2D& l, const TePolygon& pol);
-
-//! Check if line and cell crosses
-TL_DLL bool TeCrosses(const TeLine2D& l, const TeCell& cell);
-/** @} */
-
-
-/** @defgroup TeWithin Within test
- * @ingroup TopologicalOperators
- * Check if one object is within another object.
- \verbatim
- TeWithin(x, y) => (x inter y = x) ^ (I(x) inter I(y) = true)
- Case 1: P/P, P/L and P/A
- => (I(x) inter I(y) = true)
- Case 2: L/L and A/A
- => (I(x) inter I(y) = true) ^ (I(x) inter E(y) = false) ^ (B(x) inter E(y) = false) ^ (B(x) inter B(y) = false)
- Case 3: L/A
- => (I(x) inter I(y) = true) ^ (I(x) inter E(y) = false) ^ (B(x) inter E(y) = false) ^ (B(x) inter B(y) = false) ^ (I(x) inter B(y) = false)
-\endverbatim
- @{
-*/
-
-//! Check if coordinate 1 is within coordinate 2
-TL_DLL bool TeWithin(const TeCoord2D& c1, const TeCoord2D& c2);
-
-//! Check if coordinate is within a box
-TL_DLL bool TeWithin(const TeCoord2D& c, const TeBox& b);
-
-//! Check if a cordinate is within a line
-bool TeWithin(const TeCoord2D& c, const TeLine2D& l);
-
-//! Check if a cordinate is within a polygon
-TL_DLL bool TeWithin(const TeCoord2D& c, const TePolygon& pol);
-
-//! Check if point 1 is within point 2
-TL_DLL bool TeWithin(const TePoint& p1, const TePoint& p2);
-
-//! Check if point is within object
-TL_DLL bool TeWithin(const TePoint& p, const TeLine2D& l);
-
-//! Check if point is within object
-TL_DLL bool TeWithin(const TePoint& p, const TePolygon& pol);
-
-//! Check if red line is within blue line
-TL_DLL bool TeWithin(const TeLine2D& redLine, const TeLine2D& blueLine);
-
-//! Check if line is within polygon
-TL_DLL bool TeWithin(const TeLine2D& l, const TePolygon& pol);
-
-//! Check if red polygon is within blue polygon
-TL_DLL bool TeWithin(const TePolygon& redPol, const TePolygon& bluePol);
-
-//! Check if box1 is within box2
-TL_DLL bool TeWithin(const TeBox& bx1, const TeBox& bx2);
-
-//! Check if cell1 is within cell2
-TL_DLL bool TeWithin(const TeCell& cell1, const TeCell& cell2);
-
-//! Check if line is within cell
-TL_DLL bool TeWithin(const TeLine2D& line, const TeCell& cell);
-
-//! Check if cell is within polygon
-TL_DLL bool TeWithin(const TeCell& cell, const TePolygon& poly);
-
-//! Check if point is within cell
-TL_DLL bool TeWithin(const TePoint& point, const TeCell& cell);
-/** @} */
-
-/** @defgroup TeContains Contains test
- @ingroup TopologicalOperators
- Check if one object contains another object.
- TeContains(x, y) = TeWithin(y, x)
-@{
-*/
-
-//! If a specialized function is not used, returns false
-template<class T1, class T2>
-inline bool TeContains(const T1& o1, const T2& o2)
-{
- return TeWithin(o2, o1);
-}
-/** @} */
-
-/** @defgroup TeOverlaps Overlaps test
- @ingroup TopologicalOperators
- Check if one object overlaps another object.
-\verbatim
- TeOverlaps(x, y) => (dim(I(x)) = dim(I(y)) = dim(I(x) inter I(y))) ^ (x inter y != x) ^ (x inter y != y)
- Case 1: (x = TePolygon and y = TePolygon)
- => (I(x) inter I(y) = true) ^ (I(x) inter E(y) = true) ^ (E(x) inter I(y) = true)
- Case 2: x = TeLine2D and y = TeLine2D
- => (dim(I(x) inter I(y)) = 1) ^ (I(x) inter E(y) = true) ^ (E(x) inter I(y) = true)
- \endverbatim
-@{
-*/
-
-//! Check if red red overlaps blue line
-TL_DLL bool TeOverlaps(const TeLine2D& redLine, const TeLine2D& blueLine);
-
-//! Check if red polygon overlaps blue polygon
-TL_DLL bool TeOverlaps(const TePolygon& redPol, const TePolygon& bluePol);
-
-//! Check if cell1 overlaps cell2
-TL_DLL bool TeOverlaps(const TeCell& cell1, const TeCell& cell2);
-
-//! Check if cell overlaps polygon
-TL_DLL bool TeOverlaps(const TeCell& cell, const TePolygon& poly);
-/** @} */
-
-
-/** @defgroup TeCoveredBy Covered by test
- @ingroup TopologicalOperators
- Check if one object is covered by another object.
- \verbatim
- TeCoveredBy(x, y) => (x inter y = x) ^ (I(x) inter I(y) = true)
- - Case 1: (x = TePolygon and y = TePolygon) or (x = TeLine2D and y = TeLine2D)
- => (I(x) inter I(y) = true) ^ (I(x) inter E(y) = false) ^ (B(x) inter E(y) = false) ^ (B(x) inter B(y) = true)
- - Case 2: x = TeLine2D and y = TePolygon
- => (I(x) inter I(y) = true) ^ (I(x) inter E(y) = false) ^ (B(x) inter E(y) = false) ^ ((B(x) inter B(y) = true) v (I(x) inter B(y) = true))
- \endverbatim
- @{
- */
-
-//! Check if red line is covered by blue line
-TL_DLL bool TeCoveredBy(const TeLine2D& redLine, const TeLine2D& blueLine);
-
-//! Check if line is covered by polygon
-TL_DLL bool TeCoveredBy(const TeLine2D& l, const TePolygon& pol);
-
-//! Check if red polygon is covered by blue polygon
-TL_DLL bool TeCoveredBy(const TePolygon& redPol, const TePolygon& bluePol);
-
-//! Check if cell1 is covered by cell2
-TL_DLL bool TeCoveredBy(const TeCell& cell1, const TeCell& cell2);
-
-//! Check if polygon is covered by cell
-TL_DLL bool TeCoveredBy(const TePolygon& poly, const TeCell& cell);
-
-//! Check if line is covered by cell
-TL_DLL bool TeCoveredBy(const TeLine2D& line, const TeCell& cell);
-/** @} */
-
-/** @defgroup TeCovers Covers test
- @ingroup TopologicalOperators
- Check if one object covers another object.
- TeCovers(x, y) => TeCoveredBy(y, x)
-@{
-*/
-//! Check if one object covers another object
-template<typename T1, typename T2>
-inline bool TeCovers(T1& o1, T2& o2)
-{
- return TeCoveredBy(o2, o1);
-}
-/** @} */
-
-/** @defgroup TeRelation Relation test
- * @ingroup TopologicalOperators
- * Return the relation between two objects.
- * @{
- */
-/** \brief Returns the relation between coordinate c and line l.
- \param c The coordinate.
- \param l The line.
- \return one of the relations: INSIDE, OUTSIDE or BOUNDARY.
- \note It doesn't do box elimination, just uses from TeIsOnLine(coordinate, line) elimination
- */
-TL_DLL short TeRelation(const TeCoord2D& c, const TeLine2D& l);
-
- /** \brief Point in polygon inside/outside/boundary code.
- \param c The coordinate to test.
- \param r The simple polygon to test.
- \return one of the relations: INSIDE, OUTSIDE or BOUNDARY.
- \note The ring is treated as a simple polygon (no holes). Does box elimination.
-*/
-TL_DLL short TeRelation(const TeCoord2D& c, const TeLinearRing& r);
-
-/** \brief Coordinate in polygon inside/outside/boundary code.
- \param c The coordinate to test.
- \param pol The polygon to test.
- \return one of the relations: INSIDE, OUTSIDE or BOUNDARY.
- \note It doesn't do box elimination, just uses from TeRelation(coordinate, line) elimination
-*/
-TL_DLL short TeRelation(const TeCoord2D& c, const TePolygon& pol);
-
-/** \brief Point in polygon inside/outside/boundary code.
- \param p The coordinate to test.
- \param pol The polygon to test.
- \return one of the relations: INSIDE, OUTSIDE or BOUNDARY.
- \note It doesn't do box elimination, just uses from TeRelation(coordinate, line) elimination
-*/
-TL_DLL short TeRelation(const TePoint& p, const TePolygon& pol);
-
-/** \brief Point in polygon set inside/outside/boundary code.
- \param c The coordinate to test.
- \param pSet The polygon set to test.
- \return one of the relations: INSIDE, OUTSIDE or BOUNDARY.
- \note Does box elimination.
-*/
-TL_DLL short TeRelation(const TeCoord2D& c, const TePolygonSet& pSet);
-
-/** \brief This function returns the relation between two lines.
- \param lRed The first line.
- \param lBlue The second line.
- \param relation To return the relation that stop the search: TeDISJOINT, TeTOUCHES, TeWITHIN, TeCONTAINS, TeCROSSES, TeOVERLAPS, TeCOVEREDBY, TeCOVERS, TeEQUALS
- \note Doesn't do box elimination. You must implement the test in your own functions.
-*/
-TL_DLL short TeRelation(const TeLine2D& lRed, const TeLine2D& lBlue, const short& relation);
-
-/** \brief This function returns the relation between a line and a polygon.
- \param line The line.
- \param pol The polygon.
- \return one of the relations: TeDISJOINT, TeTOUCHES, TeWITHIN (THE LINE IS WITHIN), TeCROSSES, TeCOVEREDBY (THE LINE IS COVERED BY).
- \note Doesn't do box elimination. You must implement the test in your own functions.
-*/
-TL_DLL short TeRelation(const TeLine2D& line, const TePolygon& pol);
-
-/** \brief This function returns the relation between two polygons.
- \param pRed The first polygon.
- \param pBlue The second polygon.
- \return one of the relations: TeEQUALS, TeDISJOINT, TeTOUCHES, TeWITHIN (pRed IS WITHIN pBlue), TeCONTANS (pBlue CONTAINS pRed), TeOVERLAPS, TeCOVEREDBY (pRed IS COVERED BY pBlue) or TeCOVERS (pRed COVERS pBlue).
- \note Doesn't do box elimination. You must implement the test in your own functions.
-*/
-TL_DLL short TeRelation(const TePolygon& pRed, const TePolygon& pBlue);
-/** @} */
-/** @} */
-
-/** @defgroup BoxTests Special box tests
- * @ingroup GeometryAlgorithms
- * Box tests.
- * @{
-*/
-//! Check if box1 is DISJOINT or TOUCHes box2
-TL_DLL bool TeDisjointOrTouches(const TeBox& bx1, const TeBox& bx2);
-
-//! Check if coordinate c is WITHIN or TOUCHes segments c1 and c2
-bool TeWithinOrTouches(const TeCoord2D& c, const TeCoord2D& c1, const TeCoord2D& c2);
-/** @} */
-
-
-/** @defgroup GeometryTests Special Geometry tests
- * @ingroup GeometryAlgorithms
- * Geometry tests.
- * @{
-*/
-//! Check if geom1 is WITHIN, COVERED BY or EQUAL to geom2
-
-
-template<class T1, class T2>
-bool TeWithinOrCoveredByOrEquals(const T1& geom1, const T2& geom2)
-{
- short rel = TeRelation(geom1, geom2);
-
- if((rel&TeINSIDE) || (rel&TeBOUNDARY))
- return true;
-
- return false;
-}
-
-//! Check if box1 is WITHIN, COVERED BY or EQUAL to box2
-template<>
-TL_DLL bool TeWithinOrCoveredByOrEquals(const TeBox& bx1, const TeBox& bx2);
-
-//! Check if line1 is WITHIN, COVERED BY or EQUAL to line2
-template<>
-TL_DLL bool TeWithinOrCoveredByOrEquals(const TeLine2D& line1, const TeLine2D& line2);
-
-//! Check if line1 is WITHIN or COVERED BY to pol
-template<>
-TL_DLL bool TeWithinOrCoveredByOrEquals(const TeLine2D& line1, const TePolygon& pol);
-
-//! Check if pol1 is WITHIN, COVERED BY or EQUAL to pol2
-template<>
-TL_DLL bool TeWithinOrCoveredByOrEquals(const TePolygon& pol1, const TePolygon& pol2);
-/** @} */
-
-
-/** @defgroup IntersectionOperators Intersection Operators
- * @ingroup GeometryAlgorithms
- * Functions that calculate the intersection among objects or do intersection test.
- * @{
- */
-
-/** \brief Performs the intersection between box b1 and b2, returning the resulting box bout.
- \param bx1 The first box to do the intersection.
- \param bx2 The second box to do the intersection.
- \param bout The box formed by the intersection of bx1 and bx2.
-*/
-TL_DLL bool TeIntersection(const TeBox& bx1, const TeBox& bx2, TeBox& bout);
-
-/** \brief Returns the segments that intersept the poly polygon in the line y.
- \param poly A polygon.
- \param y The ordinate that cuts the polygons edges.
-*/
-TL_DLL TeCoordPairVect TeGetIntersections(const TePolygon &poly, const double& y);
-/** @} */
-
-
-/** @defgroup UnionOperators Union Operators
- * @ingroup GeometryAlgorithms
- * Functions that compute the union of objects.
- * @{
- */
-
-/** \brief Combine two box, make one that includes both.
- \param bx1 The first box to do the union.
- \param bx2 The second box to do the union.
-*/
-TL_DLL TeBox TeUnion(const TeBox& bx1, const TeBox& bx2);
-
-/** @} */
-
-/** @defgroup TeLocationFunctions Functions that finds the localization of objects.
- * @ingroup GeometryAlgorithms
- * Functions that finds the localization of objects.
- * @{
- */
-/** \brief Point in polygon inside/outside/boundary code.
- \param c The coordinate to test.
- \param r The simple polygon to test.
-
- \note Check if point is INSIDE of a given ring.
- The ring is treated as a simple polygon (no holes).
- Adapted from:
- Samosky, Joseph, "SectionView: A system for interactively specifying and
- visualizing sections through three-dimensional medical image data,
- M.S. Thesis, Department of Electrical Engineering and Computer Science,
- Massachusetts Institute of Technology, 1993.
- Obs: Doesn't do box elimination.
-*/
-TL_DLL bool TePointInPoly(const TeCoord2D& c, const TeLinearRing& r);
-
-/** \brief Check if coordinate c is on segment (segment is closed).
- \param c The coordinate to be tested.
- \param c1 The first segment's coordinate.
- \param c2 The second segment's coordinate.
-*/
-TL_DLL bool TeIsOnSegment(const TeCoord2D& c, const TeCoord2D& c1, const TeCoord2D& c2);
-
-/** \brief Check if coordinate c is on line boundary or on line interior (see explanation above for definition of boundary and interior of a line).
- \param c The coordinate to be tested.
- \param l The line used in the test.
-
- Obs: Do box elimination.
-*/
-TL_DLL bool TeIsOnLine(const TeCoord2D& c, const TeLine2D& l);
-
-/** \brief Locate the nearest line segment of a coordinate.
- \param pin The coordinate.
- \param line The line.
- \param segment The position of the segment in the line
- \param tol Tolerance.
-*/
-TL_DLL bool TeLocateLineSegment(TeCoord2D& pin, TeLine2D& line, int& segment, double tol);
-/** @} */
-
-/** @defgroup TeConvexHull Functions to compute the Convex Hull
- * @ingroup GeometryAlgorithms
- * Functions that returns the convex hull of a point list.
- * @{
- */
- /** \brief Returns the convexhull of a given list of coords in counterclockwise.
- \param coordSet A list with coordinates without duplicated coordinates.
-
- \note This algorithm is based on the book Computational Geometry
- by M. de Berg, M. van Kreveld, M. Overmars and O. Schwarzkopf - Springer Verlag - pp. 6.
- It is O(N log N).
-*/
-template<class T>
-TePolygon TeConvexHull(const T& coordSet);
-
-//! This is a explicit specialization that returns the convex hull of a TePolygon
-template<>
-TL_DLL TePolygon TeConvexHull(const TePolygon& p);
-
-//! This is a explicit specialization that returns the convex hull of a TePolygonSet
-template<>
-TL_DLL TePolygon TeConvexHull(const TePolygonSet& ps);
-
-//! This is a explicit specialization that returns the convex hull of a TePointSet. Must be defined!
-template<>
-TL_DLL TePolygon TeConvexHull(const TePointSet& ps);
-
-/** @} */
-
-/** @defgroup TeUtils Utilities functions.
- * @ingroup GeometryAlgorithms
- * @{
- */
-//! Given a projection "proj" returns a tolerance value in the same unit of projection to be used in geometric operations
-TL_DLL double TeGetPrecision(TeProjection* proj);
-
-//! This class implements the Epsilon-tweaking used in calculus.
-class TL_DLL TeGeometryAlgorithmsPrecision
-{
- protected:
-
- //! Constructor
- TeGeometryAlgorithmsPrecision();
-
- public:
-
- //! Tells if d1 is greater than d2 according to tolerance factor.
- static bool IsGreater(const double& d1, const double& d2)
- {
- return ((d1 - d2) > TePrecision::instance().precision());
- }
-
- //! Tells if d1 is greater than or equal to d2 according to tolerance factor.
- static bool IsGreaterEqual(const double& d1, const double& d2)
- {
- return ((d1 - d2) >= (-TePrecision::instance().precision()));
- }
-
- //! Tells if d1 is smaller than d2 according to a tolerance factor.
- static bool IsSmaller(const double& d1, const double& d2)
- {
- return ((d1 - d2) < -(TePrecision::instance().precision()));
- }
-
- //! Tells if d1 is smaller than or equals to d2 according to a tolerance factor.
- static bool IsSmallerEqual(const double& d1, const double& d2)
- {
- return ((d1 - d2) <= TePrecision::instance().precision());
- }
-
- //! Tells if d1 is equals to d2 according to a tolerance factor.
- static bool IsEqual(const double& d1, const double& d2)
- {
- return (fabs(d1 - d2) <= TePrecision::instance().precision());
- }
-
- //! Tells if d1 is different from d2 according to a tolerance factor.
- static bool IsDifferent(const double& d1, const double& d2)
- {
- return (fabs(d1 - d2) > TePrecision::instance().precision());
- }
-};
-
-//! Removes the duplicate coordinates of a line
-TL_DLL inline void TeRemoveDuplicatedCoordinates(TeLine2D& l)
-{
- for(unsigned int i = 0; i < l.size() - 1; ++i)
- if(TeEquals(l[i], l[i + 1]))
- {
- l.erase(i);
- --i;
- }
-
- return;
-}
-
-//! Removes the duplicate coordinates of a polygon
-TL_DLL inline void TeRemoveDuplicatedCoordinates(TePolygon& p)
-{
- for(unsigned int i = 0; i < p.size(); ++i)
- TeRemoveDuplicatedCoordinates(p[i]);
-
- return;
-}
-
-/** \brief Reverses the orientation of a line.
- \param lin The line to be reversed.
-*/
-TL_DLL inline void TeReverseLine(TeLine2D& lin)
-{
- for(unsigned int i=0,j=lin.size()-1 ; i<lin.size()/2 ; ++i,--j)
- {
- TeCoord2D p = lin[i];
- lin[i] = lin[j];
- lin[j] = p;
- }
-
- return;
-}
-
-
-/** \brief Verifies if a simple polygon defined as a linear ring is convex or not.
- \param ring The polygon to test convexity.
-*/
-TL_DLL bool TeIsConvex(const TeLinearRing& ring);
-
-/** \brief Returns the orientation of the ring (CLOCKWISE or COUNTERCLOCKWISE);
- \param r The ring to be checked.
-*/
-TL_DLL short TeOrientation(const TeLinearRing& r);
-
-/** @} */
-
-/** @defgroup MetricOperators Metric operators
- * @ingroup GeometryAlgorithms
- * Functions that do some usefull metric operations.
- * @{
- */
-
-/** \brief Returns the middle point of a segment.
- \param first The first segment's coordinate.
- \param last The second segment's coordinate.
- \param middle The middle point.
-*/
-TL_DLL void TeGetMiddlePoint(const TeCoord2D& first, const TeCoord2D& last, TeCoord2D& middle);
-
-/** \brief Calculates the Euclidian distance between two points.
- \param c1 First coordinate;
- \param c2 Second coordinate;
-*/
-TL_DLL double TeDistance(const TeCoord2D& c1, const TeCoord2D& c2);
-
-/** \brief Returns the length of a Line 2D.
- \param l The line to calculate the length.
-*/
-TL_DLL double TeLength(const TeLine2D& l);
-
-/** \brief Perpendicular distance from point to segment.
- \param first The first segment's coordinate.
- \param last The second segment's coordinate.
- \param pin The point to get the distance from the segment.
- \param pinter The point of intersection on the segment.
-*/
-TL_DLL double TePerpendicularDistance(const TeCoord2D& first, const TeCoord2D& last, const TeCoord2D& pin, TeCoord2D &pinter);
-
-/** \brief Minimal distance from point to segment.
- \param first The first segment's coordinate.
- \param last The second segment's coordinate.
- \param pin The point to get the minimal distance from the segment. This point is inside the segment
- \param pout The nearest segment point of the pin point.
- \param tol Numerical tolerance
-*/
-TL_DLL double TeMinimumDistance (const TeCoord2D& first, const TeCoord2D& last, const TeCoord2D& pin, TeCoord2D& pout, double tol = 0.0);
-
-/** \brief Template class to compute the area of a geometry
- \param geom The geometry whose area we want to known.
- \note This algorithm is based on the book Spatial Databases with Application to GIS
- by Philippe Rigaux, Michel O. Scholl and Agnes Voisard.
-
-*/
-
-template<class T>
-double TeGeometryArea(const T& /* geom */)
-{
- return 0.0;
-}
-
-//! This is a explicit specialization that returns the area of a TePolygon
-template<>
-TL_DLL double TeGeometryArea(const TePolygon& p);
-
-//! This is a explicit specialization that returns the area of a TePolygonSet
-template<>
-TL_DLL double TeGeometryArea(const TePolygonSet& ps);
-
-//! This is a explicit specialization that returns the area of a Box
-template<>
-TL_DLL double TeGeometryArea(const TeBox& b);
-
-//! This is a explicit specialization that returns the area of a Box
-template<>
-TL_DLL double TeGeometryArea(const TeMultiGeometry& mGeom);
-/** @} */
-
-/** @defgroup GeometryFunction Functions that return geometries.
- * @ingroup GeometryAlgorithms
- * Functions that return geometries.
- * @{
- */
-/** \brief Given a box return its polygon representation.
- \param b The box to create a polygon.
-*/
-TL_DLL TePolygon TeMakePolygon(const TeBox& b);
-
-/** \brief Given N points, finds a path that doesn't self-intersects
- \note Given N points, finds a path that doesn't self-intersects, visiting all points and returning
- to the begginning one. It is based on the book Algorithms by Robert Sedgewick, Addisson-Wesley, 1988;
- \param pSet The point set to form a path.
-*/
-TL_DLL TeLinearRing TeSimpleClosedPath(const TePointSet& pSet);
-/** @} */
-
-
-/** @defgroup TeFindCentroid Functions to compute the centroid
- * @ingroup GeometryAlgorithms
- * Functions that return the centroid.
- * @{
- */
-
-/** \brief Calculates the centroid of a multi geometry.
- \param p A multi geometry whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(TeMultiGeometry& mGeom);
-
-/** \brief Calculates the centroid of a polygon.
- \param p A TePolygon whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(const TePolygon& p);
-
-/** \brief Calculates a reference point.
- \param l A TeLine whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(const TeLine2D& l);
-
-/*! \fn TeCoord2D TeFindCentroid(const TeCell& c );
- \brief Calculates the centroid of a cell.
- \param c A TeCell whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(const TeCell& c);
-
-/** \brief Calculates the centroid of a point.
- \param p A TePoint whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(const TePoint& p);
-
-/** \brief Calculates the centroid of a text.
- \param t A TeText whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(const TeText& t);
-
-/** \brief Calculates the centroid of a polygon set.
- \param s A TePolygon set whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(const TePolygonSet& s);
-
-/** Calculates the centroid of a line set.
- \param s A TeLine set whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(const TeLineSet& s);
-
-/** \brief Calculates the centroid of a cell set.
- \param s A TeCell set whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(const TeCellSet& s);
-
-/** \brief Calculates the centroid of a point set.
- \param ps A TePointSet set whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(TePointSet& ps);
-
-/** \brief Calculates the centroid of a text set.
- \param ts A TeTextSet set whose centroid we want to known.
-*/
-TL_DLL TeCoord2D TeFindCentroid(TeTextSet& ts);
-
-/** \brief Calculates the center of a triangle.
- \param vert0 First triagle's vertex.
- \param vert1 Second triagle's vertex.
- \param vert2 Third triagle's vertex.
- \param pc The triangle center.
-*/
-TL_DLL bool TeFindTriangleCenter(const TeCoord2D& vert0, const TeCoord2D& vert1, const TeCoord2D& vert2, TeCoord2D& pc);
-/** \brief Calculates intersection between two segments.
- \param fr0 First point of first segment.
- \param to0 Second point of first segment.
- \param fr1 First point of second segment.
- \param to1 Second point of second segment.
- \param pi The intersection point coordinates.
- \return true is intersects, false otherwise.
-*/
-
-TL_DLL bool TeSegmentsIntersectPoint(const TeCoord2D& fr0, const TeCoord2D& to0, const TeCoord2D& fr1, const TeCoord2D& t1, TeCoord2D& pi);
-
-/** @} */
-
-
-/** @defgroup TeNearest Functions to compute the nearest part of an object to a point.
- * @ingroup GeometryAlgorithms
- * Auxiliary functions.
- * @{
- */
-//! Nearest node in set from location pt (i = the node index in the nodeset)
-TL_DLL bool TeNearest(TeCoord2D& pt, TeNodeSet& ns , int& i, const double& tol = 0.0);
-
-//! Nearest point in set from location pt (i = the point index in the pointset)
-TL_DLL bool TeNearest(TeCoord2D& pt, TePointSet& ps , int& i, const double& tol = 0.0);
-
-//! Nearest text in set from location pt (i = the text index in the textset)
-TL_DLL bool TeNearest(TeCoord2D& pt, TeTextSet& ts , int& i, const double& tol = 0.0);
-
-//! Nearest line in set from location pt (i = the line index in the lineset and pi = the closest point)
-//! The pi point can be outside a line of the line set
-TL_DLL bool TeNearest(TeCoord2D& pt, TeLineSet& ls , int& i, TeCoord2D& pi, const double& tol);
-
-//! Nearest line in set from location pt (i = the line index in the lineset and pout = the closest point)
-//! The pout point must be inside a line of the line set
-TL_DLL bool TeNearest (TeCoord2D& pt,TeLineSet& ls, int& lindex, TeCoord2D& pout, double& dmin, const double& tol = 0.0);
-
-//! Nearest polygon in set from location pt (i = the polygon index in the polygonset).
-TL_DLL bool TeNearest(TeCoord2D& pt, TePolygonSet& ps , int& i, const double& tol = 0.0);
-
-//! Nearest line in set from location pt (i = the line index in lineset) calculated by the vertex of the lines
-TL_DLL bool TeNearestByPoints(TeCoord2D& pt, TeLineSet& ls , int& i, double& dist, const double& tol = 0.0);
-/** @} */
-
-/** @defgroup CurveFunctions Functions used to deal with smooth curves
- * @ingroup GeometryAlgorithms
- * @{
- */
-/** \brief Given three points of a circunference, returns its center point.
- \param p1 First point.
- \param p2 Second point.
- \param p3 Third point.
- \param center Circunference center.
- This algorithm is adapted from http://www.delphiforfun.org/Programs/Math_Topics/circle_from_3_points.htmbook.
-*/
-TL_DLL bool TeGetCenter(TePoint p1, TePoint p2, TePoint p3, TePoint ¢er);
-
-/** \brief Given three points of a circunference, returns the radius.
- \param p1 First point.
- \param p2 Second point.
- \param p3 Third point.
- This algorithm is adapted from http://www.delphiforfun.org/Programs/Math_Topics/circle_from_3_points.htmbook.
-*/
-TL_DLL double TeGetRadius(TePoint &p1, TePoint &p2, TePoint &p3);
-
-/** \brief Given three points returns a smooth arc as a TeLine2D that contains a given total number of points.
-
- \param p1 First point.
- \param p2 Second point.
- \param p3 Third point.
- \param arcOut The return arc.
- \param NPoints Number of arc points.
-
- This algorithm is adapted from http://mathforum.org/dr.math/
-
-*/
-TL_DLL bool TeGenerateArc(TePoint& p1, TePoint& p2, TePoint& p3, TeLine2D& arcOut, const short& NPoints);
-
-/** \brief Given a center point and a radius, returns the circle as a TeLine2D interpolated by a given number of points
- \param center Center point of the circle.
- \param radius radius of the circle.
- \param circle The return circle
- \param NPoints Number of circle points.
-*/
-TL_DLL bool TeGenerateCircle(TePoint& center, const double& radius, TeLine2D& circle, const short& NPoints);
-
-/** \brief Performs a line simplication
- \param line The line to be simplified
- \param snap Simplification threshold
- \param maxdist The maximum distance between intermediary segments
-*/
-TL_DLL bool TeLineSimplify(TeLine2D& line, double snap, double maxdist);
-
-
-/** @} */
-
-/** @} */ // end of group GeometryAlgorithms
-
-
-#endif // __TERRALIB_INTERNAL_GEOMETRYALGORITHMS_H
diff --git a/src/terralib/kernel/TeGroupingAlgorithms.cpp b/src/terralib/kernel/TeGroupingAlgorithms.cpp
deleted file mode 100644
index 0f4754d..0000000
--- a/src/terralib/kernel/TeGroupingAlgorithms.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeGroupingAlgorithms.h"
-
-void
-TeGroupByUniqueValue(vector<string>& vec, TeAttrDataType tipo, vector<TeSlice>& result, int precision)
-{
- unsigned int i, j;
-
- if (tipo == TeINT)
- {
- vector<int> v;
- for (i = 0; i < vec.size(); ++i)
- v.push_back(atoi(vec[i].c_str()));
- sort(v.begin(), v.end());
-
- for (i = 0; i < v.size(); ++i)
- vec[i] = Te2String(v[i]);
- }
- else if (tipo == TeREAL)
- {
- vector<double> v;
- for (i = 0; i < vec.size(); ++i)
- {
- double a = atof(vec[i].c_str());
- v.push_back(a);
- }
- stable_sort(v.begin(), v.end());
-
- for (i = 0; i < v.size(); ++i)
- vec[i] = Te2String(v[i], precision);
- }
- else
- {
- sort(vec.begin(), vec.end());
- }
-
- // Check the elements that are equal, incrementing
- // the variable count associated to each one
- int count = 1;
- TeSlice slice;
- unsigned int sz = vec.size();
- for (i = 0, j = 1; i < sz - 1 && j < sz; ++i, ++j)
- {
- if (vec[i] == vec[j])
- ++count;
- else
- {
- slice.from_ = vec[i];
- slice.count_ = count;
- result.push_back(slice);
- count = 1;
- }
- }
-
- if ( (i>1) && (vec[i] == vec[i-1]) )
- {
- slice.from_ = vec[i];
- slice.count_ = count;
- result.push_back(slice);
- }
- else
- {
- slice.from_ = vec[i];
- slice.count_ = 1;
- result.push_back(slice);
- }
-}
-
-void
-TeGroupByEqualStep(double min, double max, int nstep, vector<TeSlice>& result, int precision)
-{
- double slice = (max - min)/double(nstep);
- int ns;
- for (ns=0;ns<nstep;ns++)
- {
- TeSlice ps;
- ps.count_ = 0;
- ps.from_ = Te2String(min+double(ns)*slice, precision);
- ps.to_ = Te2String(min+double(ns+1)*slice, precision);
- result.push_back(ps);
- }
- min = TeAdjustToPrecision(min, precision, true);
- result[0].from_ = Te2String(min, precision);
- max = TeAdjustToPrecision(max, precision);
- result[result.size()-1].to_ = Te2String(max, precision);
-}
diff --git a/src/terralib/kernel/TeGroupingAlgorithms.h b/src/terralib/kernel/TeGroupingAlgorithms.h
deleted file mode 100644
index f5612a7..0000000
--- a/src/terralib/kernel/TeGroupingAlgorithms.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeGroupingAlgorithms.h
- \brief This file contains some generic grouping algorithms (based on iterators)
-*/
-
-#ifndef __TERRALIB_INTERNAL_GROUPINGALGORITHMS_H
-#define __TERRALIB_INTERNAL_GROUPINGALGORITHMS_H
-
-#include "TeDefines.h"
-#include "TeSlice.h"
-#include "TeUtils.h"
-#include "TeDataTypes.h"
-
-#include <math.h>
-#include <time.h>
-#include <algorithm>
-
-
-//! Finds the element with minimum value among the elements contained in a range of iterators
-template<typename It>
-void TeMinimumValue(It begin, It end, vector<double>& minValue, double dummy=-9999.99, bool usesDummy=false)
-{
- for (int i=0; i<minValue.size(); i++)
- minValue[i] = TeMAXFLOAT;
-
- It it = begin;
- double val;
- while ( it != end)
- {
- if (!(usesDummy && dummy == val))
- for (int i=0; i<minValue.size(); i++)
- {
- val= (*it)[i];
- if (val < minValue[i])
- minValue[i] = val;
- }
- it++;
- }
-}
-
-//! Finds the element with maximum value among the elements contained in a range of iterators
-template<typename It>
-void TeMaximumValue(It begin, It end, vector<double>& maxValue, double dummy=-9999.99, bool usesDummy=false)
-{
- for (int i=0; i<maxValue.size(); i++)
- maxValue[i] = -TeMAXFLOAT;
-
- It it = begin;
- double val;
- while ( it != end)
- {
- if (!(usesDummy && dummy == val))
- for (int i=0; i<maxValue.size(); i++)
- {
- val= (*it)[i];
- if (val > maxValue[i])
- maxValue[i] = val;
- }
- it++;
- }
-}
-
-//! Defines the classes (slices) of a equal step grouping
-TL_DLL void TeGroupByEqualStep(double min, double max, int nstep, vector<TeSlice>& result, int precision=0);
-
-/** @defgroup GenGroupAlg Generic Algorithms to do grouping
- * A set of of generic functions to do grouping
- * @{
- */
-
-//! Groups a set of elements defined by a range of iterators in nstep groups, using Equal Step algorithm
-template<class iterator>
-void TeGroupByEqualStep(iterator begin, iterator end, int nstep, vector<TeSlice>& result,
- int precision=0, bool countElements = true)
-{
- double min = TeMAXFLOAT;
- double max = -TeMAXFLOAT;
-
- iterator it=begin;
- while(it < end)
- {
- min = MIN(min, *it);
- max = MAX(max, *it);
- it++;
- }
- double slice = (max - min)/double(nstep);
- int ns;
- for (ns=0;ns<nstep;ns++)
- {
- TeSlice ps;
- ps.count_ = 0;
- ps.from_ = Te2String(min+double(ns)*slice, precision);
- ps.to_ = Te2String(min+double(ns+1)*slice, precision);
- result.push_back(ps);
- }
- min = TeAdjustToPrecision(min, precision, true);
- result[0].from_ = Te2String(min, precision);
- max = TeAdjustToPrecision(max, precision);
- result[result.size()-1].to_ = Te2String(max, precision);
-
- // Set the number of elements for each slice
- if (countElements == true)
- TeElemCountingBySlice(begin, end, result);
-}
-
-//! Groups a set of elements defined by a range of iterators in nstep groups, using Quantil algorithm
-template<class iterator>
-void TeGroupByQuantil(iterator begin, iterator end, int nstep, vector<TeSlice>& result,
- int precision = 0, bool countElements = true)
-{
- sort(begin, end);
-
- int size = end - begin;
- double step = (double)size / (double)nstep;
-
- int n = 0;
- iterator it = begin;
- while(it < end)
- {
- TeSlice ps;
- ps.from_ = Te2String((*it), precision);
- int p = (int)(step * (double)++n + .5);
- it = begin + p;
- if(it < end)
- ps.to_ = Te2String((*it), precision);
- else
- ps.to_ = Te2String(*(it-1), precision);
- result.push_back(ps);
- }
- if(end-begin > 1)
- {
- double min = (*begin);
- double max = (*(end-1));
- min = TeAdjustToPrecision(min, precision, true);
- result[0].from_ = Te2String(min, precision);
- max = TeAdjustToPrecision(max, precision);
- result[result.size()-1].to_ = Te2String(max, precision);
- }
-
- // Set the number of elements for each slice
- if (countElements == true)
- TeElemCountingBySlice(begin, end, result);
-}
-
-//! Groups a set of elements defined by a range of iterators in ndev groups, using Standanrd deviation algorithm
-template<class iterator>
-void TeGroupByStdDev(iterator begin, iterator end, double ndev, vector<TeSlice>& result, string& rmean,
- int precision = 0, bool countElements = true)
-{
- // Compute mim, max and mean
- double min = TeMAXFLOAT;
- double max = -TeMAXFLOAT;
- long double sum=0.;
- long double sm2=0.;
- iterator it=begin;
- while(it < end)
- {
- min = MIN(min, *it);
- max = MAX(max, *it);
- sum += (*it);
- sm2 += ((*it) * (*it));
- it++;
- }
- double cont = (double)(end - begin);
- double mean = (double)(sum/cont);
- long double var = (sm2 / cont) - (mean * mean);
- double sdev = sqrt(var);
-
- double slice = sdev * ndev;
-
- vector<TeSlice> aux;
- rmean = Te2String(mean, precision);
- double val = mean;
- while(val-slice > min-slice)
- {
- TeSlice ps;
- double v = val - slice;
- ps.from_ = Te2String(v, precision);
- ps.to_ = Te2String(val, precision);
- aux.push_back(ps);
- val = v;
- }
-
- if(aux.size())
- {
- typename vector<TeSlice>::iterator sit = aux.end() - 1;
- while(sit >= aux.begin())
- result.push_back(*sit--);
- }
-
- string media = "mean = " + rmean;
- TeSlice ps;
- ps.from_ = media;
- ps.to_.clear();
- result.push_back(ps);
- val = mean;
- while(val+slice < max+slice)
- {
- TeSlice ps;
- double v = val + slice;
- ps.from_ = Te2String(val, precision);
- ps.to_ = Te2String(v, precision);
- result.push_back(ps);
- val = v;
- }
- if(result.size() > 2)
- {
- if (result[0].from_.find("mean") == string::npos)
- {
- min = TeAdjustToPrecision(min, precision, true);
- result[0].from_ = Te2String(min, precision);
- }
- if (result[result.size()-1].from_.find("mean") == string::npos)
- {
- max = TeAdjustToPrecision(max, precision);
- result[result.size()-1].to_ = Te2String(max, precision);
- }
- }
-
- // Set the number of elements for each slice
- if (countElements == true)
- TeElemCountingBySlice(begin, end, result);
-}
-
-
-//! Counts the number of elements, from a general container, per slice of a vector of slices
-template<class iterator>
-void TeElemCountingBySlice(iterator begin, iterator end, vector<TeSlice>& result)
-{
- iterator it;
- double from, to;
-
- for (unsigned int i = 0; i < result.size(); ++i)
- {
- TeSlice& sl = result[i];
- sl.count_ = 0;
- from = atof(sl.from_.c_str());
- to = atof(sl.to_.c_str());
- for (it = begin; it != end; ++it)
- {
- if (*it >= from && *it < to)
- ++sl.count_;
- }
- }
-}
-
-
-//! Groups a set of elements in a vector of string using Unique Value algorithm
-TL_DLL void TeGroupByUniqueValue(vector<string>& vec, TeAttrDataType tipo, vector<TeSlice>& result, int precision);
-
-/** @} */
-#endif
-
-
-
-
-
-
-
-
diff --git a/src/terralib/kernel/TeImportRaster.cpp b/src/terralib/kernel/TeImportRaster.cpp
deleted file mode 100644
index 3b1c0b2..0000000
--- a/src/terralib/kernel/TeImportRaster.cpp
+++ /dev/null
@@ -1,687 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeRasterRemap.h"
-#include "TeDecoderDatabase.h"
-#include "TeRaster.h"
-#include "TeDecoderMemory.h"
-#include "TeRasterParams.h"
-#include "TeProgress.h"
-#include "TeVectorRemap.h"
-#include "TeImportRaster.h"
-
-//FAMI #include "TeLibJpegWrapper.h" //not used; otherwise, needs to define macro JPEG_DEFINED
-
-
-TeLayer*
-TeImportRaster (const string& layerName, TeRaster* rasterIn, TeDatabase* database)
-{
- if (!database || layerName.empty() || !rasterIn ||
- (rasterIn->params().status_ != TeRasterParams::TeReadyToRead &&
- rasterIn->params().status_ != TeRasterParams::TeReadyToWrite))
- return 0;
-
- // find a valid layer name
- string newLayerName = layerName;
- TeLayerMap& layerMap = database->layerMap();
- TeLayerMap::iterator it;
- bool flag = true;
- int n = 1;
- while (flag)
- {
- for (it = layerMap.begin(); it != layerMap.end(); ++it)
- {
- if (TeStringCompare(it->second->name(),newLayerName))
- break;
- }
- if (it == layerMap.end())
- flag = 0;
- else
- newLayerName = layerName + "_" +Te2String(n);
- n++;
- }
-
- TeLayer* newLayer = new TeLayer(newLayerName,database,rasterIn->projection());
- if (newLayer->id() <= 0 )
- return 0; // couldn�t create new layer
-
- // block dimension guessing
- unsigned int bw = 512;
- unsigned int bh = 512; // an initial guess...
-
- // if raster is up to 512x512 store it in one block
- if (rasterIn->params().nlines_< 512 && rasterIn->params().ncols_< 512)
- {
- bw = rasterIn->params().ncols_;
- bh = rasterIn->params().nlines_;
- }
- // if ncols<1024 build blocks of 1 line
- else if (rasterIn->params().ncols_ < 1024)
- {
- bw = rasterIn->params().ncols_;
- bh = 1;
- }
-
- if (TeProgress::instance())
- TeProgress::instance()->reset();
-
- bool res = TeImportRaster(newLayer, rasterIn, bw, bh, TeRasterParams::TeNoCompression,
- "", rasterIn->params().dummy_[0], rasterIn->params().useDummy_, TeRasterParams::TeNoExpansible);
- if (res)
- return newLayer;
-
- database->deleteLayer(newLayer->id());
- delete newLayer;
- return 0;
-}
-
-
-// This function mosaics an input raster to one previsously existing in a TerraLib layer
-bool TeMosaicRaster(TeRaster* rasterIn, TeLayer* layer, const string& objectId)
-{
-
- // layer must exist and input raster should be read to be read
- if (!layer || !rasterIn || rasterIn->params().status_ != TeRasterParams::TeReadyToRead)
- return false;
-
- TeRaster* rasterOut;
- if (!objectId.empty()) // if object id informed try to get raster associated to it
- rasterOut = layer->raster(objectId,'w');
- else // else try to get first one found
- rasterOut = layer->raster();
-
- if (!rasterOut) // no raster asked or no raster at all
- return false; // can not do mosaic
-
- if (rasterOut->params().tiling_type_==TeRasterParams::TeNoExpansible)
- return false; // can mosaic if is not possible
-
- // allows mosaic of same photometric types only
- if (rasterOut->params().photometric_[0] != rasterIn->params().photometric_[0])
- return false;
-
- // increases output box to: input raster box + output raster box
- TeBox boxIn = rasterIn->params().box();
-
- // if necessary remap input box to output projection
- if (!(*(rasterIn->projection()) == *(rasterOut->projection())))
- boxIn = TeRemapBox(boxIn,rasterIn->projection(),rasterOut->projection());
-
- // adjust it to expansible values
- boxIn = adjustToCut(boxIn, rasterOut->params().blockWidth_*rasterOut->params().resx_,
- rasterOut->params().blockHeight_*rasterOut->params().resy_);
-
- // sum stored and input boxes
- TeBox newBox = rasterOut->params().boundingBox();
- updateBox(newBox,boxIn);
-
- // update box in parameters of the raster and it's decoder
- rasterOut->params().boundingBoxResolution(newBox.x1_,newBox.y1_,newBox.x2_,newBox.y2_,
- rasterOut->params().resx_, rasterOut->params().resy_);
-
- rasterOut->decoder()->params().boundingBoxResolution(newBox.x1_,newBox.y1_,newBox.x2_,newBox.y2_,
- rasterOut->params().resx_, rasterOut->params().resy_);
- rasterOut->params().nTilesInMemory_ = 0;
-
- // creates a remapping from input raster to output raster
- TeRasterRemap remap(rasterIn, rasterOut);
- if (remap.apply(true)) // o.k.
- {
- TeRasterParams rp = rasterOut->params();
-
- // atualizes the representation box in memory
- TeRepresentation* repp = layer->getRepresentation(TeRASTER);
- TeBox boxNew = rp.box();
- updateBox(repp->box_,rp.box());
- repp->nCols_ = rp.ncols_;
- repp->nLins_ = rp.nlines_;
- repp->resX_ = rp.resx_;
- repp->resY_ = rp.resy_;
-
- // atualizes representation in the database
- layer->database()->updateRasterRepresentation(layer->id(),rp,objectId);
- layer->updateLayerBox(rp.boundingBox());
- rasterOut->clear();
- return true;
- }
- return false;
-}
-
-
-bool TeImportRaster (TeLayer* layer, TeRaster* rasterIn,
- unsigned int bWidth, unsigned int bHeight,TeRasterParams::TeRasterCompressionMode compress,
- const string& objectId, double dummy, bool useDummy,
- TeRasterParams::TeRasterTilingType indext)
-{
-
- if (!layer || !rasterIn)
- return false;
-
- string objId;
- if (objectId.empty())
- objId = "O1";
- else
- objId = objectId;
-
-
- // check if there is a raster geometry to be modified
- string tableGeo;
- TeRepresentation* repp = 0;
- repp = layer->getRepresentation(TeRASTER);
- if (!repp || !layer->raster(objectId)) // layer doesn�t have any
- { // or the desired raster geometry
- // a new one should be created
- TeProjection* projIn = rasterIn->projection();
- TeProjection* projOut = layer->projection();
-
- TeRasterParams parOut = rasterIn->params(); // parameters of the raster being created
- // start with the same parameters as input raster
-
- parOut.setCompressionMode(compress); // overwrites some parameters
- parOut.nTilesInMemory_ = 0; // according to the specified in the interface
- parOut.blockHeight_ = bHeight;
- parOut.blockWidth_ = bWidth;
- parOut.setDummy(dummy);
- parOut.useDummy_ = useDummy;
- parOut.tiling_type_ = indext;
-
- TeBox newBox = rasterIn->params().boundingBox();
-
- // if input raster has some rotation associated it has to be corrected
- // during the importing
- if (parOut.dxI_ != 0. || parOut.dyJ_ != 0.)
- {
- parOut.boundingBoxResolution(newBox.x1_,newBox.y1_,newBox.x2_,newBox.y2_,parOut.resx_,parOut.resy_);
- parOut.dxI_= 0.0;
- parOut.dyJ_= 0.0;
- parOut.dxJ_ = 0.0;
- parOut.dyI_ = 0.0;
- }
-
- bool diffProj = false;
- parOut.projection(projOut);
- if (projIn && projOut && !(*projIn == *projOut))
- {
- diffProj = true;
- TeBox boxIn = rasterIn->params().boundingBox();
- newBox = TeRemapBox (boxIn,projIn,projOut);
- parOut.resx_ = newBox.width()/parOut.ncols_; // recalculates resolutions
- parOut.resy_ = newBox.height()/parOut.nlines_; // for the new projection
- parOut.boundingBoxResolution(newBox.x1_,newBox.y1_,newBox.x2_,newBox.y2_,parOut.resx_,parOut.resy_);
- newBox = parOut.box();
- }
-
- if (indext == TeRasterParams::TeExpansible) // if mosaicable adjust box
- parOut.resizeToTiling(newBox,bWidth,bHeight); // to be cut in blocks of bWidth X bHeight (in projection units)
-
- parOut.decoderIdentifier_ = "DB"; // parameters of the decoder
- parOut.fileName_ = "RasterLayer" + Te2String(layer->id()) + "_R_" + objId;
-
- if (parOut.photometric_[0] == TeRasterParams::TePallete)
- parOut.lutName_ = parOut.fileName_ + "_LUT";
-
- if (!layer->addRasterGeometry(parOut,objId)) // creates the empty raster geometry
- return false;
-
- // create a decoder to raster in a TerraLib database
- parOut.mode_ = 'w';
- TeDecoderDatabase *dbDecoder = new TeDecoderDatabase(parOut);
- dbDecoder->setDB(layer->database());
-
- // optimization: we don't need to go through remap routines.
- // just cut the input raster and save the tiles
- bool res=false;
- TeRasterParams parF;
- if (indext == TeRasterParams::TeNoExpansible && !diffProj)
- {
- int ntiles = (parOut.nlines_/parOut.blockHeight_)*(parOut.ncols_/parOut.blockWidth_);
- if(TeProgress::instance())
- TeProgress::instance()->setTotalSteps(ntiles);
- int count = 0;
- clock_t ti, tf;
- int x=0, y=0, b, nb=parOut.nBands(),lx, ly;
- double val= parOut.dummy_[0];
- TeMemoryPage page(parOut.blockHeight_*parOut.blockWidth_,val,parOut.dataType_[0]);
- string index;
- ti = clock();
- while (y<parOut.nlines_) // for each row of tiles
- {
- page.ulLin_ = y;
- x=0;
- while (x<parOut.ncols_) // for each tile in a row
- {
- page.clear();
- page.ulCol_= x;
- for (b=0; b<nb; ++b) // for each band;
- {
- for (ly=0; ly<parOut.blockHeight_; ++ly)
- {
- for (lx=0; lx<parOut.blockWidth_; ++lx) // write the tile
- {
- if (rasterIn->getElement(x+lx,y+ly,val,b))
- {
- page.setVal(x+lx,y+ly,parOut.blockWidth_,val);
- if (val<parOut.vmin_[b])
- parOut.vmin_[b] = val;
- if (val>parOut.vmax_[b])
- parOut.vmax_[b] = val;
- }
- }
- }
- index = dbDecoder->codifyId(x,y,b,1,0);
- if (!dbDecoder->putRasterBlock(index,page.data_,page.pageSize()))
- res=false;
- page.clear();
- }
- x+= parOut.blockWidth_;
- ++count;
- if(TeProgress::instance())
- {
- tf = clock();
- if (int((tf-ti)/CLOCKS_PER_SEC) > 3)
- {
- if (TeProgress::instance()->wasCancelled())
- break;
- TeProgress::instance()->setProgress(count);
- ti = tf;
- }
- }
- }
- y+= parOut.blockHeight_;
- }
- if (TeProgress::instance())
- TeProgress::instance()->reset();
-
- // atualizes the representation box in memory
- TeRepresentation* repp = layer->getRepresentation(TeRASTER);
- updateBox(repp->box_,parOut.box());
- repp->nCols_ = parOut.ncols_;
- repp->nLins_ = parOut.nlines_;
- repp->resX_ = parOut.resx_;
- repp->resY_ = parOut.resy_;
- layer->updateLayerBox(parOut.boundingBox());
- layer->database()->updateRasterRepresentation(layer->id(),dbDecoder->params(),objectId);
- // atualizes representation in the database
- for (b=0; b<nb; ++b)
- {
- dbDecoder->params().vmax_[b]=parOut.vmax_[b];
- dbDecoder->params().vmin_[b]=parOut.vmin_[b];
- }
- layer->database()->updateRasterRepresentation(layer->id(),dbDecoder->params(),objectId);
- dbDecoder->clear();
- res=true;
- }
- else
- {
- TeRaster* rasterOut = new TeRaster();
- rasterOut->setDecoder(dbDecoder);
- rasterOut->init();
- TeRasterRemap remap(rasterIn, rasterOut);
- if (remap.apply(true))
- {
- TeRepresentation* repp = layer->getRepresentation(TeRASTER);
- updateBox(repp->box_,rasterOut->params().box());
- repp->nCols_ = rasterOut->params().ncols_;
- repp->nLins_ = rasterOut->params().nlines_;
- repp->resX_ = rasterOut->params().resx_;
- repp->resY_ = rasterOut->params().resy_;
-
- // atualizes representation in the database
- layer->database()->updateRasterRepresentation(layer->id(),rasterOut->params(),objectId);
- layer->updateLayerBox(rasterOut->params().boundingBox());
- rasterOut->clear();
- res = true;
- }
- }
- if (res)
- {
- // create spatial index in the block box
- string tableR = layer->database()->getRasterTable(layer->id(),objectId);
- layer->database()->insertMetadata(tableR,layer->database()->getSpatialIdxColumn(TeRASTER), 0.000005,0.000005,layer->box());
- layer->database()->createSpatialIndex(tableR,layer->database()->getSpatialIdxColumn(TeRASTER), (TeSpatialIndexType)TeRTREE);
- }
- delete dbDecoder;
- return res;
- }
- else
- {
- // layer contains already a raster representation associated to the
- // object id: calls mosaic operation
- return TeMosaicRaster(rasterIn,layer,objId);
- }
-}
-
-bool
-TeBuildLowerResolution(TeLayer* layer, TeRaster* rasterIn, int resFac, const string& objectId)
-{
- if (!layer || !rasterIn) // layer and input raster pointers shouldn't be null
- return false;
-
- string objId; // if empty try to get the default object identification
- if (objectId.empty())
- objId = "O1";
- else
- objId = objectId;
-
- string tableName;
- TeRepresentation* repp = layer->getRepresentation(TeRASTER);
- if (repp)
- {
- tableName = layer->database()->getRasterTable(layer->id(), objId);
- if (tableName.empty())
- return false; // layer doesn�t have a raster geometry to this object id
- }
- else
- return false; // layer doesn�t have any raster geometry
-
- // retrieves the original raster
- TeRaster* originalRaster = layer->raster(objId);
- TeBox bbOriginalRes = originalRaster->params().boundingBox();
-
- // builds some parameters relative to the new resolution
- TeRasterParams parNewRes = originalRaster->params();
- parNewRes.resolution_ = resFac;
- parNewRes.mode_ = 'w';
- parNewRes.boundingBoxResolution(bbOriginalRes.x1_, bbOriginalRes.y1_,bbOriginalRes.x2_, bbOriginalRes.y2_,
- parNewRes.resx_*resFac, parNewRes.resy_*resFac);
-
- // adjust box to tiling in geographical coordinates
- if (originalRaster->params().tiling_type_ == TeRasterParams::TeExpansible)
- {
- TeBox b = parNewRes.boundingBox();
- int w = parNewRes.blockWidth_;
- int h = parNewRes.blockHeight_;
- parNewRes.resizeToTiling(b, w, h);
- }
-
-
- // create a decoder to raster in a TerraLib database
- TeDecoderDatabase *dbDecoder = new TeDecoderDatabase(parNewRes);
- dbDecoder->setDB (layer->database());
-
- TeRaster* rasterOut = new TeRaster();
- rasterOut->setDecoder(dbDecoder);
- rasterOut->init();
-
- // remap;
- TeRasterRemap remap;
- remap.setInput(rasterIn);
- remap.setOutput(rasterOut);
- bool status = remap.apply(true);
- rasterOut->clear();
- delete dbDecoder;
- return status;
-}
-
-
-
-void
-TeCalculateMean(TeDecoderMemory* decMem, vector<TeMemoryPage*> pages,int ulColStart,int ulLinStart)
-{
- int i,j, c=ulColStart, l=ulLinStart;
- unsigned int b;
- int npixels;
- double mean,val;
- int nlines = decMem->params().nlines_-1;
- int ncols = decMem->params().ncols_-1;
- double dummy;
-
- for (b=0; b<pages.size(); ++b)
- {
- dummy = decMem->params().dummy_[b];
- l=ulLinStart;
- for (i=0; i<nlines; i+=2)
- {
- c=ulColStart;
- for (j=0; j<ncols; j+=2)
- {
- mean = 0.0;
- npixels = 0;
- if ((j>0) && (i>0) && decMem->getElement(j-1,i-1,val,b) && val != dummy)
- {
- mean += val;
- npixels ++;
- }
- if ((i>0) && decMem->getElement(j,i-1,val,b) && val != dummy)
- {
- mean += val;
- npixels ++;
- }
- if ((i>0) && (j<ncols-1) && decMem->getElement(j+1,i-1,val,b) && val != dummy)
- {
- mean += val;
- npixels ++;
- }
-
- if ((j>0) && decMem->getElement(j-1,i,val,b) && val != dummy)
- {
- mean += val;
- npixels ++;
- }
- if (decMem->getElement(j,i,val,b) && val != dummy)
- {
- mean += val;
- npixels ++;
- }
- if ((j<ncols-1) && decMem->getElement(j+1,i,val,b) && val != dummy)
- {
- mean += val;
- npixels ++;
- }
-
- if ((j>0) && (i<nlines-1) && decMem->getElement(j-1,i+1,val) && val != dummy)
- {
- mean += val;
- npixels ++;
- }
- if ((i<nlines-1) && decMem->getElement(j,i+1,val,b) && val != dummy)
- {
- mean += val;
- npixels ++;
- }
- if ((j<ncols-1) && (i<nlines-1) && decMem->getElement(j+1,i+1,val,b) && val != dummy)
- {
- mean += val;
- npixels ++;
- }
- if (npixels)
- {
- mean = mean/npixels;
- pages[b]->setVal(c,l,decMem->params().ncols_,mean);
- }
- c++;
- }
- l++;
- }
- }
-}
-
-
-/*
-This routine builds a multi-resolution pyramid with nLevels in a raster representation.
-The raster representation should be a raster stored in a TerraLib database.
-The raster representation should have been built in blocks with width and height power of 2.
-*/
-bool TeBuildMultiResolutionPyramid(TeRaster* rst, int nLevels)
-{
- if (!rst)
- return false;
- if (nLevels <= 1)
- return false;
- if (rst->params().decoderIdentifier_ != "DB")
- return false;
- int bw = rst->params().blockWidth_;
- int bh = rst->params().blockHeight_;
-
- /* check to see if bw and bh are power of 2 */
- if (bw == 0 || bh == 0 ||
- (bw & (bw - 1)) != 0 || (bh & (bh - 1)) != 0)
- {
- return false;
- }
-
- TeBox rstBB = rst->params().boundingBox();
-
- // build a vector of pages in memory
- vector<TeMemoryPage*> pages;
- int b;
- for (b=0; b<rst->params().nBands(); ++b)
- {
- TeMemoryPage* block = new TeMemoryPage(bh*bw,
- rst->params().dummy_[b],
- rst->params().dataType_[b]);
- block->ulCol_ = 0;
- block->ulLin_ = 0;
- pages.push_back(block);
- }
-
- // auxiliary variables
- int ulCol,
- ulLin,
- band,
- res,
- subb,
- ulColStart,
- ulLinStart;
-
- // parameters of a upper level
- TeRasterParams parUp = rst->params();
- parUp.mode_ = 'w';
-
- // a decoder im memory for the lower level blocks
- TeDecoderMemory* decMem = new TeDecoderMemory();
-
- // a decoder database for the upper level of the pyramid
- TeDecoderDatabase* decDBUpperLevel = new TeDecoderDatabase(parUp);
-
- // more auxiliary variables
- int pxBUp=-1, pyBUp=-1;
- int xBUp, yBUp;
- int bUlx, bUly;
-
- bool flag = true;
- string bid;
- char baux[60];
-
- TeRasterParams parBlock;
- int r = 2;
- for (int nl=0; nl<nLevels; ++nl)
- {
- // select all the blocks from lower level
- if (!rst->selectBlocks(rstBB,r/2,parBlock) )
- {
- delete decMem;
- delete decDBUpperLevel;
- return false;
- }
-
- decMem->updateParams(parBlock);
- decMem->init();
- parUp.boundingBoxResolution(rstBB.x1_, rstBB.y1_, rstBB.x2_, rstBB.y2_,
- rst->params().resx_*r,rst->params().resy_*r,
- TeBox::TeLOWERLEFT);
- parUp.resolution_ = r;
- decDBUpperLevel->updateParams(parUp);
-
- pxBUp=-1;
- pyBUp=-1;
- // for each block of the lower level
- do
- {
- // retrieve the lower level block
- flag = rst->fetchRasterBlock(decMem);
- TeRasterParams& par = decMem->params();
-
- // get the coordinate of the lower level block upper left corner
- TeBox blockBox = par.boundingBox();
- TeCoord2D auxC(blockBox.x1_+4*par.resx_,blockBox.y2_-4*par.resy_);
- TeCoord2D ij = parUp.coord2Index(auxC);
- ulColStart = TeRoundRasterIndex(ij.x_);
- ulLinStart = TeRoundRasterIndex(ij.y_);
-
- // find the correspondent upper level block that contains the coordinate
- bid = decDBUpperLevel->codifyId(ulColStart,ulLinStart,0,r,0);
- sscanf(bid.c_str(),"X%dY%d",&xBUp,&yBUp);
- decDBUpperLevel->decodifyId(bid,bUlx,bUly,band,res,subb);
-
- // check to which quadrant in the upper level block the lower level block fits
- if (ulColStart >= (bUlx+bw/2))
- ulColStart = bUlx+bw/2;
- else
- ulColStart = bUlx;
-
- if (ulLinStart >= (bUly+bh/2))
- ulLinStart = bUly+bh/2;
- else
- ulLinStart = bUly;
-
- // check if the upper level block is in already in memory
- if (pxBUp != xBUp || pyBUp != yBUp)
- {
- for (b=0; b<rst->params().nBands(); ++b)
- {
- // if it is not the first blocks do the swapping from memory to db
- if (pxBUp >= 0 && pyBUp >= 0)
- {
- // save blocks from memory
- sprintf(baux,"X%dY%dB%dR%dS0",pxBUp, pyBUp,b,r);
- decDBUpperLevel->putRasterBlock(baux,pages[b]->data_, parUp.blockHeight_*parUp.blockWidth_);
- }
- // get the needed one
- pages[b]->clear();
- sprintf(baux,"X%dY%dB%dR%dS0",xBUp,yBUp,b,r);
- decDBUpperLevel->getRasterBlock(baux,pages[b]->data_);
- TeBlockIndex index;
- index.band_ = b;
- index.col_ = xBUp;
- index.lin_ = yBUp;
- decDBUpperLevel->blockIndexPos(index,ulCol,ulLin,b);
- pages[b]->ulLin_ = ulLin;
- pages[b]->ulCol_ = ulCol;
- }
- // keep track of the blocks in memory
- pxBUp = xBUp;
- pyBUp = yBUp;
- }
- // write lower level block into upper level block using a 3x3 smoothing window (mean)
- TeCalculateMean(decMem,pages,ulColStart,ulLinStart);
-
- }while (flag);
-
- // save the last blocks in memory
- for (b=0; b<rst->params().nBands(); ++b)
- {
- sprintf(baux,"X%dY%dB%dR%dS0",xBUp,yBUp,b,r);
- decDBUpperLevel->putRasterBlock(baux,pages[b]->data_, parUp.blockHeight_*parUp.blockWidth_);
- }
- // reset level selection
- rst->clearBlockSelection();
- decMem->resetMemory();
- r *= 2;
- }
- delete decMem;
- delete decDBUpperLevel;
- for (b=0; b<rst->params().nBands(); ++b)
- delete pages[b];
- return true;
-}
diff --git a/src/terralib/kernel/TeImportRaster.h b/src/terralib/kernel/TeImportRaster.h
deleted file mode 100644
index 73dfdb9..0000000
--- a/src/terralib/kernel/TeImportRaster.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeImportRaster.h
- \brief This file contains functions to support importing of raster data into a TerraLib database
-*/
-#ifndef __TERRALIB_INTERNAL_IMPORTRASTER_H
-#define __TERRALIB_INTERNAL_IMPORTRASTER_H
-
-#include "TeDataTypes.h"
-#include "TeRasterParams.h"
-
-#include <string>
-using namespace std;
-
-class TeLayer;
-class TeRaster;
-/** @defgroup RasterFunctions Functions to deal with raster data
- * @{
-*/
-//! Imports a TeRaster object to a database creationg a new TeLayer
-/*!
- This function imports a raster to the database, generating a new layer.
- \param layerName name of the layer to be created
- \param rasterIn a pointer to the raster representation to be imported
- \param database a pointer to the database where the raster will be imported
- \returns a pointer to the generated layer
-*/
-TL_DLL TeLayer* TeImportRaster (const string& layerName, TeRaster* rasterIn, TeDatabase* database);
-
-//! Imports a TeRaster object to a TeLayer
-/*!
- This function imports a raster as a geometry of an object of a layer.
- \param layer pointer to a layer already created
- \param rasterIn a raster representation
- \param bWidth width of the blocks used to store the raster
- \param bHeight height of the blocks used to store the raster
- \param compress compression type
- \param objectId object identification associated to this raster
- \param dummy value to be used as a no data value when importing
- \param useDummy flag used to indicate that imported raster will have a dummy value
- \param indext type of tiling used to import raster
- \returns true or false whether the raster was imported successfully
-*/
-TL_DLL bool TeImportRaster (TeLayer* layer, TeRaster* rasterIn, unsigned int bWidth=512, unsigned int bHeight=512,
- TeRasterParams::TeRasterCompressionMode compress = TeRasterParams::TeNoCompression,
- const string& objectId="", double dummy=255,bool useDummy = false,
- TeRasterParams::TeRasterTilingType indext=TeRasterParams::TeNoExpansible);
-
-//! This function mosaics an input raster to one previsously existing in a TerraLib layer
-/*!
- \param rasterIn a raster representation
- \param layer pointer to an existing layer
- \param objectId object identification associated to this raster
- \returns true or false whether the mosaic operation was successfull
-*/
-TL_DLL bool TeMosaicRaster(TeRaster* rasterIn, TeLayer* layer, const string& objectId="");
-
-//! Builds a degraded resolution of a raster data
-/*!
- \param layer pointer to a layer already created
- \param rasterIn a raster representation
- \param resFac value to multiply the original resolution
- \param objectId object identification associated to this raster
- \returns true or false whether the raster was imported successfully
-*/
-TL_DLL bool TeBuildLowerResolution(TeLayer* layer, TeRaster* rasterIn, int resFac, const string& objectId="");
-
-//! Builds the multi resolution pyramid for a given raster
-TL_DLL bool TeBuildMultiResolutionPyramid(TeRaster* rst, int nLevels);
-/** @} */
-
-/** \example importJPEG.cpp
- Shows how to import a JPEG file
- */
-
-/** \example importGridData.cpp
- Shows how a raster data: a binary raw grid data
- */
-
-/** \example mosaciTIFFImages.cpp
- * This is an example of how to build a mosaic of images as a layer in a TerraLib database
- */
-
-#endif
-
diff --git a/src/terralib/kernel/TeInitRasterDecoders.cpp b/src/terralib/kernel/TeInitRasterDecoders.cpp
deleted file mode 100644
index 197e29e..0000000
--- a/src/terralib/kernel/TeInitRasterDecoders.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeInitRasterDecoders.h"
-#include "TeDecoderMemoryMap.h"
-#include "TeDecoderMemory.h"
-#include "TeDecoderSmartMem.h"
-
-#define NO_TETIFF
-#define NO_TEJPEG
-
-#ifndef NO_TETIFF //FAMI
-#include "TeDecoderTIFF.h"
-#endif
-
-#ifndef NO_TEJPEG //FAMI
-#include "TeDecoderJPEG.h"
-#endif
-
-#include "TeDecoderDatabase.h"
-#include "TeDecoderFile.h"
-#include "TeDecoderSPR.h"
-#include "TeDecoderASCIIGrid.h"
-
-#include <map>
-
-void
-TeInitRasterDecoders()
-{
- static bool TeRasterDecoderFactoryInitalized__ = false;
-
- if (!TeRasterDecoderFactoryInitalized__)
- {
- TeRasterDecoderFactoryInitalized__ = true;
-
- static TeDecoderDatabaseFactory theDecoderDatabaseFactory("DB");
-
- static TeDecoderMemoryFactory theDecoderMemoryFactory("MEM");
-
- static TeDecoderSmartMemFactory teDecoderSmartMemFactory("SMARTMEM");
-
- static TeDecoderMemoryMapFactory theDecoderMemoryMapFactory("MEMMAP");
-
-#ifndef NO_TETIFF //FAMI
- static TeDecoderTIFFFactory theDecoderTIFFFactory("TIF");
-#endif
-
- static TeDecoderSPRFactory theDecoderSPRFactory("SPR");
-
- static TeDecoderASCIIGridFactory theDecoderASCIIGridFactory("ASCIIGRID");
-
-#ifndef NO_TEJPEG //FAMI
- static TeDecoderJPEGFactory theDecoderJPEGFactory("JPEG");
-#endif
-
-#ifdef WIN32
- static TeDecoderFileFactory theDecoderFileFactory("RAW");
-#endif
- }
-}
diff --git a/src/terralib/kernel/TeInitRasterDecoders.h b/src/terralib/kernel/TeInitRasterDecoders.h
deleted file mode 100644
index 4ada2ab..0000000
--- a/src/terralib/kernel/TeInitRasterDecoders.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeInitRasterDecoders.h
- \brief This file contains functions to deal with the initialization of raster decoding tool
-*/
-#ifndef TeInitRasterDecoders_H
-#define TeInitRasterDecoders_H
-
-#include "TeDefines.h"
-
-//! Initializes the system of decoding raster data by using the basic decoders provided by TerraLib
-/*!
- \sa TeRaster TeDecoder TeRasterParams
-*/
-TL_DLL void TeInitRasterDecoders();
-#endif
-
diff --git a/src/terralib/kernel/TeIntersector.cpp b/src/terralib/kernel/TeIntersector.cpp
deleted file mode 100644
index da42877..0000000
--- a/src/terralib/kernel/TeIntersector.cpp
+++ /dev/null
@@ -1,1056 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeIntersector.h"
-#include "TeRTree.h"
-#include "TeGeometryAlgorithms.h"
-#include <map>
-
-using namespace std;
-
-short TeINTERSECTOR2::TeCCW(const TeCoord2D& c1, const TeCoord2D& c2, const TeCoord2D& c3, bool& between)
-{
- double dx1 = c2.x() - c1.x();
- double dx2 = c3.x() - c1.x();
- double dy1 = c2.y() - c1.y();
- double dy2 = c3.y() - c1.y();
-
- double dx1y2 = dx1 * dy2;
- double dy1x2 = dy1 * dx2;
-
- double coef = fabs(dx1y2 - dy1x2);
-
- if(coef == 0.0)
- {
- // check if c3 is between c1 and c2
- TeBox b;
- b.x1_ = MIN(c1.x(), c2.x());
- b.y1_ = MIN(c1.y(), c2.y());
- b.x2_ = MAX(c1.x(), c2.x());
- b.y2_ = MAX(c1.y(), c2.y());
-
- if(::TeIntersects(c3, b))
- between = true;
-
- return TeNOTURN;
- }
- else
- {
- TeCoord2D pinter;
- double dist = TePerpendicularDistance(c1, c2, c3, pinter);
-
- if(dist <= TePrecision::instance().precision())
- {
- // check if c3 is between c1 and c2
- TeBox b;
- b.x1_ = MIN(c1.x(), c2.x());
- b.y1_ = MIN(c1.y(), c2.y());
- b.x2_ = MAX(c1.x(), c2.x());
- b.y2_ = MAX(c1.y(), c2.y());
-
- if(::TeIntersects(c3, b))
- between = true;
-
- return TeNOTURN;
- }
- else
- {
- if(dx1y2 > dy1x2)
- {
- return TeCOUNTERCLOCKWISE;
- }
- else
- {
- return TeCLOCKWISE;
- }
- }
- }
-}
-
-bool TeINTERSECTOR2::TeIntersection(const TeCoord2D& a, const TeCoord2D& b, const TeCoord2D& c, const TeCoord2D& d, TeBoundaryIP& ips, TeSegmentIntersectionType& intersectionType)
-{
- if(TeEquals(a, b))
- return false;
-
- if(TeEquals(c, d))
- return false;
-
- double xmin1 = MIN(a.x(), b.x());
- double ymin1 = MIN(a.y(), b.y());
- double xmax1 = MAX(a.x(), b.x());
- double ymax1 = MAX(a.y(), b.y());
- TeBox b1(xmin1, ymin1, xmax1, ymax1);
-
- double xmin2 = MIN(c.x(), d.x());
- double ymin2 = MIN(c.y(), d.y());
- double xmax2 = MAX(c.x(), d.x());
- double ymax2 = MAX(c.y(), d.y());
- TeBox b2(xmin2, ymin2, xmax2, ymax2);
-
- if(::TeIntersects(b1, b2))
- {
- if((TeEquals(a, c) || TeEquals(a, d)) && (TeEquals(b, c) || TeEquals(b, d)))
- {
- intersectionType = TeImproperIntersection;
-
- ips.coords_.push_back(c);
- ips.coords_.push_back(d);
-
- return true;
- }
-
- bool between1 = false;
- short sign1 = TeINTERSECTOR2::TeCCW(a, b, c, between1);
-
- bool between2 = false;
- short sign2 = TeINTERSECTOR2::TeCCW(a, b, d, between2);
-
- bool between3 = false;
- short sign3 = TeINTERSECTOR2::TeCCW(c, d, a, between3);
-
- bool between4 = false;
- short sign4 = TeINTERSECTOR2::TeCCW(c, d, b, between4);
-
- if(((sign1 * sign2) <= 0) && ((sign3 * sign4) <= 0)) // if there is an intersection
- {
- intersectionType = TeProperIntersection;
-
- if(between1)
- {
- intersectionType = TeImproperIntersection;
- ips.coords_.push_back(c);
- }
-
- if(between2)
- {
- intersectionType = TeImproperIntersection;
- ips.coords_.push_back(d);
- }
-
- if(between3 && !TeEquals(a, c) && !TeEquals(a, d))
- {
- intersectionType = TeImproperIntersection;
-
- if(ips.coords_.size() == 2)
- return true;
-
- if(ips.coords_.size() == 1)
- {
- if(TeEquals(ips.coords_[0], a))
- return true;
- }
-
- ips.coords_.push_back(a);
- }
-
- if(between4 && !TeEquals(b, c) && !TeEquals(b, d))
- {
- intersectionType = TeImproperIntersection;
-
- if(ips.coords_.size() == 2)
- return true;
-
- if(ips.coords_.size() == 1)
- {
- if(TeEquals(ips.coords_[0], b))
- return true;
- }
-
- ips.coords_.push_back(b);
- }
-
- if(intersectionType == TeImproperIntersection)
- return true;
-
- double denominator = (d.y() - c.y()) * (b.x() - a.x()) - (d.x() - c.x()) * (b.y() - a.y());
-
- if(denominator == 0.0) // parallel can not occur here any more! I expect this is true!
- return false;
-
- // parameters
- double Ua = ((d.x() - c.x()) * (a.y() - c.y()) - (d.y() - c.y()) * (a.x() - c.x())) / denominator;
- //double Ub = ((b.x() - a.x()) * (a.y() - c.y()) - (b.y() - a.y()) * (a.x() - c.x())) / denominator;
-
- TeCoord2D caux(a.x() + Ua * (b.x() - a.x()), a.y() + Ua * (b.y() - a.y()));
-
- if(TeEquals(caux, a))
- {
- ips.coords_.push_back(a);
- return true;
- }
-
- if(TeEquals(caux, b))
- {
- ips.coords_.push_back(b);
- return true;
- }
-
- if(TeEquals(caux, c))
- {
- ips.coords_.push_back(c);
- return true;
- }
-
- if(TeEquals(caux, d))
- {
- ips.coords_.push_back(d);
- return true;
- }
-
- ips.coords_.push_back(caux);
-
- return true;
- }
- }
-
- intersectionType = TeImproperIntersection;
-
- return false;
-}
-
-bool TeINTERSECTOR2::TeIntersects(const TeCoord2D& a, const TeCoord2D& b, const TeCoord2D& c, const TeCoord2D& d, TeSegmentIntersectionType& intersectionType)
-{
- if(TeEquals(a, b))
- return false;
-
- if(TeEquals(c, d))
- return false;
-
- double xmin1 = MIN(a.x(), b.x());
- double ymin1 = MIN(a.y(), b.y());
- double xmax1 = MAX(a.x(), b.x());
- double ymax1 = MAX(a.y(), b.y());
- TeBox b1(xmin1, ymin1, xmax1, ymax1);
-
- double xmin2 = MIN(c.x(), d.x());
- double ymin2 = MIN(c.y(), d.y());
- double xmax2 = MAX(c.x(), d.x());
- double ymax2 = MAX(c.y(), d.y());
- TeBox b2(xmin2, ymin2, xmax2, ymax2);
-
- if(::TeIntersects(b1, b2))
- {
- if((TeEquals(a, c) || TeEquals(a, d)) && (TeEquals(b, c) || TeEquals(b, d)))
- {
- intersectionType = TeImproperIntersection;
-
- return true;
- }
-
- bool between1 = false;
- short sign1 = TeINTERSECTOR2::TeCCW(a, b, c, between1);
-
- bool between2 = false;
- short sign2 = TeINTERSECTOR2::TeCCW(a, b, d, between2);
-
- bool between3 = false;
- short sign3 = TeINTERSECTOR2::TeCCW(c, d, a, between3);
-
- bool between4 = false;
- short sign4 = TeINTERSECTOR2::TeCCW(c, d, b, between4);
-
- if((sign1 * sign2) <= 0 && (sign3 * sign4 <= 0)) // if there is an intersection
- {
- intersectionType = TeProperIntersection;
-
- if(between1 || between2 || between3 || between4)
- {
- intersectionType = TeImproperIntersection;
- }
-
- return true;
- }
- }
-
- return false;
-}
-
-bool TeINTERSECTOR2::TeIntersects(const TeLine2D& redLine, const TeLine2D& blueLine)
-{
- if(redLine.size() < 2 || blueLine.size() < 2)
- return false;
-
- if(TeDisjoint(redLine.box(), blueLine.box()))
- return false;
-
- unsigned int i = 0;
- unsigned int j = 0;
-
- TeBox interBox;
-
- // Creates a intersection box from lines boxes.
- ::TeIntersection(redLine.box(), blueLine.box(), interBox);
-
- unsigned int nstep_redLine = redLine.size() - 1;
- unsigned int nstep_blueLine = blueLine.size() - 1;
-
- TeSegmentIntersectionType t = TeImproperIntersection;
-
- for(i = 0; i < nstep_redLine; ++i)
- {
- // Creates the segment box.
- TeBox red_box = makeBox(redLine[i].x(), redLine[i].y(), redLine[i+1].x(), redLine[i+1].y());
-
- // See if red segment box intersects with the intersection box.
- if(TeDisjoint(interBox, red_box))
- continue; // If it doesn't intersect, go to another segment => skip comparasion beteween other "m" segments.
-
- for(j = 0; j < nstep_blueLine; ++j)
- {
- // Check intersection.
- if(TeINTERSECTOR2::TeIntersects(redLine[i], redLine[i+1], blueLine[j], blueLine[j+1], t))
- return true;
- }
- }
-
- return false;
-}
-
-bool TeINTERSECTOR2::TeSafeIntersections(const TeLine2D& redLine, const TeLine2D& blueLine, TeVectorBoundaryIP& report, const unsigned int& redObjId, const unsigned int& blueObjId)
-{
- if(redLine.size() < 2 || blueLine.size() < 2)
- return false;
-
- if(TeDisjoint(redLine.box(), blueLine.box()))
- return false;
-
- unsigned int i = 0;
- unsigned int j = 0;
-
- TeBox interBox;
-
- bool hasIntersections = false;
-
- // Creates a intersection box from lines boxes.
- ::TeIntersection(redLine.box(), blueLine.box(), interBox);
-
- unsigned int nstep_redLine = redLine.size() - 1;
- unsigned int nstep_blueLine = blueLine.size() - 1;
-
- TeSegmentIntersectionType t = TeImproperIntersection;
-
- for(i = 0; i < nstep_redLine; ++i)
- {
- // Creates the segment box.
- TeBox red_box = makeBox(redLine[i].x_, redLine[i].y_, redLine[i+1].x_, redLine[i+1].y_);
-
- // See if red segment box intersects with the intersection box.
- if(TeDisjoint(interBox, red_box))
- continue; // If it doesn't intersect, go to another segment => skip comparasion beteween other "m" segments.
-
- for(j = 0; j < nstep_blueLine; ++j)
- {
- // Check intersection.
- TeBoundaryIP ip;
-
- if(TeIntersection(redLine[i], redLine[i+1], blueLine[j], blueLine[j+1], ip, t))
- {
- hasIntersections = true;
-
- ip.redPartNum_ = redObjId;
- ip.redSegNum_ = i;
- ip.bluePartNum_ = blueObjId;
- ip.blueSegNum_ = j;
-
- if(ip.coords_.size() == 2) //overlap
- {
- // Verificar se os pontos est�o em ordem crescente
- if(ip.coords_[0].x_ < ip.coords_[1].x_)
- {
- report.push_back(ip);
- }
- else if(ip.coords_[0].x_ > ip.coords_[1].x_)
- {
- swap(ip.coords_[0], ip.coords_[1]);
- report.push_back(ip);
- }
- else if(ip.coords_[0].y_ < ip.coords_[1].y_)
- {
- report.push_back(ip);
- }
- else
- {
- swap(ip.coords_[0], ip.coords_[1]);
-
- report.push_back(ip);
- }
-
- }
- else
- {
- report.push_back(ip);
- }
- }
- }
- }
-
- return hasIntersections;
-}
-
-bool TeINTERSECTOR2::TeSafeIntersections(const TePolygonSet& redPols, const TePolygonSet& bluePols, TeVectorBoundaryIP& report)
-{
- unsigned int redPart = 0;
- unsigned int redPolsSize = redPols.size();
-
- unsigned int i, k;
- register unsigned int j, l;
-
- // Loops through red polygons
- for(i = 0; i < redPolsSize; ++i)
- {
- TePolygon redPol = redPols[i];
- unsigned int redPolSize = redPol.size();
-
- // Loops through red polygons rings
- for(j = 0; j < redPolSize; ++j)
- {
- TeLinearRing redRing = redPol[j];
-
- // Loops through blue polygons
- unsigned int bluePart = 0;
- unsigned int bluePolsSize = bluePols.size();
-
- for(k = 0; k < bluePolsSize; ++k)
- {
- // Loops through blue polygons rings
- TePolygon bluePol = bluePols[k];
-
- unsigned int bluePolSize = bluePol.size();
-
- for(l = 0; l < bluePolSize; ++l)
- {
- TeLinearRing blueRing = bluePol[l];
-
- TeSafeIntersections(redRing, blueRing, report, redPart, bluePart);
-
- ++bluePart;
- }
- }
-
- ++redPart;
- }
- }
-
- return !report.empty();
-}
-
-// Put polygon set segments into the index
-void TeINTERSECTOR2::TeIndexPolygonSet(const TePolygonSet& polygons, TeINTERSECTOR2::TeSegmentRTree& tree)
-{
- unsigned int nPols = polygons.size();
- unsigned int i, j, k;
-
- for(i = 0; i < nPols; ++i)
- {
- unsigned int nRings = polygons[i].size();
-
- for(j = 0; j < nRings; ++j)
- {
- unsigned int nSegs = polygons[i][j].size() - 1;
-
- for(k = 0; k < nSegs; ++k)
- {
- TeBox b;
-
- b.x1_ = MIN(polygons[i][j][k].x(), polygons[i][j][k + 1].x());
- b.y1_ = MIN(polygons[i][j][k].y(), polygons[i][j][k + 1].y());
- b.x2_ = MAX(polygons[i][j][k].x(), polygons[i][j][k + 1].x());
- b.y2_ = MAX(polygons[i][j][k].y(), polygons[i][j][k + 1].y());
-
- TeINTERSECTOR2::TeSegIdInPolygonSet sid;
-
- sid.polId_ = i;
- sid.lineId_ = j;
- sid.segId_ = k;
-
- tree.insert(b, sid);
- }
- }
- }
-
- return;
-}
-
-// Estrutura auxiliar para indexar cada um dos pontos de intersecao em um multimap
-struct TeIntersectionIndexKey
-{
- unsigned int segNum_;
- unsigned int partNum_;
- unsigned int polNum_;
-
- TeIntersectionIndexKey()
- : segNum_(0), partNum_(0), polNum_(0)
- {
- }
-
- TeIntersectionIndexKey(const unsigned int& segNum, const unsigned int& partNum, const unsigned int& polNum)
- : segNum_(segNum), partNum_(partNum), polNum_(polNum)
- {
- }
-
- bool operator<(const TeIntersectionIndexKey& rhs) const
- {
- if(polNum_ < rhs.polNum_)
- return true;
-
- if(polNum_ > rhs.polNum_)
- return false;
-
- if(partNum_ < rhs.partNum_)
- return true;
-
- if(partNum_ > rhs.partNum_)
- return false;
-
- if(segNum_ < rhs.segNum_)
- return true;
-
- if(segNum_ > rhs.segNum_)
- return false;
-
- return false;
- }
-};
-
-
-typedef multimap<TeIntersectionIndexKey, unsigned int> TeIntersectionIndex;
-
-// Dado um ponto de intersecao, faz a normalizacao do mesmo: procura um ponto correlato na lista de intersecao e tenta usar as mesmas coordenadas
-void TeNormalizeIntersection(TeINTERSECTOR2::TeBoundaryIP& ip, TeINTERSECTOR2::TeVectorBoundaryIP& report, TeIntersectionIndex& interIndex)
-{
- TeIntersectionIndexKey key(ip.blueSegNum_, ip.bluePartNum_, ip.bluePolNum_);
-
- pair<TeIntersectionIndex::iterator, TeIntersectionIndex::iterator> its = interIndex.equal_range(key);
-
-// bool eraseOwn = false;
-
- while(its.first != its.second)
- {
-// se achamos um indice, vamos verificar se ele possui um ponto de intersecao que seja igual ao que temos em maos, segundo a tolerancia
- unsigned int position = its.first->second;
-
- if(TeEquals(report[position].coords_[0], ip.coords_[0]))
- {
- ip.coords_[0] = report[position].coords_[0];
- }
-
- if(ip.coords_.size() == 2 && report[position].coords_.size() == 1)
- {
- if(TeEquals(report[position].coords_[0], ip.coords_[1]))
- ip.coords_[1] = report[position].coords_[0];
- }
-
- if(ip.coords_.size() == 1 && report[position].coords_.size() == 2)
- {
- if(TeEquals(report[position].coords_[1], ip.coords_[0]))
- ip.coords_[0] = report[position].coords_[1];
-
- }
-
- if(ip.coords_.size() == 2 && report[position].coords_.size() == 2)
-
- {
- if(TeEquals(report[position].coords_[1], ip.coords_[1]))
- ip.coords_[1] = report[position].coords_[1];
-
- if(TeEquals(report[position].coords_[0], ip.coords_[1]))
- ip.coords_[1] = report[position].coords_[0];
-
-
- if(TeEquals(report[position].coords_[1], ip.coords_[0]))
- ip.coords_[0] = report[position].coords_[1];
- }
-
- ++its.first;
- }
-}
-
-// insere a informacao da intersecao no indice
-void TeIndexIntersection(TeINTERSECTOR2::TeBoundaryIP& ip, const unsigned int& redPos, const unsigned int& bluePos, TeIntersectionIndex& interIndex)
-{
- TeIntersectionIndexKey redkey(ip.redSegNum_, ip.redPartNum_, ip.redPolNum_);
- TeIntersectionIndexKey bluekey(ip.blueSegNum_, ip.bluePartNum_, ip.bluePolNum_);
-
- interIndex.insert(pair<TeIntersectionIndexKey, unsigned int>(redkey, redPos));
- interIndex.insert(pair<TeIntersectionIndexKey, unsigned int>(bluekey, bluePos));
-}
-
-// insere o ponto de intersecao na lista
-void TeInsertIntersection(TeINTERSECTOR2::TeBoundaryIP& ip, TeINTERSECTOR2::TeVectorBoundaryIP& report)
-{
- if(ip.coords_.size() == 2) //overlap
- {
-// put intersections in increase order of 'x'
- if(ip.coords_[0].x_ < ip.coords_[1].x_)
- {
- report.push_back(ip);
- }
- else if(ip.coords_[0].x_ > ip.coords_[1].x_)
- {
- swap(ip.coords_[0], ip.coords_[1]);
- report.push_back(ip);
- }
- else if(ip.coords_[0].y_ < ip.coords_[1].y_)
- {
- report.push_back(ip);
- }
- else
- {
- swap(ip.coords_[0], ip.coords_[1]);
- report.push_back(ip);
- }
- }
- else
- {
- report.push_back(ip);
- }
-}
-
-// Find intersection into two distinct sets: red and blue
-bool TeINTERSECTOR2::TeIntersection(const TePolygonSet& redPolygons, TeINTERSECTOR2::TeSegmentRTree& redTree, const TePolygonSet& bluePolygons, TeINTERSECTOR2::TeVectorBoundaryIP& report)
-{
-// if index is empty, so we index first
- if(redTree.isEmpty())
- TeINTERSECTOR2::TeIndexPolygonSet(redPolygons, redTree);
-
- TeIntersectionIndex interIndex;
-
- unsigned int nPols = bluePolygons.size();
-
- TeSegmentIntersectionType t = TeImproperIntersection;
-
- unsigned int i, j, k, l;
- for(i = 0; i < nPols; ++i)
- {
- unsigned int nRings = bluePolygons[i].size();
-
- for(j = 0; j < nRings; ++j)
- {
- unsigned int nSegs = bluePolygons[i][j].size() - 1;
-
-// for each blue segment, find the one's that can intersects it into the red index tree
- for(k = 0; k < nSegs; ++k)
- {
- TeBox b;
-
- b.x1_ = MIN(bluePolygons[i][j][k].x(), bluePolygons[i][j][k + 1].x());
- b.y1_ = MIN(bluePolygons[i][j][k].y(), bluePolygons[i][j][k + 1].y());
- b.x2_ = MAX(bluePolygons[i][j][k].x(), bluePolygons[i][j][k + 1].x());
- b.y2_ = MAX(bluePolygons[i][j][k].y(), bluePolygons[i][j][k + 1].y());
-
- vector<TeINTERSECTOR2::TeSegIdInPolygonSet> segs;
-
- redTree.search(b, segs);
-
- unsigned int nSegsInter = segs.size();
-
-// depois tentamos achar os pontos de intersecao
- for(l = 0; l < nSegsInter; ++l)
- {
- TeINTERSECTOR2::TeBoundaryIP ip1;
-
- if(TeINTERSECTOR2::TeIntersection(bluePolygons[i][j][k], bluePolygons[i][j][k + 1], redPolygons[segs[l].polId_][segs[l].lineId_][segs[l].segId_], redPolygons[segs[l].polId_][segs[l].lineId_][segs[l].segId_ + 1], ip1, t))
- {
- ip1.redPolNum_ = segs[l].polId_;
- ip1.redPartNum_ = segs[l].lineId_;
- ip1.redSegNum_ = segs[l].segId_;
-
- ip1.bluePolNum_ = i;
- ip1.bluePartNum_ = j;
- ip1.blueSegNum_ = k;
-
- // normaliza a intersecao: se achar um outro pontos na lista de intersecao semelhante, usaremos o semelhante!
- TeNormalizeIntersection(ip1, report, interIndex);
-
-
- TeINTERSECTOR2::TeBoundaryIP ip2; // objeto auxiliar
- ip2.redPolNum_ = i;
- ip2.redPartNum_ = j;
- ip2.redSegNum_ = k;
-
- ip2.bluePolNum_ = segs[l].polId_;
- ip2.bluePartNum_ = segs[l].lineId_;
- ip2.blueSegNum_ = segs[l].segId_;
-
- ip2.coords_ = ip1.coords_;
-
- TeNormalizeIntersection(ip2, report, interIndex);
-
- ip1.coords_ = ip2.coords_;
-
- TeInsertIntersection(ip1, report);
-
- TeIndexIntersection(ip1, report.size() - 1, report.size() - 1, interIndex);
- }
- }
- }
- }
- }
-
- return !report.empty();
-}
-
-bool TeINTERSECTOR2::TeIsSimple(const TePolygonSet& polygons, vector<TeINTERSECTOR2::TePairSegIdInPolygonSet>& selfIntersectionList)
-{
- bool hasSelfIntersection = false;
-
- TeSegmentIntersectionType t = TeImproperIntersection;
-
-// create index tree
- TeINTERSECTOR2::TeSegmentRTree tree(polygons.box());
-
-// loop through segments
- unsigned int nPols = polygons.size();
-
- unsigned int i, j, k, l;
-
- for(i = 0; i < nPols; ++i)
- {
- unsigned int nRings = polygons[i].size();
-
- for(j = 0; j < nRings; ++j)
- {
- unsigned int nSegs = polygons[i][j].size() - 1;
-
- for(k = 0; k < nSegs; ++k)
- {
- TeBox b;
-
- b.x1_ = MIN(polygons[i][j][k].x(), polygons[i][j][k + 1].x());
- b.y1_ = MIN(polygons[i][j][k].y(), polygons[i][j][k + 1].y());
- b.x2_ = MAX(polygons[i][j][k].x(), polygons[i][j][k + 1].x());
- b.y2_ = MAX(polygons[i][j][k].y(), polygons[i][j][k + 1].y());
-
- TeINTERSECTOR2::TeSegIdInPolygonSet sid;
-
- sid.polId_ = i;
- sid.lineId_ = j;
- sid.segId_ = k;
-
-// try to find filter segments that boxe intersects this segment
- vector<TeINTERSECTOR2::TeSegIdInPolygonSet> segs;
-
- tree.search(b, segs);
-
- unsigned int nSegsInter = segs.size();
-
-// if found, loops through segments to see if there are intersections
- for(l = 0; l < nSegsInter; ++l)
- {
- TeINTERSECTOR2::TeBoundaryIP ip;
-
- if(TeIntersection(polygons[i][j][k], polygons[i][j][k + 1], polygons[segs[l].polId_][segs[l].lineId_][segs[l].segId_], polygons[segs[l].polId_][segs[l].lineId_][segs[l].segId_ + 1], ip, t))
- {
-// if there is intersection, we have to cases:
- if(ip.coords_.size() == 2)
- {
-// first, the segment overlaps another: so this configures a selfintersection
- hasSelfIntersection = true;
-
- selfIntersectionList.push_back(TePairSegIdInPolygonSet(sid, segs[l]));
- }
- else
- {
-// second, the segment intersects in one point: so this may be a selft-intersection or may be a intersection between the posterior segment (already inserted) in this second, no worry it is right
- if((sid.polId_ != segs[l].polId_) || (sid.lineId_ != segs[l].lineId_))
- {
- hasSelfIntersection = true;
-
- selfIntersectionList.push_back(TePairSegIdInPolygonSet(sid, segs[l]));
- }
- else
- {
-// we must look if they are consecutives (remeber last an firt will have intersections)
- int auxSegId = (int)sid.segId_;
- int otherSegId = (int)(segs[l].segId_);
-
-// if it intersects the previous or the next, it's ok!
- if((auxSegId == (otherSegId + 1)) || (auxSegId == (otherSegId -1)))
- {
- continue;
- }
- else
- {
-// we need to see if it is not between last and first
- if(auxSegId == (int)(polygons[sid.polId_][sid.lineId_].size() - 2))
- {
-// ok, it is a consecutive intersection between last and first
- if(otherSegId == 0)
- continue;
- }
- else if(auxSegId == 0)
- {
-// ok, it is a consecutive intersection between first and last
- if(otherSegId == (int)(polygons[segs[l].polId_][segs[l].lineId_].size() - 2))
- continue;
- }
-
- hasSelfIntersection = true;
-
- selfIntersectionList.push_back(TePairSegIdInPolygonSet(sid, segs[l]));
- }
- }
- }
-
- }
- }
-
-// inserts the segment into the tree
- tree.insert(b, sid);
- }
- }
- }
-
- tree.clear();
-
- return !hasSelfIntersection;
-}
-
-// Find intersection into two distinct sets: red lines and blue polygons
-bool TeINTERSECTOR2::TeIntersection(const TeLineSet& redLines, const TePolygonSet& bluePolygons, TeSegmentRTree& blueTree, TeINTERSECTOR2::TeVectorBoundaryIP& report)
-{
-// if index is empty, so we index the segments from polygonset first
- if(blueTree.isEmpty())
- TeINTERSECTOR2::TeIndexPolygonSet(bluePolygons, blueTree);
-
-// for each lines we must compute intersections
- unsigned int nLines = redLines.size();
-
- TeSegmentIntersectionType t = TeImproperIntersection;
-
- unsigned int i, j, l;
-
- for(i = 0; i < nLines; ++i)
- {
- unsigned int nSegs = redLines[i].size() - 1;
-
- for(j = 0; j < nSegs; ++j)
- {
-// for each segment we compute intersections
- TeBox b;
-
- b.x1_ = MIN(redLines[i][j].x(), redLines[i][j + 1].x());
- b.y1_ = MIN(redLines[i][j].y(), redLines[i][j + 1].y());
- b.x2_ = MAX(redLines[i][j].x(), redLines[i][j + 1].x());
- b.y2_ = MAX(redLines[i][j].y(), redLines[i][j + 1].y());
-
- vector<TeINTERSECTOR2::TeSegIdInPolygonSet> segs;
-
- blueTree.search(b, segs);
-
- unsigned int nSegsInter = segs.size();
-
-// depois tentamos achar os pontos de intersecao
- for(l = 0; l < nSegsInter; ++l)
- {
- TeINTERSECTOR2::TeBoundaryIP ip1;
-
- if(TeINTERSECTOR2::TeIntersection(redLines[i][j], redLines[i][j + 1], bluePolygons[segs[l].polId_][segs[l].lineId_][segs[l].segId_], bluePolygons[segs[l].polId_][segs[l].lineId_][segs[l].segId_ + 1], ip1, t))
- {
- ip1.redPolNum_ = 0;
- ip1.redPartNum_ = i;
- ip1.redSegNum_ = j;
-
- ip1.bluePolNum_ = segs[l].polId_;
- ip1.bluePartNum_ = segs[l].lineId_;
- ip1.blueSegNum_ = segs[l].segId_;
-
- if(ip1.coords_.size() == 2) //overlap
- {
- // Verificar se os pontos estao em ordem crescente
- if(ip1.coords_[0].x_ < ip1.coords_[1].x_)
- {
- report.push_back(ip1);
- }
- else if(ip1.coords_[0].x_ > ip1.coords_[1].x_)
- {
- swap(ip1.coords_[0], ip1.coords_[1]);
- report.push_back(ip1);
- }
- else if(ip1.coords_[0].y_ < ip1.coords_[1].y_)
- {
- report.push_back(ip1);
- }
- else
- {
- swap(ip1.coords_[0], ip1.coords_[1]);
- report.push_back(ip1);
- }
- }
- else
- {
- report.push_back(ip1);
- }
- }
- }
- }
- }
-
- return !report.empty();
-}
-
-// Find intersection between segments into polygonset list
-bool TeINTERSECTOR2::TeIntersection(const TePolygonSet& polygons, TeINTERSECTOR2::TeSegmentRTree& tree, TeINTERSECTOR2::TeVectorBoundaryIP& report)
-{
-// clear tree before start process
- tree.clear();
-
- TeIntersectionIndex interIndex;
-
- unsigned int nPols = polygons.size();
-
- if(nPols == 0)
- return false;
-
- unsigned int nLines = polygons[0].size();
-
- unsigned int i, j, k, l;
-
-// the first polygon's segments are all indexed into the tree
- for(i = 0; i < nLines; ++i)
- {
- unsigned int nSegs = polygons[0][i].size() - 1;
-
- for(j = 0; j < nSegs; ++j)
- {
- TeBox b;
-
- b.x1_ = MIN(polygons[0][i][j].x(), polygons[0][i][j + 1].x());
- b.y1_ = MIN(polygons[0][i][j].y(), polygons[0][i][j + 1].y());
- b.x2_ = MAX(polygons[0][i][j].x(), polygons[0][i][j + 1].x());
- b.y2_ = MAX(polygons[0][i][j].y(), polygons[0][i][j + 1].y());
-
- TeINTERSECTOR2::TeSegIdInPolygonSet sid;
-
- sid.polId_ = 0;
- sid.lineId_ = i;
- sid.segId_ = j;
-
- tree.insert(b, sid);
- }
- }
-
- TeSegmentIntersectionType t = TeImproperIntersection;
-
-// for each polygon, we first test intersection of all segments and then put them into the index
- for(i = 1; i < nPols; ++i)
- {
- unsigned int nLines = polygons[i].size();
-
-// for each line of the polygon, verifies intersection against the segments into the index
- for(j = 0; j < nLines; ++j)
- {
- unsigned int nSegs = polygons[i][j].size() - 1;
-
- for(k = 0; k < nSegs; ++k)
- {
-// for each segment we find the one's that intersects its bounding box
- TeBox b;
-
- b.x1_ = MIN(polygons[i][j][k].x(), polygons[i][j][k + 1].x());
- b.y1_ = MIN(polygons[i][j][k].y(), polygons[i][j][k + 1].y());
- b.x2_ = MAX(polygons[i][j][k].x(), polygons[i][j][k + 1].x());
- b.y2_ = MAX(polygons[i][j][k].y(), polygons[i][j][k + 1].y());
-
- vector<TeINTERSECTOR2::TeSegIdInPolygonSet> segs;
-
- tree.search(b, segs);
-
- unsigned int nSegsInter = segs.size();
-
-// if there are candidates, try to find intersections
- for(l = 0; l < nSegsInter; ++l)
- {
- TeINTERSECTOR2::TeBoundaryIP ip1;
-
- TeINTERSECTOR2::TeBoundaryIP ip2;
-
- if(TeINTERSECTOR2::TeIntersection(polygons[i][j][k], polygons[i][j][k + 1], polygons[segs[l].polId_][segs[l].lineId_][segs[l].segId_], polygons[segs[l].polId_][segs[l].lineId_][segs[l].segId_ + 1], ip1, t))
- {
-// if the segment intersects a candidate, stores theirs intersection points
- ip1.redPolNum_ = i;
- ip1.redPartNum_ = j;
- ip1.redSegNum_ = k;
- ip1.bluePolNum_ = segs[l].polId_;
- ip1.bluePartNum_ = segs[l].lineId_;
- ip1.blueSegNum_ = segs[l].segId_;
-
- // normaliza a intersecao: se achar um outro pontos na lista de intersecao semelhante, usaremos o semelhante!
- TeNormalizeIntersection(ip1, report, interIndex);
-
- ip2.redPolNum_ = segs[l].polId_;
- ip2.redPartNum_ = segs[l].lineId_;
- ip2.redSegNum_ = segs[l].segId_;
-
- ip2.bluePolNum_ = i;
- ip2.bluePartNum_ = j;
- ip2.blueSegNum_ = k;
-
- ip2.coords_ = ip1.coords_;
-
- TeNormalizeIntersection(ip2, report, interIndex);
-
- ip1.coords_ = ip2.coords_;
-
-// insere os pontos de intersecao na lista de intersecao e no multi-map
- TeInsertIntersection(ip1, report);
- TeInsertIntersection(ip2, report);
-
- TeIndexIntersection(ip1, report.size() - 2, report.size() - 1, interIndex);
- }
- }
- }
- }
-
-// after the search for intersection, put segfments into index
- for(j = 0; j < nLines; ++j)
- {
- unsigned int nSegs = polygons[i][j].size() - 1;
-
- for(k = 0; k < nSegs; ++k)
- {
- TeBox b;
-
- b.x1_ = MIN(polygons[i][j][k].x(), polygons[i][j][k + 1].x());
- b.y1_ = MIN(polygons[i][j][k].y(), polygons[i][j][k + 1].y());
- b.x2_ = MAX(polygons[i][j][k].x(), polygons[i][j][k + 1].x());
- b.y2_ = MAX(polygons[i][j][k].y(), polygons[i][j][k + 1].y());
-
- TeSegIdInPolygonSet sid;
-
- sid.polId_ = i;
- sid.lineId_ = j;
- sid.segId_ = k;
-
- tree.insert(b, sid);
- }
- }
- }
-
- return !report.empty();
-}
-
diff --git a/src/terralib/kernel/TeIntersector.h b/src/terralib/kernel/TeIntersector.h
deleted file mode 100644
index cd2df83..0000000
--- a/src/terralib/kernel/TeIntersector.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeIntersector.h
- \brief This file contains structures and definitions for line intersection algorithms.
- \note These data structures and algorithms MUST BE USED ONLY BY TerraLib kernel and should NOT be used by anyone because
- THIS IS FOR INTERNAL USE ONLY.
- \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
-*/
-
-#ifndef __TERRALIB_INTERNAL_INTERSECTOR2_H
-#define __TERRALIB_INTERNAL_INTERSECTOR2_H
-
-//TerraLib's include
-#include "TeCoord2D.h"
-#include "TeRTree.h"
-
-//STL's include
-#include <vector>
-
-using namespace std;
-
-/*
- * WARNING: These data structures and algorithms MUST BE USED ONLY BY TerraLib kernel and should NOT be used by anyone because
- * the support and interfaces can be changed in future. THIS IS FOR INTERNAL USE ONLY.
- */
-
-/*! \brief Contains structures and definitions needed by line intersection algorithms (FOR INTERNAL USE ONLY).
-*/
-namespace TeINTERSECTOR2
-{
-//! An epsilon value used to compare two real numbers
-#define EPSILON_COMPARE 1.0e-15
-
-/** @defgroup IntersectionAlgorithms Intersection Algorithms
- * Intersection Algorithms and data structures, used internally.
- * @{
- */
-
-//! This struct is used to represent a point intersection between two segments on boundary of a TePolygon or TeLine2D.
-struct TL_DLL TeBoundaryIP
-{
- vector<TeCoord2D> coords_; //!< Points of intersection ocurried along these two segments (red and blue).
-
- unsigned int redSegNum_; //!< Red segment number.
- unsigned int redPartNum_; //!< Line number in a polygon that a red segment belongs.
- unsigned int redPolNum_; //!< Polygon number in a vector of polygons that a segment belongs.
-
- unsigned int blueSegNum_; //!< Blue segment number.
- unsigned int bluePartNum_; //!< Line number in a polygon that a blue segment belongs.
- unsigned int bluePolNum_; //!< Polygon number in a vector of polygons that a segment belongs.
-};
-
-//! This is the type of intersection point list.
-typedef vector<TeBoundaryIP> TeVectorBoundaryIP;
-
-//! This struct represents an index to the right place of a segment in a TeLineSet, TeLine2D, TePolygon or TePolygonSet.
-struct TL_DLL TeSegIdInPolygonSet
-{
- unsigned int polId_; //!< The polygon id, when used in a polygonset.
- unsigned int lineId_; //!< The line id, when used in a lineset or in a polygon.
- unsigned int segId_; //!< The segment id into a specified line.
-};
-
-//! This pair is used to index two segments that intersects.
-typedef pair<TeSegIdInPolygonSet, TeSegIdInPolygonSet> TePairSegIdInPolygonSet;
-
-//! This is the type used to index the segments in the boundary of a TeLine2D, TeLineSet, TePolygon or TePolygonSet.
-typedef TeSAM::TeRTree<TeSegIdInPolygonSet, 8> TeSegmentRTree;
-
-/** \brief Tells if three points makes a right turn, a left turn or are collinear.
- \param c1 The first coordinate.
- \param c2 The second coordinate.
- \param c3 The coordinate to test the relative position.
- \param between Tells if c3 is between c1 and c2.
- \return The orientation: TeCLOCKWISE, TeCOUNTERCLOCKWISE or TeNOTURN.
-*/
-TL_DLL short TeCCW(const TeCoord2D& c1, const TeCoord2D& c2, const TeCoord2D& c3, bool& between);
-
-/** \brief Returns the intersection point of the segments.
- \param a The first coordinate of the first segment.
- \param b The second coordinate of the first segment.
- \param c The first coordinate of the second segment.
- \param d The second coordinate of the second segment.
- \param ips The intersection coordinates (0, 1 or 2).
- \param intersectionType An intersection may be proper or improper.
- \return Returns true if there is an intersection between segments defined by end coordinates.
-*/
-TL_DLL bool TeIntersection(const TeCoord2D& a, const TeCoord2D& b, const TeCoord2D& c, const TeCoord2D& d, TeBoundaryIP& ips, TeSegmentIntersectionType& intersectionType);
-
-
-/** \brief Tells if two segments intersects.
- \param a The first coordinate of the first segment.
- \param b The second coordinate of the first segment.
- \param c The first coordinate of the second segment.
- \param d The second coordinate of the second segment.
- \param intersectionType An intersection may be proper or improper.
- \return Returns true if there is an intersection between segments defined by end coordinates.
-*/
-TL_DLL bool TeIntersects(const TeCoord2D& a, const TeCoord2D& b, const TeCoord2D& c, const TeCoord2D& d, TeSegmentIntersectionType& intersectionType);
-
-
-/** \brief Verifies if there is an intersection between two given polygonsets.
- \param redPols The first polygonset to test.
- \param bluePols The second polygonset to test.
- \param report A list with the intersection points.
- \return Returns true if there is an intersection between segments of the polygons.
-
- \note WARNING: this is deprecated and will be replaced by another function in near future.
-
- This is a lazy algorithm. It can be used, for example, in intersections between a box and a line.
- It is O(n*m) - where n and m are the numbers of segments in the first and second polygonsets.
- */
-TL_DLL bool TeSafeIntersections(const TePolygonSet& redPols, const TePolygonSet& bluePols, TeVectorBoundaryIP& report);
-
-/** \brief Verifies if there is an intersection between two given lines.
- \param redLine The first line to test.
- \param blueLine The second line to test.
- \param report A list with the intersection points.
- \param redObjId Red line object id.
- \param blueObjId Blue line object id.
- \return Returns true if there is an intersection between segments of the lines.
-
- \note WARNING: this is deprecated and will be replaced by another function in near future.
-
- This is a lazy algorithm. It can be used, for example, in intersections between a box and a line.
- It is O(n*m) - where n and m are the numbers of segments in the first and second lines.
- */
-TL_DLL bool TeSafeIntersections(const TeLine2D& redLine, const TeLine2D& blueLine, TeVectorBoundaryIP& report, const unsigned int& redObjId = 0, const unsigned int& blueObjId = 0);
-
-/** \brief Returns true if the lines intersects.
- \param redLine The line to test.
- \param blueLine The line to test.
- \return Returns true if there is an intersection between segments of the lines.
-
- \note WARNING: this is deprecated and will be replaced by another function in near future.
- */
-TL_DLL bool TeIntersects(const TeLine2D& redLine, const TeLine2D& blueLine);
-
-/** \brief Reports intersections between segments of polygons in the polygonset list.
- \param polygons A list of polygons to test self intersections.
- \param tree The tree with all index segments, it WILL BE filled inside this method.
- \param report A report list of intersection points.
- \return Returns true if there is an intersection.
-
- \note This function will not returns intersections between segments of the same polygon. It will only
- report intersection between different polygons. The index tree MUST BE EMPTY, othewise, the
- result is undefined. The result may have duplicated points because intersections are reported
- twice: this will turn fragmentation easier.
- */
-TL_DLL bool TeIntersection(const TePolygonSet& polygons, TeSegmentRTree& tree, TeVectorBoundaryIP& report);
-
-/** \brief Reports intersections between segments of two diferent polygonsets.
- \param redPolygons A list of polygons without self intersections.
- \param redTree A tree with all red segment already indexed or not, if it is empty, so, it will be filled inside this method.
- \param bluePolygons A list of polygons without self intersections.
- \param report A report list of intersection points.
- \return Returns true if there is an intersection between a red segment and a blue segment.
-
- \note This function will not returns intersections between segments of the same polygon. It will only
- report intersection between different polygons. The result may have duplicated points because intersections are reported
- twice: this will turn fragmentation easier.
- */
-TL_DLL bool TeIntersection(const TePolygonSet& redPolygons, TeSegmentRTree& redTree, const TePolygonSet& bluePolygons, TeINTERSECTOR2::TeVectorBoundaryIP& report);
-
-/** \brief Reports intersections between segments of a lineset and a polygonset.
- \param redLines A list of lines without self intersections.
- \param bluePolygons A list of polygons without self intersections.
- \param blueTree A tree with all segments from the polygonset already indexed or not, if it is empty, so, it will be filled inside this method.
- \param report A report list of intersection points.
- \return Returns true if there is an intersection between a red segment from the lineset and a blue segment from the polygonset.
-
- \note This function will not returns intersections between segments of the same polygon or lineset. It will only
- report intersection between segments from different sets.
- */
-TL_DLL bool TeIntersection(const TeLineSet& redLines, const TePolygonSet& bluePolygons, TeSegmentRTree& blueTree, TeINTERSECTOR2::TeVectorBoundaryIP& report);
-
-/** \brief Tells if there is a self-intersection between segments.
- \param polygons A list of polygons to test self intersections.
- \param selfIntersectionList A report list with all self-intersections.
- \return Returns true if there is not a self-intersection.
- */
-TL_DLL bool TeIsSimple(const TePolygonSet& polygons, vector<TePairSegIdInPolygonSet>& selfIntersectionList);
-
-/** \brief Index polygon's segments.
- \param polygons A list of polygons to index it segment's.
- \param tree The tree if indexed segments.
- */
-TL_DLL void TeIndexPolygonSet(const TePolygonSet& polygons, TeSegmentRTree& tree);
-
-/** @} */
-
-} // end namespace TeINTERSECTOR2
-#endif //__TERRALIB_INTERNAL_INTERSECTOR2_H
-
diff --git a/src/terralib/kernel/TeKdTree.h b/src/terralib/kernel/TeKdTree.h
deleted file mode 100644
index d615b63..0000000
--- a/src/terralib/kernel/TeKdTree.h
+++ /dev/null
@@ -1,1190 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeKdTree.h
- \brief This file contains an implementation of kdtree data structures in main memory for two dimensions.
- \note These data structures and algorithms MUST BE USED ONLY BY TerraLib kernel and should NOT be used by anyone because
- THIS IS FOR INTERNAL USE ONLY.
- \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
-*/
-
-#ifndef __TERRALIB_INTERNAL_KDTREE_H
-#define __TERRALIB_INTERNAL_KDTREE_H
-
-#include "TeGeometry.h"
-
-/**
- * WARNING: These data structures and algorithms MUST BE USED ONLY BY TerraLib kernel and should NOT be used by anyone because
- * the support and interfaces can be changed in future. THIS IS FOR INTERNAL USE ONLY.
- *
- */
-
-namespace TeSAM
-{
-/** @defgroup PartitionAlgorithms Partition Algorithms
- * Partition Algorithms.
- * @{
- */
-
-//! This function partition the conteiner in two parts: k-1 elements to the left (elements less than or equals to k-th element) and the right part with all other elements (elements greater than or equal to k-th element)
-/*
- \param A Conteiner of elements to partition
- \param kthElement Position of the k-th element, around the conteiner will be pertitionated
- \param firstElement Position of the first element
- \param lastElement Position of the las element
- \param compFunctor Functor to compare elements: implements the function "less than"
-
-*/
-template<class CONTAINER, class COMPFUNCTOR>
-void TeHoareFind(CONTAINER& A, const unsigned int& kthElement, const unsigned int& firstElement, const unsigned int& lastElement, const COMPFUNCTOR& compFunctor)
-{
- unsigned int m = firstElement;
- unsigned int n = lastElement;
-
-// Test if the median is in the bounds
- if((kthElement < firstElement) || (kthElement > lastElement))
- return;
-
-// Do conteiner partition
- while(m < n)
- {
- unsigned int i = m;
- unsigned int j = n;
-
- typename CONTAINER::value_type r = A[kthElement];
-
- while(i <= j)
- {
- while(compFunctor(A[i], r))
- ++i;
-
- while(compFunctor(r, A[j]))
- --j;
-
- if(i <= j)
- {
- typename CONTAINER::value_type w = A[i];
- A[i] = A[j];
- A[j] = w;
-
- ++i;
- --j;
- }
- }
-
- if(kthElement <= j) // if the meet point was to the right, so all points above j are greater than the k-th element
- n = j;
- else if(i <= kthElement) // otherwise, if the meeting point was to the left of k-th, so all elements before i are already in the correct location
- m = i;
- else
- break;
- }
-}
-
-//! Partition the conteiner like a bidimensional K-d Tree using Hoare algorithms
-/*
- \param dataSet Conteinet elements to be sorted like a K-dTree
- \param first Position of the first element in conteiner, where the sort will begin
- \param last Position of the last element, where the sort ends
- \param level Indicates the axis to begin the sort ('x' or 'y') and is used during the recursion process
- \param lessThanCompFunctorByX Functor to compare elements along the 'x' axis
- \param lessThanCompFunctorByY Functor to compare elements along the 'y' axis
-
- The expected complexity is O(N log N), where N is the number of elements in conteiner.
-*/
-template<class CONTAINER, class LESSTHANX, class LESSTHANY>
-void kdsort(CONTAINER& dataSet, const unsigned int& first, const unsigned int& last, const char& level, const LESSTHANX& lessThanCompFunctorByX, const LESSTHANY& lessThanCompFunctorByY)
-{
- const unsigned int kth = (last - first + 1u) / 2u;
-
- if(level == 'x')
- {
-// Move data around X axis
- TeHoareFind(dataSet, first + kth, first, last, lessThanCompFunctorByX);
-
-// Recursive sort the left half and right half
- if((first + kth) > first)
- kdsort(dataSet, first, first + kth - 1u, 'y', lessThanCompFunctorByX, lessThanCompFunctorByY);
-
- if((first + kth) < last)
- kdsort(dataSet, first + kth + 1u, last, 'y', lessThanCompFunctorByX, lessThanCompFunctorByY);
- }
- else
- {
-// Move data around Y axis
- TeHoareFind(dataSet, first + kth, first, last, lessThanCompFunctorByY);
-
-// Recursive sort the left half and right half
- if((first + kth) > first)
- kdsort(dataSet, first, first + kth - 1u, 'x', lessThanCompFunctorByX, lessThanCompFunctorByY);
-
- if((first + kth) < last)
- kdsort(dataSet, first + kth + 1u, last, 'x', lessThanCompFunctorByX, lessThanCompFunctorByY);
- }
-}
-/** @} */
-
-//! Kd-tree node type for nodes with single elements (used by template instantiation).
-struct TL_DLL kd_node_data_single_tag {};
-
-//! Kd-Tree node type for nodes with multuple elements (used by template instantiation).
-struct TL_DLL kd_node_data_set_tag {};
-
-
-//! Class that represents a node of a TeKdTree
-/*!
- Each node contains a pointer to its left and right subtree (NULL if it is not set),
- one key used for insertion of the data into the tree.
-
- WARNING: <BR>
-
- 1. The key must have methods called x() and y(). <BR>
-
- 2. These kind of node stores the data in each node. <BR>
-
- 3. The nodes may contains one single element (kd_node_data_single_tag) or a set of values (kd_node_data_set_tag). <BR>
-
- 4. If the node type is kd_node_data_single_tag than NodeData and NodeDataItem are the same types. And if
- one entry with the same key already exist, so they will be overwrite. <BR>
-
- 5. If the node type is kd_node_data_set_tag than NodeData mus have a method called push_back(NodeDataItem)
- that permits to store elements with the same key in the node. <BR>
- */
-template<class NodeKey, class NodeData, class NodeDataItem,
- class NodeDataTag = kd_node_data_single_tag>
-class TeKdTreeNode
-{
- protected:
-
- //! The key used to access this record
- NodeKey key_;
-
- //! The data stored in this record
- NodeData data_;
-
- //! Pointer to the left sub-tree.
- TeKdTreeNode* left_;
-
- //! Pointer to the right sub-tree.
- TeKdTreeNode* right_;
-
- public:
-
- //! Export key type.
- typedef NodeKey kdKey;
-
- //! Export data type.
- typedef NodeData kdData;
-
- //! Export data item type.
- typedef NodeDataItem kdDataItem;
-
- //! Export data type.
- typedef NodeDataTag kdDataTag;
-
- //! Constructor
- TeKdTreeNode(const NodeKey& k)
- : key_(k), left_(0), right_(0)
- {
- }
-
- //! Sets the key to the node
- void setKey(const NodeKey& k)
- {
- key_ = k;
- }
-
- //! Returns a reference to node key
- const NodeKey& getKey(void) const
- {
- return key_;
- }
-
- //! Sets the data in the node
- void setData(const NodeData& data)
- {
- data_ = data;
- }
-
- //! Returns a reference to data node
- NodeData& getData(void)
- {
- return data_;
- }
-
- //! Sets the left child pointer
- void setLeft(TeKdTreeNode* node)
- {
- left_ = node;
- }
-
- //! Sets the right child pointer
- void setRight(TeKdTreeNode* node)
- {
- right_ = node;
- }
-
- //! Accessor for left child
- TeKdTreeNode* getLeft(void) const
- {
- return left_;
- }
-
- //! Accessor for right child
- TeKdTreeNode* getRight(void) const
- {
- return right_;
- }
-
- //! Method to check if this has a left child
- bool hasLeft(void) const
- {
- return (left_ != 0);
- }
-
- //! Method to check if a this has a right child
- bool hasRight(void) const
- {
- return (right_ != 0);
- }
-
- //! Method to check if this has no children
- bool isLeaf(void) const
- {
- return !(hasLeft() || hasRight());
- }
-
- //! Method to count the number of nodes below this
- unsigned int descendants(void) const
- {
- unsigned int totalLeft = 0u;
- unsigned int totalRight = 0u;
-
- if(hasLeft())
- totalLeft = 1u + getLeft()->descendants();
-
- if(hasRight())
- totalRight = 1u + getRight()->descendants();
-
- return (totalLeft + totalRight);
- }
-
- private:
-
- //! No copy allowed
- TeKdTreeNode(const TeKdTreeNode& other);
-
- //! No copy allowed
- TeKdTreeNode& operator=(const TeKdTreeNode& other);
-
-}; // end of class TeKdTreeNode
-
-//! A base class for Kd-Tree structures
-/*!
- This class implements only common kdtree methods and properties.
- */
-template<class KdTreeNode>
-class TeBasicKdTree
-{
- protected:
-
- //! Pointer to the root node
- KdTreeNode* root_;
-
- //! Bounding box of all nodes
- TeBox mbr_;
-
- //! The size of the K-d Tree (number of nodes)
- unsigned int size_;
-
- public:
-
- //! Constructor
- TeBasicKdTree(const TeBox& mbr)
- : root_(0), mbr_(mbr), size_(0u)
- {
- }
-
- //! Destructor
- ~TeBasicKdTree()
- {
- clear();
- }
-
- //! Clear all tree nodes
- void clear(void)
- {
- if(root_)
- {
- erase(root_);
- root_ = 0;
- size_ = 0;
- }
- }
-
- //! The number of tree nodes
- const unsigned int& size(void) const
- {
- return size_;
- }
-
- //! Return true if the tree is empty
- bool isEmpty(void) const
- {
- return root_ == 0;
- }
-
- //! Sets the bounding box of all elements in the tree
- void setBox(const TeBox& mbr)
- {
- mbr_ = mbr;
- }
-
- //! Sets the bounding box of all elements in the tree
- const TeBox& getBox(void) const
- {
- return mbr_;
- }
-
- protected:
-
- //! Erases a node from the tree and all nodes below it.
- void erase(KdTreeNode* node)
- {
- if(node->hasLeft())
- erase(node->getLeft());
-
- if(node->hasRight())
- erase(node->getRight());
-
- delete node;
-
- return;
- }
-
- private:
-
- //! No copy allowed
- TeBasicKdTree(const TeBasicKdTree& other);
-
- //! No copy allowed
- TeBasicKdTree& operator=(const TeBasicKdTree& other);
-};
-
-
-//! A class that represents a two dimensional K-d Tree (2-d Tree)
-/*!
- WARNING:
-
- 1. This type of tree stores the data into nodes (not only in the leafs node).
-
- 2. This tree may be built by two ways: <BR>
- 2.1. Inserting each element in the tree. In this case the tree can becomes unbalanced, but in practical
- cases this is not the expected, and is the best way to construct the tree (faster way). <BR>
- 2.2. Passing a container with pairs (key/data-item) and using the method buildOptimized after
- calling kdsort. The tree built this way is almost balanced but will be
- construct in time O(N log N).<BR>
- WARNING: In this case items with the same key will be stores in different nodes!<BR>
-
- 3. This type of tree may be of special interest of BOX SEARCH QUERIES.
-
- 4. If the node type is kd_node_data_single_tag than NodeData and NodeDataItem are the same types. And if
- one entry with the same key already exist, so they will be overwrite.
-
- 5. If the node type is kd_node_data_set_tag than NodeData mus have a method called push_back(NodeDataItem)
- that permits to store elements with the same key in the node.
- */
-template<class KdTreeNode>
-class TeKdTree : public TeBasicKdTree<KdTreeNode>
-{
- using TeBasicKdTree<KdTreeNode>::root_;
- using TeBasicKdTree<KdTreeNode>::size_;
- using TeBasicKdTree<KdTreeNode>::mbr_;
-
- public:
-
- //! Export key type.
- typedef typename KdTreeNode::kdKey kdKey;
-
- //! Export data type.
- typedef typename KdTreeNode::kdData kdData;
-
- //! Export data item type.
- typedef typename KdTreeNode::kdDataItem kdDataItem;
-
- //! Export data type.
- typedef typename KdTreeNode::kdDataTag kdDataTag;
-
- //! Constructor
- TeKdTree(const TeBox& mbr)
- : TeBasicKdTree<KdTreeNode>(mbr)
- {
- }
-
- //! Inserts the data with a given key in tree
- inline void insert(const kdKey& key, const kdDataItem& item);
-
- //! Inserts the data in the tree and and keeps it balanced: the kdsort algorithm must be called before
- void buildOptimized(vector<pair<kdKey, kdDataItem> >& dataSet)
- {
- const unsigned int last = dataSet.size() - 1u;
-
- root_ = buildOptimized(dataSet, 0u, last);
- }
-
- //! Range search query.
- void search(const TeBox& rect, vector<KdTreeNode*>& report) const
- {
- if(root_)
- search(rect, root_, 'x', report);
-
- return;
- }
-
- protected:
-
- //! Inserts data for single nodes, i.e., nodes that stores only one element
- void insertData(KdTreeNode*& node, const kdDataItem& data, const kd_node_data_single_tag&)
- {
- node->setData(data);
- }
-
- //! Inserts data for set nodes, i.e., nodes that may stores many element
- void insertData(KdTreeNode*& node, const kdDataItem& data, const kd_node_data_set_tag&)
- {
- node->getData().push_back(data);
- }
-
- //! Recursive range query
- inline void search(const TeBox& rect, KdTreeNode* node, const char& level, vector<KdTreeNode*>& report) const;
-
- //! Builds the tree recursively
- KdTreeNode* buildOptimized(vector<pair<kdKey, kdDataItem> >& dataSet, const unsigned int& first, const unsigned int& last)
- {
- const unsigned int kth = (last - first + 1u) / 2u;
-
- KdTreeNode* newNode = new KdTreeNode(dataSet[first + kth].first);
-
- newNode->setData(dataSet[first + kth].second);
-
- ++size_;
-
- if((first + kth) > first)
- newNode->setLeft(buildOptimized(dataSet, first, first + kth - 1u));
-
- if((first + kth) < last)
- newNode->setRight(buildOptimized(dataSet, first + kth + 1u, last));
-
- return newNode;
- }
-
- private:
-
- //! No copy allowed
- TeKdTree(const TeKdTree& other);
-
- //! No copy allowed
- TeKdTree& operator=(const TeKdTree& other);
-
-}; // end class TeKdTree
-
-template<class KdTreeNode>
-void TeKdTree<KdTreeNode>::insert(const kdKey& key, const kdDataItem& item)
-{
- if(root_ == 0)
- {
- root_ = new KdTreeNode(key);
-
- insertData(root_, item, kdDataTag());
- }
- else
- {
- char level = 'x';
-
- bool left = false;
-
- KdTreeNode* x = root_;
- KdTreeNode* y = 0;
-
- while(x != 0)
- {
- y = x;
-
- if(level == 'x')
- {
- if(key.x() > x->getKey().x()) // if the key is greater than, inserts in the right subtree
- {
- x = x->getRight();
- left = false;
- }
- else if(key.x() < x->getKey().x()) // if the key is smaller than, inserts in the left subtree
- {
- x = x->getLeft();
- left = true;
- }
- else if(key.y() == x->getKey().y()) // if the key already exist, in the case of single node the data will be overwrite and in the case of set node they will push_back the item
- {
- insertData(x, item, kdDataTag());
-
- return;
- }
- else // found the same axis partition, so go left
- {
- x = x->getLeft();
- left = true;
- }
-
- level = 'y';
- }
- else
- {
- if(key.y() > x->getKey().y())
- {
- x = x->getRight();
- left = false;
- }
- else if(key.y() < x->getKey().y())
- {
- x = x->getLeft();
- left = true;
- }
- else if(key.x() == x->getKey().x())
- {
- insertData(x, item, kdDataTag());
-
- return;
- }
- else
- {
- x = x->getLeft();
- left = true;
- }
-
- level = 'x';
- }
- }
-
- KdTreeNode* newNode = new KdTreeNode(key);
-
- insertData(newNode, item, kdDataTag());
-
- if(left)
- y->setLeft(newNode);
- else
- y->setRight(newNode);
- }
-
- ++size_;
-
- return;
-}
-
-template<class KdTreeNode>
-void TeKdTree<KdTreeNode>::search(const TeBox& rect, KdTreeNode* node, const char& level, vector<KdTreeNode*>& report) const
-{
- if((node->getKey().x() >= rect.x1_) && (node->getKey().x() <= rect.x2_) &&
- (node->getKey().y() >= rect.y1_) && (node->getKey().y() <= rect.y2_))
- report.push_back(node);
-
- if(level == 'x')
- {
- if(node->hasLeft())
- if(node->getKey().x() >= rect.x1_)
- search(rect, node->getLeft(), 'y', report);
-
- if(node->hasRight())
- if(node->getKey().x() <= rect.x2_)
- search(rect, node->getRight(), 'y', report);
- }
- else
- {
- if(node->hasLeft())
- if(node->getKey().y() >= rect.y1_)
- search(rect, node->getLeft(), 'x', report);
-
- if(node->hasRight())
- if(node->getKey().y() <= rect.y2_)
- search(rect, node->getRight(), 'x', report);
- }
-
- return;
-}
-
-//! Class that represents a node of a TeAdaptativeKdTree
-/*!
- Each node contains a pointer to its left and right subtree (NULL if it is not set),
- a discriminator that indicates the axis of partition, the partition key and
- a set of data-items.
-
- WARNING:
-
- 1. The key must have methods called x() and y().
-
- 2. These kind of node stores the data only in the leafs.
-
- 3. The leaf nodes contains a set of values that forms a bucket (the size is controlled by the tree methods tha use this class).
- */
-template<class NodeKey, class NodeData, class NodeDataItem>
-class TeAdaptativeKdTreeNode
-{
-protected:
- //! The key used to access this record
- double key_;
-
- //! The data stored in this record
- NodeData data_;
-
- //! The discriminator used in partition
- char discriminator_;
-
- //! Pointer to the left sub-tree.
- TeAdaptativeKdTreeNode* left_;
-
- //! Pointer to the right sub-tree.
- TeAdaptativeKdTreeNode* right_;
-
-public:
- //! Export key type.
- typedef NodeKey kdKey;
-
- //! Export data type.
- typedef NodeData kdData;
-
- //! Export data item type.
- typedef NodeDataItem kdDataItem;
-
- //! Constructor
- TeAdaptativeKdTreeNode(const double& k)
- : key_(k), discriminator_('x'), left_(0), right_(0)
- { }
-
- //! Sets the key to the node
- void setKey(const double& k)
- {
- key_ = k;
- }
-
- //! Returns a reference to node key
- const double& getKey(void) const
- {
- return key_;
- }
-
- //! Sets the data in the node
- void setData(const NodeData& data)
- {
- data_ = data;
- }
-
- //! Returns a reference to data node
- NodeData& getData(void)
- {
- return data_;
- }
-
- //! Sets the data in the node
- void setDiscriminator(const char& d)
- {
- discriminator_ = d;
- }
-
- //! Returns a reference to discriminator
- const char& getDiscriminator(void) const
- {
- return discriminator_;
- }
-
- //! Sets the left child pointer
- void setLeft(TeAdaptativeKdTreeNode* node)
- {
- left_ = node;
- }
-
- //! Sets the right child pointer
- void setRight(TeAdaptativeKdTreeNode* node)
- {
- right_ = node;
- }
-
- //! Accessor for left child
- TeAdaptativeKdTreeNode* getLeft(void) const
- {
- return left_;
- }
-
- //! Accessor for right child
- TeAdaptativeKdTreeNode* getRight(void) const
- {
- return right_;
- }
-
- //! Method to check if this has a left child
- bool hasLeft(void) const
- {
- return (left_ != 0);
- }
-
- //! Method to check if a this has a right child
- bool hasRight(void) const
- {
- return (right_ != 0);
- }
-
- //! Method to check if this has no children
- bool isLeaf(void) const
- {
- return !(hasLeft() || hasRight());
- }
-
- //! Method to count the number of nodes below this
- unsigned int descendants(void) const
- {
- unsigned int totalLeft = 0u;
- unsigned int totalRight = 0u;
-
- if(hasLeft())
- totalLeft = 1u + getLeft()->descendants();
-
- if(hasRight())
- totalRight = 1u + getRight()->descendants();
-
- return (totalLeft + totalRight);
- }
-
- private:
-
- //! No copy allowed
- TeAdaptativeKdTreeNode(const TeAdaptativeKdTreeNode& other);
-
- //! No copy allowed
- TeAdaptativeKdTreeNode& operator=(const TeAdaptativeKdTreeNode& other);
-
-}; // end of class TeAdaptativeKdTreeNode
-
-//! A class that represents a two dimensional K-d Tree (2-d Tree) that store data-elements into the leafs
-/*!
- WARNING:
-
- 1. This type of tree stores the data only in the leaf nodes.
-
- 2. The process of construction expect that the tree is almost balanced
-
- 3. This type of tree may be of special interest of NEAREST NEIGHBOR SEARCH QUERIES.
-
- 4. After a box search it will be necessary to do a refinement.
- */
-template<class KdTreeNode>
-class TeAdaptativeKdTree : public TeBasicKdTree<KdTreeNode>
-{
- using TeBasicKdTree<KdTreeNode>::root_;
- using TeBasicKdTree<KdTreeNode>::size_;
- using TeBasicKdTree<KdTreeNode>::mbr_;
-
-protected:
- //! Bucket size (maximum number of elements in each node)
- unsigned int bucketSize_;
-
-public:
- //! Export key type.
- typedef typename KdTreeNode::kdKey kdKey;
-
- //! Export data type.
- typedef typename KdTreeNode::kdData kdData;
-
- //! Export data item type.
- typedef typename KdTreeNode::kdDataItem kdDataItem;
-
- //! Export node type.
- typedef KdTreeNode kdNode;
-
- //! Constructor
- TeAdaptativeKdTree(const TeBox& box, const unsigned int& bucketSize = 12)
- : TeBasicKdTree<KdTreeNode>(box), bucketSize_(bucketSize)
- {
- }
-
- //! Sets bucket size for leaf nodes
- void setBucketSize(const unsigned int& size)
- {
- bucketSize_ = size;
- }
-
- //! Sets bucket size for leaf nodes
- const unsigned int& getBucketSize(void) const
- {
- return bucketSize_;
- }
-
- //! Inserts the data set into the tree
- void build(vector<pair<kdKey, kdDataItem> >& dataSet)
- {
- root_ = build(dataSet, 0.0, mbr_);
- }
-
- //! Search the nearest data in nodes: you must pass an array of kdDataItem of size "k" with coordinates values (X() and Y()) adjusted to TeMAXFLOAT (this dummy values will be replaced at processing time), and if not all neighbors are found so sqrDists will contains TeMAXFLOAT in array index
- void nearestNeighborSearch(const kdKey& key, vector<kdDataItem>& report, vector<double>& sqrDists, const unsigned int& k) const
- {
- if(root_)
- {
- sqrDists.clear();
-
- for(unsigned int i = 0; i < k; ++i)
- sqrDists.push_back(TeMAXFLOAT);
-
- TeBox rect(-TeMAXFLOAT, -TeMAXFLOAT, +TeMAXFLOAT, +TeMAXFLOAT);
-
- nearestNeighborSearch(root_, key, report, sqrDists, rect);
- }
- }
-
- //! Range search query.
- void search(const TeBox& rect, vector<KdTreeNode*>& report) const
- {
- if(root_)
- search(rect, root_, report);
-
- return;
- }
-
- //! Range search query: the refinement is already done
- inline void search(const TeBox& rect, vector<kdDataItem>& report) const;
-
-protected:
- //! Build the tree recursivily
- inline KdTreeNode* build(vector<pair<kdKey, kdDataItem> >& dataSet, double averageValue, const TeBox& mbr);
-
- //! Recursive range query.
- inline void search(const TeBox& rect, KdTreeNode* node, vector<KdTreeNode*>& report) const;
-
- //! Recursive nearest neighbor search
- inline void nearestNeighborSearch(KdTreeNode* node, const kdKey& key, vector<kdDataItem>& report, vector<double>& sqrDists, TeBox& rect) const;
-
- //! Update neighbor list
- inline void update(KdTreeNode* node, const kdKey& key, vector<kdDataItem>& report, vector<double>& sqrDists, TeBox& rect) const;
-
- //! Returns the average value along the axis
- double average(vector<pair<kdKey, kdDataItem> >& dataSet, const char& discriminator) const
- {
- const unsigned int size = dataSet.size();
-
- double medianValue = 0.0;
-
- if(discriminator == 'x')
- {
- for(unsigned int i = 0; i < size; ++i)
- medianValue += dataSet[i].first.x();
-
- return medianValue / size;
- }
- else
- {
- for(unsigned int i = 0; i < size; ++i)
- medianValue += dataSet[i].first.y();
-
- return medianValue / size;
- }
- }
-
-private:
- //! No copy allowed
- TeAdaptativeKdTree(const TeAdaptativeKdTree& other);
-
- //! No copy allowed
- TeAdaptativeKdTree& operator=(const TeAdaptativeKdTree& other);
-
-}; // end class TeAdaptativeKdTree
-
-template<class KdTreeNode>
-KdTreeNode* TeAdaptativeKdTree<KdTreeNode>::build(vector<pair<kdKey, kdDataItem> >& dataSet, double averageValue, const TeBox& mbr)
-{
- ++size_;
-
- if(dataSet.size() <= bucketSize_)
- {
- KdTreeNode* node = new KdTreeNode(averageValue);
-
- node->setDiscriminator('l');
- //node->setBox(mbr);
-
- unsigned int size = dataSet.size();
-
- for(unsigned int i = 0; i < size; ++i)
- node->getData().push_back(dataSet[i].second);
-
- return node;
- }
-
- TeBox newMbr1(mbr);
- TeBox newMbr2(mbr);
-
- char discriminator = 'x';
-
- vector<pair<kdKey, kdDataItem> > leftDataSet;
- vector<pair<kdKey, kdDataItem> > rightDataSet;
-
-// Finds the largest dimension
- if((mbr.x2_ - mbr.x1_) > (mbr.y2_ - mbr.y1_))
- {
-// Finds the median along "x" axis
- averageValue = average(dataSet, 'x');
-
-// Adjust box for left and right branchs
- newMbr1.x2_ = averageValue;
- newMbr2.x1_ = averageValue;
-
- unsigned int size = dataSet.size();
-
- for(unsigned int i = 0; i < size; ++ i)
- {
- if(dataSet[i].first.x() <= averageValue)
- leftDataSet.push_back(dataSet[i]);
- else
- rightDataSet.push_back(dataSet[i]);
- }
- }
- else
- {
- discriminator = 'y';
-
-// Finds the median along "y" axis
- averageValue = average(dataSet, 'y');
-
-// Adjust box for left and right branchs
- newMbr1.y2_ = averageValue;
- newMbr2.y1_ = averageValue;
-
- unsigned int size = dataSet.size();
-
- for(unsigned int i = 0; i < size; ++ i)
- {
- if(dataSet[i].first.y() <= averageValue)
- leftDataSet.push_back(dataSet[i]);
- else
- rightDataSet.push_back(dataSet[i]);
- }
- }
-
- dataSet.clear();
-
- KdTreeNode* node = new KdTreeNode(averageValue);
-
- //node->setBox(mbr);
-
- if(rightDataSet.size() == 0u) // If all coordinates have the same coordinate values, the right vector will be empty so we need stop division to
- {
- node->setDiscriminator('l');
- //node->setBox(newMbr1);
-
- unsigned int size = leftDataSet.size();
-
- for(unsigned int i = 0; i < size; ++i)
- node->getData().push_back(leftDataSet[i].second);
-
- //throw;
- }
- else if(leftDataSet.size() == 0u) // If all coordinates have the same coordinate values, the left vector is empty, so we need to stop
- {
- node->setDiscriminator('l');
- //node->setBox(newMbr2);
-
- unsigned int size = rightDataSet.size();
-
- for(unsigned int i = 0; i < size; ++i)
- node->getData().push_back(rightDataSet[i].second);
-
- //throw;
- }
- else
- {
- node->setDiscriminator(discriminator);
- node->setLeft(build(leftDataSet, averageValue, newMbr1));
- node->setRight(build(rightDataSet, averageValue, newMbr2));
- }
-
- return node;
-}
-
-template<class KdTreeNode>
-void TeAdaptativeKdTree<KdTreeNode>::search(const TeBox& rect, vector<kdDataItem>& report) const
-{
- vector<KdTreeNode*> reportNodes;
-
- search(rect, reportNodes);
-
- unsigned int nNodes = reportNodes.size();
-
- for(unsigned int i = 0; i < nNodes; ++i)
- {
- unsigned int nElements = reportNodes[i]->getData().size();
-
- for(unsigned int j = 0; j < nElements; ++j)
- {
- if(TeIntersects((reportNodes[i])->getData()[j], rect))
- {
- report.push_back((reportNodes[i])->getData()[j]);
- }
- }
- }
-}
-
-template<class KdTreeNode>
-void TeAdaptativeKdTree<KdTreeNode>::search(const TeBox& rect, KdTreeNode* node, vector<KdTreeNode*>& report) const
-{
- if(node->getDiscriminator() == 'x')
- {
- if(node->hasLeft())
- if(rect.x1_ <= node->getKey())
- search(rect, node->getLeft(), report);
-
- if(node->hasRight())
- if(rect.x2_ >= node->getKey())
- search(rect, node->getRight(), report);
- }
- else if(node->getDiscriminator() == 'y')
- {
- if(node->hasLeft())
- if(rect.y1_ <= node->getKey())
- search(rect, node->getLeft(), report);
-
- if(node->hasRight())
- if(rect.y2_ >= node->getKey())
- search(rect, node->getRight(), report);
- }
- else
- {
- report.push_back(node);
- }
-
- return;
-}
-
-template<class KdTreeNode>
-void TeAdaptativeKdTree<KdTreeNode>::nearestNeighborSearch(KdTreeNode* node, const kdKey& key, vector<kdDataItem>& report, vector<double>& sqrDists, TeBox& rect) const
-{
- if(node->getDiscriminator() == 'l')
- {
- update(node, key, report, sqrDists, rect); // this is a leaf node -> update list of neighbours
- }
- else if(node->getDiscriminator() == 'x')
- {
- if(key.x() <= node->getKey())
- {
- nearestNeighborSearch(node->getLeft(), key, report, sqrDists, rect);
-
- if((rect.x1_ < node->getKey()) && (node->getKey() < rect.x2_))
- nearestNeighborSearch(node->getRight(), key, report, sqrDists, rect);
- }
- else
- {
- nearestNeighborSearch(node->getRight(), key, report, sqrDists, rect);
-
- if((rect.x1_ < node->getKey()) &&(node->getKey() < rect.x2_))
- nearestNeighborSearch(node->getLeft(), key, report, sqrDists, rect);
- }
- }
- else if(node->getDiscriminator() == 'y')
- {
- if(key.y() <= node->getKey())
- {
- nearestNeighborSearch(node->getLeft(), key, report, sqrDists, rect);
-
- if((rect.y1_ < node->getKey()) &&(node->getKey() < rect.y2_ ))
- nearestNeighborSearch(node->getRight(), key, report, sqrDists, rect);
- }
- else
- {
- nearestNeighborSearch(node->getRight(), key, report, sqrDists, rect);
-
- if((rect.y1_ < node->getKey()) &&(node->getKey() < rect.y2_))
- nearestNeighborSearch(node->getLeft(), key, report, sqrDists, rect);
- }
- }
-
-}
-
-template<class KdTreeNode>
-void TeAdaptativeKdTree<KdTreeNode>::update(KdTreeNode* node, const kdKey& key, vector<kdDataItem>& report, vector<double>& sqrDists, TeBox& rect) const
-{
-// rect is the bounding box of neighbors
-
- const unsigned int size = node->getData().size();
-
- const unsigned int nNeighbors = report.size();
-
-// for each element in the node, we need to search for distances less than of some one of sqrDists
- for(unsigned int i = 0u; i < size; ++i)
- {
- double dx = (key.x() - node->getData()[i].location().x());
- double dy = (key.y() - node->getData()[i].location().y());
-
- double dkp = (dx * dx) + (dy * dy); // square distance from the key point to the node
-
-// if the distance of "i-th" element is less than the maximum distance in the sqrDists
- if(dkp < sqrDists[nNeighbors - 1])
- {
-// so the element must be reported
-
-// and the srqDists vector must be rearranged
- for(unsigned int j = 0u; j < nNeighbors; ++j)
- {
- if(dkp < sqrDists[j]) // if the position is found
- {
-// move the elements to the right
- for(unsigned int k = nNeighbors - 1; k > j; --k)
- {
- report[k] = report[k - 1];
- sqrDists[k] = sqrDists[k - 1];
- }
-
-// inserts the element in the report and update its distance
- report[j] = node->getData()[i];
-
- sqrDists[j] = dkp;
-
- break;
- }
- }
- }
- }
-
- double maxDist = sqrDists[nNeighbors - 1];
-
- if(maxDist != TeMAXFLOAT)
- {
- maxDist = sqrt(maxDist);
- }
-
- rect.x1_ = key.x() - maxDist;
- rect.y1_ = key.y() - maxDist;
- rect.x2_ = key.x() + maxDist;
- rect.y2_ = key.y() + maxDist;
-}
-/** @} */
-
-}; // end namespace TeSAM
-
-
-#endif // __TERRALIB_INTERNAL_KDTREE_H
-
-
-
-
diff --git a/src/terralib/kernel/TeLayer.cpp b/src/terralib/kernel/TeLayer.cpp
deleted file mode 100644
index 8c5ea3b..0000000
--- a/src/terralib/kernel/TeLayer.cpp
+++ /dev/null
@@ -1,1243 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeLayer.h"
-#include "TeUtils.h"
-#include "TeException.h"
-#include "TeDatabase.h"
-#include "TeRaster.h"
-#include "TeProjection.h"
-
-
-TeLayer::TeLayer(const string& name, TeDatabase* db, TeProjection* proj):
- name_(name),
- id_(-1),
- db_(db),
- projection_ ( proj ),
- raster_(0)
-{
- if (!db_ || name.empty())
- return;
-
- // verifies if layer already exists in the database
- string sql = "SELECT * FROM te_layer WHERE name = '" + name + "'";
- TeDatabasePortal* portal = db_->getPortal();
- if (!portal)
- return;
- if (!portal->query(sql))
- {
- delete portal;
- return;
- }
- if (!portal->fetchRow())
- {
- if (!proj) // provides a default projection No Projection
- projection_ = new TeNoProjection();
- else
- projection_ = TeProjectionFactory::make (proj->params());
- db_->insertLayer(this);
- }
- else
- db_->loadLayer(this);
- int pid = projection_->id();
- delete projection_;
- projection_ = db_->loadProjection(pid);
- delete portal;
-}
-
-
-TeLayer::TeLayer(const string& name, TeDatabase* db, TeBox& box, TeProjection* proj):
- name_(name),
- id_(-1),
- db_(db),
- projection_(proj),
- box_(box),
- raster_(0)
-{
- if (!db_ || name.empty())
- return;
-
- // verifies if layer already exists in the database
- string sql = "SELECT * FROM te_layer WHERE name = '" + name + "'";
- TeDatabasePortal* portal = db_->getPortal();
- if (!portal)
- return;
- if (!portal->query(sql))
- {
- delete portal;
- return;
- }
- if (!portal->fetchRow())
- {
- if (!proj) // provides a default projection No Projection
- projection_ = new TeNoProjection();
- else
- projection_ = TeProjectionFactory::make (proj->params());
- db_->insertLayer(this);
- }
- else
- db_->loadLayer(this);
- delete portal;
-}
-
-TeLayer::~TeLayer()
-{
- if ( projection_ != 0 )
- {
- delete projection_;
- projection_ = 0;
- }
- for (TeRepresPointerVectorIterator it = repVector_.begin(); it != repVector_.end(); it++)
- {
- if (*it)
- {
- delete (*it);
- (*it) = 0;
- }
- }
- repVector_.clear();
- if (raster_!=0)
- {
- delete raster_;
- raster_ = 0;
- }
-}
-
-TeLayer::TeLayer( const TeLayer& other )
-{
- if (projection_)
- delete projection_;
- projection_ = 0;
- if (other.projection_)
- projection_ = TeProjectionFactory::make ( other.projection_->params());
- name_ = other.name_;
- id_ = other.id_;
- db_ = other.db_;
-}
-
-TeLayer&
-TeLayer::operator= ( const TeLayer& other )
-{
- if ( this != &other )
- {
- if (projection_)
- delete projection_;
- projection_ = 0;
- if (other.projection_)
- projection_ = TeProjectionFactory::make ( other.projection_->params());
- name_ = other.name_;
- id_ = other.id_;
- box_ = other.box_;
- db_ = other.db_;
- }
- return *this;
-}
-
-
-void
-TeLayer::setLayerBox(const TeBox& box)
-{
- box_ = box;
- if ((id_ > -1) && db_)
- db_->updateLayerBox(this);
-}
-
-void
-TeLayer::updateLayerBox(const TeBox& box)
-{
- updateBox(box_,box);
- if ((id_ > -1) && db_)
- db_->updateLayerBox(this);
-}
-
-void
-TeLayer::updateLayerBox()
-{
- if (id_ < 0 || !db_)
- return;
-
- string sql = "SELECT lower_x, lower_y, upper_x, upper_y FROM te_representation WHERE layer_id = " + Te2String(id_);
- TeDatabasePortal* portal = db_->getPortal();
- if (!portal)
- return;
- if (!portal->query(sql))
- {
- delete portal;
- return;
- }
-
- TeBox box;
- while (portal->fetchRow())
- {
- TeBox brep(portal->getDouble(0),portal->getDouble(1),portal->getDouble(2),portal->getDouble(3));
- updateBox(box,brep);
- }
- delete portal;
- box_ = box;
- db_->updateLayerBox(this);
- return;
-}
-
-int
-TeLayer::getNewObjectId()
-{
- if(!db_)
- return -1;
-
- TeDatabasePortal* portal = db_->getPortal();
- if(!portal)
- return -1;
-
- try
- {
- int objId = 0;
- string sql;
- for (TeRepresPointerVectorIterator it = vectRepres().begin(); it != vectRepres().end(); it++)
- {
- TeRepresentation* rep = (*it);
-
- sql = "SELECT MAX(geom_id) FROM ";
- sql += rep->tableName_;
- if (portal->query(sql) && portal->fetchRow())
- {
- string data = portal->getData(0);
- int value = 0;
- if(!data.empty())
- value = atoi(data.c_str());
- objId += value;
- }
- portal->freeResult();
- }
- delete portal;
- return ++objId;
- }
- catch(...)
- {
- if (portal)
- {
- delete portal;
- return -1;
- }
- }
- return -1;
-}
-
-void
-TeLayer::setProjection ( TeProjection* proj )
-{
- if (!proj)
- return;
-
- // if no database set just update pointer
- if (!db_)
- {
- if ( projection_)
- delete projection_;
- projection_ = proj;
- return;
- }
-
- if (projection_)
- {
- proj->id(projection_->id());
- delete projection_;
- }
- projection_ = proj;
- bool status = true;
-
- if ( projection_->id() <= 0 ) // new projection not in the database
- {
- status = db_->insertProjection(projection_);
- // update layer information
- if (status && id_ > 0)
- {
- string sql = "UPDATE te_layer SET projection_id = " + Te2String(projection_->id());
- sql += " WHERE layer_id=" + Te2String(id_);
- db_->execute(sql);
- }
- }
- else
- status = db_->updateProjection(projection_);
-
- if (raster_)
- {
- delete raster_;
- raster_ = 0;
- }
-}
-
-void
-TeLayer::raster( TeRaster* raster)
-{
- if (raster_ )
- {
- delete raster_;
- raster_ = 0;
- }
- raster_ = raster;
-}
-
-bool
-TeLayer::hasGeometry (TeGeomRep rep)
-{
- if (repVector_.empty())
- return false;
- TeRepresPointerVectorIterator it;
- it = TeFindRepresentation(repVector_.begin(), repVector_.end(),rep);
- return (it != repVector_.end());
-}
-
-int
-TeLayer::geomRep()
-{
- if (repVector_.empty())
- return TeGEOMETRYNONE;
- int r = 0;
- TeRepresPointerVectorIterator it;
- for (it=repVector_.begin(); it != repVector_.end(); ++it)
- r = (int)(*it)->geomRep_ | r;
- return r;
-}
-
-string
-TeLayer::tableName(TeGeomRep rep)
-{
- TeRepresPointerVectorIterator it;
- it = TeFindRepresentation(repVector_.begin(), repVector_.end(),rep);
- if (it != repVector_.end())
- return (*it)->tableName_;
- else
- return string("");
-}
-
-int
-TeLayer::nGeometries(TeGeomRep rep)
-{
- TeRepresPointerVectorIterator it;
- it = TeFindRepresentation(repVector_.begin(), repVector_.end(),rep);
- int ngeo = 0;
- if (it != repVector_.end())
- {
- string sql = "SELECT COUNT(geom_id) FROM " + (*it)->tableName_;
- TeDatabasePortal* portal = db_->getPortal();
- if (portal && portal->query(sql) && portal->fetchRow())
- ngeo = portal->getInt(0);
- delete portal;
- }
- return ngeo;
-}
-
-
-bool
-TeLayer::getRepresentation(TeGeomRep repType, TeRepresPointerVector& result)
-{
- TeRepresPointerVectorIterator it;
- it = repVector_.begin();
- while (it != repVector_.end())
- {
- if ((*it)->geomRep_ == repType)
- result.push_back((*it));
- ++it;
- }
- if (result.empty())
- return false;
- return true;
-}
-
-TeRepresentation*
-TeLayer::getRepresentation(TeGeomRep repType, const string& tName)
-{
-
- TeRepresPointerVectorIterator it;
- it = repVector_.begin();
- while (it != repVector_.end())
- {
- if ((*it)->geomRep_ == repType)
- {
- if (tName.empty() || (*it)->tableName_== tName)
- return (*it);
- }
- it++;
- }
- return 0;
-}
-
-bool
-TeLayer::removeGeometry (TeGeomRep repType, const string& tName)
-{
- if (!db_)
- return false;
-
- if (repType == TeTEXT && tName.empty()) // layer can have more than one TEXT table
- return false;
-
- TeRepresPointerVectorIterator it;
- it = TeFindRepresentation(repVector_.begin(), repVector_.end(),repType);
- while (it != repVector_.end())
- {
- if (tName.empty() || (*it)->tableName_== tName)
- {
- string del;
- TeRepresentation* rep = (*it);
- if (rep->id_ > 0)
- {
- del = "DELETE FROM te_representation WHERE repres_id=" + Te2String(rep->id_);
- if (!db_->execute(del))
- return false;
- }
-
- if (!rep->tableName_.empty())
- {
- if(rep->geomRep_ == TeRASTER || rep->geomRep_ == TeRASTERFILE)
- {
- TeDatabasePortal* portal = db_->getPortal();
- string sql, tname;
-
- sql = "SELECT lut_table, raster_table FROM " + rep->tableName_;
- portal->query(sql);
-
- while(portal->fetchRow())
- {
- // delete lut table
- tname = portal->getData(0);
- if(!tname.empty())
- db_->deleteTable(tname);
- // delete raster table
- tname = portal->getData(1);
- if(rep->geomRep_ != TeRASTERFILE && !tname.empty())
- db_->deleteTable(tname);
- }
- portal->freeResult();
- delete portal;
-
- // delete metadata table
- sql = "DROP TABLE " + rep->tableName_ + "_metadata";
- db_->execute(sql);
- if (raster_)
- {
- delete raster_;
- raster_ = 0;
- }
- }
- if (!db_->deleteTable(rep->tableName_))
- return false;
- }
- repVector_.erase(it);
- delete rep;
- break;
- }
- it++;
- it = TeFindRepresentation(it,repVector_.end(),repType);
- }
- updateLayerBox();
- return true;
-}
-
-bool TeLayer::addGeometry(TeGeomRep repType, const string& tName, const string& desc)
-{
- // check if representation is already in layer
- if (repType == TeTEXT)
- {
- string tt;
- if (!tName.empty())
- tt = tName;
- else
- tt = name_ + "Texts";
-
- if (getRepresentation(repType,tt))
- return true;
- }
- else if (getRepresentation(repType))
- return true;
-
- if (!db_) // layer has no database associated
- return false;
-
- if (id_ < 0) // layer has not saved in the database
- {
- if (!db_->insertLayer (this))
- return false;
- }
-
- TeRepresentation* represe = new TeRepresentation();
- represe->geomRep_ = repType;
- if (!tName.empty())
- represe->tableName_ = tName;
- if (!desc.empty())
- represe->description_ = desc;
-
- if (repType == TePOLYGONS)
- {
- if (tName.empty())
- represe->tableName_ = "Polygons" + Te2String(id_);
- if (!db_->createPolygonGeometry (represe->tableName_))
- return false;
- }
- else if (repType == TeLINES)
- {
- if (tName.empty())
- represe->tableName_ = "Lines" + Te2String(id_);
- if (!db_->createLineGeometry (represe->tableName_))
- return false;
- }
- else if (repType == TePOINTS)
- {
- if (tName.empty())
- represe->tableName_ = "Points" + Te2String(id_);
- if (!db_->createPointGeometry (represe->tableName_))
- return false;
- }
- else if (repType == TeTEXT)
- {
- if (tName.empty())
- represe->tableName_ = "Texts" + Te2String(id_);
- if (!db_->createTextGeometry (represe->tableName_))
- return false;
- }
- else if (repType == TeARCS)
- {
- if (tName.empty())
- represe->tableName_ = "Arcs"+ Te2String(id_);
- if (!db_->createArcGeometry (represe->tableName_))
- return false;
- }
- else if (repType == TeNODES)
- {
- if (tName.empty())
- represe->tableName_ = "Nodes"+ Te2String(id_);
- if (!db_->createNodeGeometry (represe->tableName_))
- return false;
- }
- else if (repType == TeCELLS)
- {
- if (tName.empty())
- represe->tableName_ = "Cells"+ Te2String(id_);
- if (!db_->createCellGeometry (represe->tableName_))
- return false;
- }
- else
- {
- return false;
- }
-
- bool res = db_->insertRepresentation(id_,*represe);
-
- if (res)
- repVector_.push_back(represe);
- else
- return false;
- return true;
-}
-
-bool
-TeLayer::addRasterGeometry(TeRasterParams& par, const string& objectId,
- const string& tName, const string& desc)
-{
- string tableName = tName;
- TeRepresentation* rep = getRepresentation(TeRASTER,tableName);
- if (!rep)
- {
- rep = new TeRepresentation();
- updateBox(rep->box_,par.boundingBox());
-
- if (!tableName.empty())
- rep->tableName_ = tableName;
- else
- rep->tableName_ = "RasterLayer" + Te2String(id_);
-
- if (!desc.empty())
- rep->description_ = desc;
-
- rep->geomRep_ = TeRASTER;
- if (!db_->insertRepresentation(id_,*rep))
- return false;
-
- tableName = rep->tableName_;
- if (!db_->createRasterGeometry(tableName))
- return false;
-
- string metadataTableName = tableName+"_metadata";
- if (!db_->createRasterMetadataTable(metadataTableName))
- return false;
-
- repVector_.push_back(rep);
- }
- else
- tableName = rep->tableName_;
-
- string oid = objectId;
- if (oid.empty())
- oid = "O1";
-
- if (par.fileName_.empty())
- {
- string aux = "RasterLayer" + Te2String(id_) + "_R_" + objectId;
- bool flag = db_->tableExist(aux);
- short i=1;
- while (flag)
- {
- aux = "RasterLayer" + Te2String(id_) + "_R_" + objectId + "_" + Te2String(i);
- ++i;
- }
- par.fileName_ = aux;
- }
-
- if (!db_->createRasterTable(par.fileName_))
- return false;
-
- if (!db_->insertRasterGeometry(tableName,par,objectId))
- return false;
-
- updateLayerBox(par.boundingBox());
- par.layerId_ = id_;
- par.objectId_ = oid;
-
- return true;
-}
-
-bool
-TeLayer::addRasterFileGeometry(TeRaster* raster, const string& /* objectId */, const string& desc)
-{
- if (!raster)
- return false;
- TeRepresentation* rep = getRepresentation(TeRASTERFILE);
- if (!rep)
- {
- rep = new TeRepresentation();
- updateBox(rep->box_,raster->params().boundingBox());
- rep->tableName_ = "RasterLayer" + Te2String(id_);
- rep->geomRep_ = TeRASTERFILE;
- rep->resX_ = raster->params().resx_;
- rep->resY_ = raster->params().resy_;
- rep->nCols_= raster->params().ncols_;
- rep->nLins_= raster->params().nlines_;
- if (!desc.empty())
- rep->description_ = desc;
- if (!db_->insertRepresentation(id_,*rep))
- return false;
- if (!db_->createRasterGeometry(rep->tableName_))
- return false;
- if (!db_->createRasterMetadataTable(rep->tableName_+"_metadata"))
- return false;
- repVector_.push_back(rep);
- }
- string oid = TeGetBaseName(raster->params().fileName_.c_str());
- if (oid.empty())
- oid = "O1";
- string sql = "delete from " + rep->tableName_ + " where object_id = '" + oid + "'";
- db_->execute(sql);
- if (!db_->insertRasterGeometry(rep->tableName_,raster->params(),oid))
- return false;
- updateLayerBox(raster->params().boundingBox());
- raster->params().layerId_ = id_;
- raster->params().objectId_ = oid;
- return true;
-}
-
-bool
-TeLayer::addRasterGeometry(TeRaster* raster, const string& objectId)
-{
- if (!raster)
- return false;
- TeRepresentation* rep = getRepresentation(TeRASTER);
- if (!rep)
- {
- rep = new TeRepresentation();
- updateBox(rep->box_,raster->params().boundingBox());
- rep->tableName_ = "RasterLayer" + Te2String(id_);
- rep->geomRep_ = TeRASTER;
- if (!db_->insertRepresentation(id_,*rep))
- return false;
- if (!db_->createRasterGeometry(rep->tableName_))
- return false;
- if (!db_->createRasterMetadataTable(rep->tableName_+"_metadata"))
- return false;
- repVector_.push_back(rep);
- }
-
- string oid = objectId;
- if (oid.empty())
- oid = "O1";
- string sql = "delete from " + rep->tableName_ + " where object_id = '" + oid + "'";
- db_->execute(sql);
- if (!db_->insertRasterGeometry(rep->tableName_,raster->params(),oid))
- return false;
- updateLayerBox(raster->params().boundingBox());
- raster->params().layerId_ = id_;
- raster->params().objectId_ = oid;
- return true;
-}
-
-TeRaster*
-TeLayer::raster(const string& objectId, const char& mode)
-{
- if (id_ <= 0 ||
- !(hasGeometry(TeRASTER) || hasGeometry(TeRASTERFILE)))
- return 0;
-
- if (raster_ && !objectId.empty() &&
- (objectId != raster_->objectId() ||
- mode != raster_->params().mode_ ))
- {
- delete raster_;
- raster_ = 0;
- }
-
- if (!raster_)
- raster_ = db_->loadLayerRaster(id_,objectId, mode);
- return raster_;
-}
-
-bool
-TeLayer::getRasterGeometries(vector<string>& objectIds, unsigned int tilingType)
-{
- objectIds.clear();
- if (!hasGeometry(TeRASTER) || id_ <= 0 )
- return false;
-
- TeDatabasePortal* portal = db_->getPortal();
- if (!portal)
- return false;
-
- string get = "SELECT geom_table FROM te_representation WHERE layer_id = " + Te2String(id_);
- get += " AND geom_type = 512";
-
- // error executing query or no there is no raster representation
- if (!portal->query(get) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- string tableName = portal->getData(0);
- if (tableName.empty())
- {
- delete portal;
- return false;
- }
- portal->freeResult();
- get = "SELECT object_id FROM " + tableName;
- if (tilingType == 1 || tilingType == 2)
- get += " WHERE tiling_type=" + Te2String(tilingType);
-
- if (!portal->query(get))
- {
- delete portal;
- return false;
- }
- while (portal->fetchRow())
- objectIds.push_back(portal->getData(0));
- delete portal;
- return !objectIds.empty();
-}
-
-
-int
-TeLayer::nObjects(const string& tName)
-{
- if (attTables_.empty())
- return 0;
- string linkName;
- vector<TeTable>::iterator it = attTables_.begin();
- while (it != attTables_.end())
- {
- if ((*it).name() == tName)
- {
- linkName = (*it).linkName();
- break;
- }
- it++;
- }
- if (linkName.empty())
- return 0;
- int no = 0;
- string sql;
- TeDatabasePortal* portal = db_->getPortal();
- if (!portal)
- return 0;
- sql = "SELECT COUNT(" + linkName + ") FROM " + (*it).name();
- if (portal->query(sql) && portal->fetchRow())
- no = portal->getInt(0);
- delete portal;
- return no;
-}
-
-
-bool
-TeLayer::createAttributeTable(TeTable& table)
-{
- if (!db_->tableExist(table.name()))
- {
- db_->validTable(table);
- if (!db_->createTable(table.name(),table.attributeList()))
- return false;
- }
-
- if(!db_->insertTableInfo(id_,table))
- return false;
-
- vector<TeTable>::iterator it = attTables_.begin();
- while (it != attTables_.end())
- {
- if ((*it).name() == table.name())
- return true;
- ++it;
- }
- attTables_.push_back(table);
- return true;
-}
-
-bool
-TeLayer::addAttributeTable(TeTable& table)
-{
- vector<TeTable>::iterator it = attTables_.begin();
- while (it != attTables_.end())
- {
- if ((*it).name() == table.name())
- return false;
- it++;
- }
- attTables_.push_back(table);
- return true;
-}
-
-bool
-TeLayer::removeAttributeTable(string tableName)
-{
- vector<TeTable>::iterator it = attTables_.begin();
- while (it != attTables_.end())
- {
- if ((*it).name() == tableName)
- {
- attTables_.erase(it);
- return true;
- }
- it++;
- }
- return false;
-}
-
-void
-TeLayer::updateAttributeTable(TeTable& table)
-{
- vector<TeTable>::iterator it = attTables_.begin();
- while (it != attTables_.end())
- {
- if ((*it).name() == table.name())
- {
- attTables_.erase(it);
- break;
- }
- it++;
- }
- attTables_.push_back(table);
-}
-
-bool
-TeLayer::loadLayerTables()
-{
- TeDatabase *db = database();
- if(!db)
- return false;
-
- attTables_.clear();
- return(db->loadLayerTable(this));
-}
-
-bool
-TeLayer::getAttrTables(TeAttrTableVector& atts, TeAttrTableType attType)
-{
- TeAttrTableVector::iterator it = attTables_.begin();
- while (it != attTables_.end())
- {
- if ((attType == TeAllAttrTypes) || ((*it).tableType() == attType))
- atts.push_back((*it));
- it++;
- }
- return (!atts.empty());
-}
-
-bool
-TeLayer::getAttrTablesByName(vector<string> &tableNames, TeAttrTableVector& atts, TeAttrTableType attType)
-{
- TeAttrTableVector::iterator it;
- vector<string>::iterator it2;
-
- for(it2 = tableNames.begin(); it2 != tableNames.end(); ++it2)
- {
- for(it = attTables_.begin(); it != attTables_.end(); ++it)
- {
- if ((attType == TeAllAttrTypes) || ((*it).tableType() == attType))
- {
- string name = (*it).name();
- string name2 = (*it2);
- if(name == name2)
- {
- atts.push_back((*it));
- break;
- }
- }
- }
- }
- return (!atts.empty());
-}
-
-
-bool
-TeLayer::getAttrTablesByName(const string& attrTableName, TeTable& table, TeAttrTableType attType)
-{
- TeAttrTableVector::iterator it;
-
- for(it = attTables_.begin(); it != attTables_.end(); ++it)
- {
- if ((attType == TeAllAttrTypes) || ((*it).tableType() == attType))
- {
- string name = (*it).name();
- if(name == attrTableName)
- {
- table = (*it);
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool
-TeLayer::addPolygons (TePolygonSet& polySet)
-{
- if (!db_)
- return false;
-
- if (polySet.size() > 0 )
- {
- if (!this->hasGeometry(TePOLYGONS))
- this->addGeometry(TePOLYGONS);
-
- TeRepresentation* rep = getRepresentation(TePOLYGONS);
- if (rep)
- {
- if (!db_->insertPolygonSet (rep->tableName_, polySet))
- return false;
- updateLayerBox(polySet.box());
- updateBox(rep->box_,polySet.box());
- if (!db_->updateRepresentation(id_,*rep))
- return false;
- }
- else
- return false;
- }
- return true;
-}
-
-bool
-TeLayer::addLines (TeLineSet& lineSet)
-{
- if (!db_)
- return false;
-
- if (lineSet.size() > 0)
- {
- if (!this->hasGeometry(TeLINES))
- this->addGeometry(TeLINES);
- TeRepresentation* rep = getRepresentation(TeLINES);
- if (rep)
- {
- if (!db_->insertLineSet (rep->tableName_, lineSet))
- return false;
- updateLayerBox(lineSet.box());
- updateBox(rep->box_,lineSet.box());
- if (!db_->updateRepresentation(id_,*rep))
- return false;
- }
- else
- return false;
- }
- return true;
-}
-
-bool
-TeLayer::addPoints (TePointSet& pointSet)
-{
- if (!db_)
- return false;
-
- if (pointSet.size() > 0)
- {
- if (!this->hasGeometry(TePOINTS))
- this->addGeometry(TePOINTS);
- string tblName = tableName(TePOINTS);
-
- TeRepresentation* rep = getRepresentation(TePOINTS);
- if (rep)
- {
- if (!db_->insertPointSet (rep->tableName_, pointSet))
- return false;
- updateLayerBox(pointSet.box());
- updateBox(rep->box_,pointSet.box());
- if (!db_->updateRepresentation(id_,*rep))
- return false;
- }
- else
- return false;
- }
- return true;
-}
-
-bool
-TeLayer::addText (TeTextSet& textSet, const string& tName)
-{
- if (!db_)
- return false;
-
- TeRepresentation* rep =0;
- string tabName;
- if (tName.empty())
- {
- int i=0;
- string name;
- do
- {
- name = "Text_" + Te2String(id_) + "_" + Te2String(i);
- rep = getRepresentation(TeTEXT,name);
- ++i;
- }
- while (rep);
- tabName = name;
- }
- else
- tabName = tName;
-
- if (textSet.size() > 0 )
- {
- rep = getRepresentation(TeTEXT,tabName);
- if (!rep)
- {
- this->addGeometry(TeTEXT,tabName);
- rep = getRepresentation(TeTEXT,tabName);
- }
- if (rep)
- {
- if (!db_->insertTextSet (tabName, textSet))
- return false;
- updateLayerBox(textSet.box());
- updateBox(rep->box_,textSet.box());
- if (!db_->updateRepresentation(id_,*rep))
- return false;
- }
- else
- return false;
- }
- return true;
-}
-
-bool
-TeLayer::addCells(TeCellSet& cellSet)
-{
- if (!db_)
- return false;
-
- if (cellSet.size() > 0)
- {
- string tblName = tableName(TeCELLS);
- if (!this->hasGeometry(TeCELLS))
- this->addGeometry(TeCELLS);
-
- TeRepresentation* rep = getRepresentation(TeCELLS);
- if (rep)
- {
- rep->resX_ = cellSet.resX();
- rep->resY_ = cellSet.resY();
- if (!db_->insertCellSet(tableName(TeCELLS), cellSet))
- return false;
- updateLayerBox(cellSet.box());
- updateBox(rep->box_,cellSet.box());
- if (!db_->updateRepresentation(id_,*rep))
- return false;
- }
- else
- return false;
- }
- return true;
-}
-
-
-bool
-TeLayer::saveAttributeTable(TeTable& table)
-{
- if (!db_ || id_ <= 0)
- return false;
- if (!db_->tableExist(table.name()))
- {
- if (!db_->createTable(table.name(), table.attributeList()))
- return false;
- }
- if (db_->insertTable (table))
- {
- if (table.id() <= 0)
- return db_->insertTableInfo(id_,table);
- else
- return true;
- }
- return false;
-}
-
-bool
-TeLayer::getPolygons(TePolygonSet &ps, const string& whereClause)
-{
- if (!hasGeometry(TePOLYGONS))
- return false;
- return db_->selectPolygonSet(tableName(TePOLYGONS), whereClause, ps);
-}
-
-bool
-TeLayer::getLines(TeLineSet &ls, const string& whereClause)
-{
- if (!hasGeometry(TeLINES))
- return false;
- return db_->selectLineSet(tableName(TeLINES), whereClause, ls);
-}
-
-bool
-TeLayer::getPoints(TePointSet &ps, const string& whereClause)
-{
- if (!hasGeometry(TePOINTS))
- return false;
- return db_->selectPointSet(tableName(TePOINTS), whereClause, ps);
-}
-
-bool
-TeLayer::getText(TeTextSet &ts, const string& whereClause)
-{
- if (!hasGeometry(TeTEXT))
- return false;
- return db_->selectTextSet(tableName(TeTEXT), whereClause, ts);
-}
-
-bool
-TeLayer::getCells(TeCellSet &cs, const string& whereClause)
-{
- if (!hasGeometry(TeCELLS))
- return false;
- return db_->selectCellSet(id_, tableName(TeCELLS), whereClause, cs);
-}
-
-bool
-TeLayer::locatePolygon (TeCoord2D &pt, TePolygon &polygon, const double& tol)
-{
- if (!hasGeometry(TePOLYGONS))
- return false;
- return db_->locatePolygon(tableName(TePOLYGONS),pt, polygon, tol);
-}
-
-bool
-TeLayer::locateLine (TeCoord2D &pt, TeLine2D &line, const double& tol)
-{
- if (!hasGeometry(TeLINES))
- return false;
- return db_->locateLine(tableName(TeLINES),pt, line, tol);
-}
-
-bool
-TeLayer::locatePoint (TeCoord2D &pt, TePoint &point, const double& tol)
-{
- if (!hasGeometry(TePOINTS))
- return false;
- return db_->locatePoint(tableName(TePOINTS), pt, point, tol);
-}
-
-bool
-TeLayer::locateText(TeCoord2D &pt, TeText &text, const double& tol)
-{
- if (!hasGeometry(TeTEXT))
- return false;
- return db_->locateText(tableName(TeTEXT), pt, text, tol);
-}
-
-bool
-TeLayer::locateCell (TeCoord2D &pt, TeCell &cell, const double& tol)
-{
- if (!hasGeometry(TeCELLS))
- return false;
- return db_->locateCell(tableName(TeCELLS), pt, cell, tol);
-}
-
-bool
-TeLayer::loadGeometrySet(const string& geoid, TePolygonSet &ps)
-{
- if (!hasGeometry(TePOLYGONS))
- return false;
- return db_->loadPolygonSet(tableName(TePOLYGONS), geoid, ps);
-}
-
-bool
-TeLayer::loadGeometrySet (const string& geoid, TeLineSet &ls)
-{
- if (!hasGeometry(TeLINES))
- return false;
- return db_->loadLineSet(tableName(TeLINES), geoid, ls);;
-}
-
-bool
-TeLayer::loadGeometrySet (const string& geoid, TePointSet &ps)
-{
- if (!hasGeometry(TePOINTS))
- return false;
- return db_->loadPointSet(tableName(TePOINTS), geoid, ps);
-}
-
-bool
-TeLayer::loadGeometrySet (const string& geoid, TeCellSet &cs)
-{
- if (!hasGeometry(TeCELLS))
- return false;
- return db_->loadCellSet(id_, tableName(TeCELLS), geoid, cs);
-}
-
-bool
-TeLayer::loadGeometrySet (const string& geoid, TeTextSet &ts)
-{
- if (!hasGeometry(TeTEXT))
- return false;
- return db_->loadTextSet(tableName(TeTEXT), geoid, ts);
-}
-
-string
-TeLayer::mediaTable()
-{
- TeAttrTableVector attrs;
- getAttrTables(attrs, TeAttrMedia);
-
- if(attrs.size()<1)
- return "";
-
- return (attrs[0].name());
-}
-
-void
-TeLayer::mediaTable(const string& name)
-{
- TeAttributeList attList;
- TeTable table(name, attList,"object_id", "object_id", TeAttrMedia);
- attTables_.push_back (table);
-}
diff --git a/src/terralib/kernel/TeLayer.h b/src/terralib/kernel/TeLayer.h
deleted file mode 100644
index eac284a..0000000
--- a/src/terralib/kernel/TeLayer.h
+++ /dev/null
@@ -1,432 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeLayer.h
- \brief This file contains structures and definitions to deal with a layer
-*/
-#ifndef __TERRALIB_INTERNAL_LAYER_H
-#define __TERRALIB_INTERNAL_LAYER_H
-
-#include "TeGeometry.h"
-#include "TeDataTypes.h"
-#include "TeTable.h"
-#include "TeRepresentation.h"
-
-#include <string>
-#include <list>
-#include <map>
-
-class TeRaster;
-class TeDatabase;
-class TeRasterParams;
-class TeProjection;
-
-//! A class for supporting a layer.
-/*!
- In TerraLib, a layer is a collection of geometries that share the same
- geographical projection, and are related in some way (e.g. a shapefile).
- A layer has a pointer to a database that effectively stores its atributes
- and geometries.
-
- \sa
- TeGeometry, TeProjection, TeBox, TeDatabase, TeTheme, TeTable
-*/
-class TL_DLL TeLayer {
-
-public:
-
- //! Empty constructor
- TeLayer():
- id_(-1),
- db_(0),
- projection_ ( 0 ),
- raster_(0)
- { }
-
-
- //! Constructor with parameters
- /*
- \param name layer name (should be unique)
- \param db a TerraLib database connection w
- \param proj layer projection
- \note
- \par If no database is informed, layer will exist only in memory.
- \par If a layer with this name doesnt exist a layer will be
- created and stored. If no projection is informed a default TeNoProjection
- will be used as layer projection.
- \par If a layer with this name already exists it will be retrieved
- */
- TeLayer(const string& name, TeDatabase* db=0, TeProjection* proj=0);
-
- //! Constructor with parameters
- /*
- \param name layer name (should be unique)
- \param db TerraLib database connection where layer will be stored
- \param box layer bounding box
- \param proj layer projection
- \note
- \par If no database is informed, layer will exist only in memory.
- \par If a layer with this name doesnt exist a layer will be
- created and stored. If no projection is informed a default TeNoProjection
- will be used as layer projection.
- \par If a layer with this name already exists it will be retrieved
- */
- TeLayer(const string& name, TeDatabase* db, TeBox& box, TeProjection* proj = 0);
-
- //! Destructor
- virtual ~TeLayer();
-
- //! Copy Constructor
- TeLayer ( const TeLayer& other );
-
- //! Operator =
- TeLayer& operator= ( const TeLayer& other );
-
- //! Retrieves the database associated to this layer
- virtual TeDatabase* const database()
- { return db_; }
-
- //! Sets the layer database
- virtual void setDatabase(TeDatabase* db)
- { db_ = db; }
-
- //! Returns the layer id
- virtual int id()
- { return id_; }
-
- //! Sets the layer id
- virtual void id(int id)
- { id_ = id; }
-
- //! Returns the layer name
- virtual string name()
- { return name_; }
-
- //! Sets the layer name
- virtual void name(const string &name)
- { name_ = name; }
-
- //! Sets the layer projection
- virtual void setProjection ( TeProjection* proj );
-
- //! Retrieves the layer projection
- virtual TeProjection* projection()
- { return projection_; }
-
- //! Returns the layer bounding box
- virtual TeBox& box()
- { return box_; }
-
- //! Sets the bounding box of a layer
- virtual void setLayerBox ( const TeBox& box );
-
- //! Updates the bounding box of a layer
- virtual void updateLayerBox(const TeBox& box);
-
- //! Refreshes the bounding box of a layer according to its representation
- virtual void updateLayerBox();
-
- //! Returns a possible new object id based on the objects stored in database
- virtual int getNewObjectId();
-
- /** @name Attribute Tables
- * Methods to deal with the attribute tables of the layer
- */
- //@{
-
- //! Returns the number of distinct objects in the layer
- virtual int nObjects(const string& tName);
-
- //! Returns a vector with the definition of all attribute tables associated to layer
- virtual TeAttrTableVector& attrTables ()
- { return attTables_; }
-
- //! Creates a new attribute table for the layer
- virtual bool createAttributeTable(TeTable& table);
-
- //! Adds an attribute table definition to layer vector of attribute tables (in memory)
- virtual bool addAttributeTable(TeTable& table);
-
- //! Remove an attribute table definition to layer vector of attribute tables (in memory)
- virtual bool removeAttributeTable(string tableName);
-
- //! Update an attribute table definition to layer vector of attribute tables (in memory)
- virtual void updateAttributeTable(TeTable& table);
-
- //! Reload the tables definition from database to memory
- virtual bool loadLayerTables();
-
- //! Saves an attribute table into the database where layer is stored
- virtual bool saveAttributeTable(TeTable& table);
-
- //! Gets all attribute tables associated to this layer that are of a certain type
- virtual bool getAttrTables(TeAttrTableVector& atts, TeAttrTableType attType = TeAllAttrTypes);
-
- //! Gets a set of attribute table specifications associated to this layer that are of a certain type
- /*
- \param tableNames a vector that contains the name of the tables that are being searched
- \param attType type of table that is being searched
- \param atts returns a vector of tables found
- \return true if at least one table was found and false otherwise
- */
- virtual bool getAttrTablesByName(vector<string> &tableNames, TeAttrTableVector& atts, TeAttrTableType attType = TeAllAttrTypes);
-
- //! Gets an attribute table associated to a layer
- /*
- \param tableName name of the table being searched
- \param attType type of table being searched
- \param table returns the table found
- \return true if table was found and false otherwise
- */
- virtual bool getAttrTablesByName(const string& tableName, TeTable& table, TeAttrTableType attType = TeAllAttrTypes);
-
- //! Gets the name of the media table associated to layer
- virtual string mediaTable();
-
- //! Sets the name of the media table associated to layer
- virtual void mediaTable(const string& name);
- //@}
-
- /** @name Geometries
- * Methods to deal with the geometries of the objects of a layer
- */
- //! Returns a pointer to the raster geometry associated to an object of this layer
- /*!
- \param objectId unique identification of the object (if empty it will look
- for the first raster geometry found)
- \param mode permission access ('r', 'w')
- */
- virtual TeRaster* raster(const string& objectId="",const char& mode = 'r');
-
- //! Sets the pointer to the raster representation
- virtual void raster( TeRaster* raster);
-
- //! Retrieves a polygon set given a selection criteria, expressed as a where clause
- virtual bool getPolygons(TePolygonSet &ps, const string& whereClause = "");
-
- //! Retrieves a line set given a selection criteria, expressed as a where clause
- virtual bool getLines(TeLineSet &ls, const string& whereClause = "");
-
- //! Retrieves a point set given a selection criteria, expressed as a where clause
- virtual bool getPoints(TePointSet &ps, const string& whereClause = "");
-
- //! Retrieve a point set given a selection criteria, expressed as a where clause
- virtual bool getText(TeTextSet &ts, const string& whereClause = "");
-
- //! Retrieve a cell set given a selection criteria, expressed as a where clause
- virtual bool getCells(TeCellSet &cs, const string& whereClause = "");
-
- //! Locates a polygon that cointains a certain coordinate
- virtual bool locatePolygon(TeCoord2D &pt, TePolygon &polygon, const double& tol = 0.0);
-
- //! Locates a line that cointains a certain coordinate
- virtual bool locateLine(TeCoord2D &pt, TeLine2D &line, const double& tol = 0.0);
-
- //! Retrieves a point that cointains a certain coordinate
- virtual bool locatePoint(TeCoord2D &pt, TePoint &point, const double& tol = 0.0);
-
- //! Retrieves a TeText that cointains a certain coordinate
- virtual bool locateText(TeCoord2D &pt, TeText &text, const double& tol = 0.0);
-
- //! Retrieves a point that cointains a certain coordinate
- virtual bool locateCell(TeCoord2D &pt, TeCell &cell, const double& tol = 0.0);
-
- //! Retrieves the set of polygons with a certain geoid
- virtual bool loadGeometrySet (const string& geoid, TePolygonSet &ps);
-
- //! Retrieves the set of lines with a certain geoid
- virtual bool loadGeometrySet (const string& geoid, TeLineSet &ls);
-
- //! Retrieves the set of points with a certain geoid
- virtual bool loadGeometrySet (const string& geoid, TePointSet &ps);
-
- //! Retrieves the set of points with a certain geoid
- virtual bool loadGeometrySet (const string& geoid, TeCellSet &cs);
-
- //! Retrieves the set of texts with a certain geoid
- virtual bool loadGeometrySet (const string& geoid, TeTextSet &cs);
-
- //! Adds a set of polygons to a layer
- virtual bool addGeometrySet(TePolygonSet& polySet, const string& /* tName */ = "")
- { return addPolygons(polySet); }
-
- //! Adds a set of lines to a layer
- virtual bool addGeometrySet(TeLineSet& lineSet, const string& /* tName */ = "")
- { return addLines(lineSet); }
-
- //! Adds a set of points to a layer
- virtual bool addGeometrySet(TePointSet& pointSet, const string& /* tName */ = "")
- { return addPoints(pointSet); }
-
- //! Adds a set of text to a layer
- virtual bool addGeometrySet(TeTextSet& textSet, const string& tName = "")
- { return addText(textSet,tName); }
-
- //! Adds a set of cells to a layer
- virtual bool addGeometrySet(TeCellSet& cellSet, const string& /* tName */ = "")
- { return addCells(cellSet); }
-
- //! Adds a set of polygons to a layer
- virtual bool addPolygons(TePolygonSet& polySet);
-
- //! Adds a set of lines to a layer
- virtual bool addLines (TeLineSet& lineSet);
-
- //! Adds a set of points to a layer
- virtual bool addPoints (TePointSet& pointSet);
-
- //! Adds a set of text to a layer
- virtual bool addText (TeTextSet& textSet,const string& tName);
-
- //! Adds a set of cells to a layer
- virtual bool addCells(TeCellSet& cellSet);
-
- //@}
-
- /** @name Geometries
- * Methods to deal with geometrical representations of a layer
- */
- //! Removes a geometry from layer
- virtual bool removeGeometry (TeGeomRep repType, const string& tName="");
-
- //! Indicates if layer has a geometry representation
- virtual bool hasGeometry (TeGeomRep rep);
-
- //! Retrieves the table name associated to a geometry representation
- /*! \param rep geometrical representation
- \note When there is more than one representation of a given type
- returns the table name associated to the first one encountered
- */
- virtual string tableName(TeGeomRep rep);
-
- //! Retrieves the number of geometries of a type
- /*!
- \param rep geometrical representation
- */
- virtual int nGeometries(TeGeomRep rep);
-
- //! Gets all information about a representation
- virtual bool getRepresentation(TeGeomRep repType, TeRepresPointerVector& result);
-
- //! Gets an specific representation
- /*!
- \param repType the geometrical representation being searched
- \param tableName the table associated to this representation
- \return the representation associated to a geometry with the given table name
- \note if no table name is specified the first found is returned
- */
- virtual TeRepresentation* getRepresentation(TeGeomRep repType, const string& tableName="");
-
- //! Creates a new geometry representation to a layer
- /*
- \param repType the geometrical representation being searched
- \param tableName name of the table that will stored the geometries
- \param desc description of the representation
- \return true if success and false otherwise
- */
- virtual bool addGeometry ( TeGeomRep repType, const string& tableName="", const string& desc = "");
-
- //! Creates a new raster geometry to a layer
- /*
- \param par raster parameters
- \param objectId identifier of the object that has the raster geometry
- \param tableName name of the table that will stored the geometries
- \param desc description of the representation
- \return true if success and false otherwise
- */
- virtual bool addRasterGeometry(TeRasterParams& par, const string& objectId,
- const string& tableName="", const string& desc="");
-
- //! Inserts a raster as a geometry of an object of the layer
- /*
- \param raster a pointer to a raster object
- \param objectId identifier of the object that has the raster geometry
- \param tableName the name of the table that will store the geometry (optional)
- \return true if success and false otherwise
- \note if there is already raster geometry associated to the object with id
- object id, this reference is deleted.
- */
- bool addRasterGeometry(TeRaster* raster, const string& objectId="");
-
- //! Inserts a reference to a raster file as a raster geometry of an object of the layer
- /*
- \param raster a pointer to a raster object
- \param objectId identifier of the object that has the raster geometry
- \param desc the description of the geometry (optional)
- \return true if success and false otherwise
- \note if there is already raster geometry associated to the object with id
- object id, this reference is deleted.
- */
- bool addRasterFileGeometry(TeRaster* raster, const string& objectId="", const string& desc="");
-
-
- //! Returns a vector with the identification of all objects of the layer that has a raster representation
- /*
- \param objectIds a vector to return the identification of the objects with a raster representation
- \param tilingType used to express that only some types of representations are looked for:
- 0 any kind, 1 only the expansible and 2 only the non-expansible
- \return true if layer has at least one raster object and false otherwise
- */
- virtual bool getRasterGeometries(vector<string>& objectIds, unsigned int tilingType=0);
-
- //! Returns a combination of all representations in the layer
- virtual int geomRep();
-
- //! Adds a representation to vector of representation of the layer
- virtual void addVectRepres(TeRepresentation* rep)
- { repVector_.push_back(rep); }
-
- //! Returns a vector with all representations in the layer
- virtual TeRepresPointerVector& vectRepres()
- { return repVector_; }
-
- //@}
-
-private:
-
-// -- Members
-
-// -- General Description of a layer
-
- string name_; //!< layer name
- int id_; //!< layer unique identification
- TeDatabase* db_; //!< database connection to this layer
- TeProjection* projection_; //!< layer projection
- TeBox box_; //!< layer bounding box
- TeRaster* raster_; //!< layer raster representation
-
- TeAttrTableVector attTables_; //!< Attributes associated to a layer
- TeRepresPointerVector repVector_; //!< vector of representations associated to this layer
-};
-
-//! A map from a integer unique identifier to a pointer to layer
-typedef map<int,TeLayer*> TeLayerMap;
-
-/** \example createLayer.cpp
- Shows how to create a layer in a TerraLib database, and insert some vectorial data in this new layer
- */
-
-/** \example addGeomRepresentation.cpp
- Shows how to create a point representation (centroid of polygons) to a layer in a TerraLib database.
- */
-#endif
-
diff --git a/src/terralib/kernel/TeLegendEntry.cpp b/src/terralib/kernel/TeLegendEntry.cpp
deleted file mode 100644
index 9a4ce1f..0000000
--- a/src/terralib/kernel/TeLegendEntry.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-#include <TeLegendEntry.h>
-
-TeLegendEntry::TeLegendEntry(const TeSlice& slice) :
- slice_(slice),
- id_(-1),
- theme_(0),
- group_(0)
-{
- if (slice_.from_ == "Missing Data")
- label_ = "Missing Data";
- else
- {
- int i = slice_.from_.find("mean = ");
- if (i >= 0 || slice_.to_.empty())
- label_ = slice_.from_;
- else
- label_ = slice_.from_ + " ~ " + slice_.to_;
- }
-}
-
-
-TeLegendEntry::TeLegendEntry (const TeLegendEntry& leg)
-{
- *this = leg;
-}
-
-TeLegendEntry&
-TeLegendEntry::operator = (const TeLegendEntry& leg)
-{
- if ( this != &leg )
- { //clears the current map
- TeGeomRepVisualMap::iterator currMapIt = visualMap_.begin();
- while( currMapIt != visualMap_.end() )
- {
- if (currMapIt->second)
- {
- delete currMapIt->second;
- currMapIt->second = NULL;
- }
- ++currMapIt;
- }
- visualMap_.clear();
-
- //copy the new map
- TeGeomRepVisualMap::const_iterator it = leg.visualMap_.begin();
- while( it != leg.visualMap_.end() )
- {
- if (it->second)
- {
- TeVisual* visual = it->second->copy();
- visualMap_[ it->first ] = visual;
- }
- ++it;
- }
- slice_ = leg.slice_;
- label_ = leg.label_;
- id_ = leg.id_;
- theme_ = leg.theme_;
- group_ = leg.group_;
- }
- return *this;
-}
-
-void
-TeLegendEntry::clear()
-{
- slice_.from_.clear();
- slice_.to_.clear();
- label_.clear();
-
- //clears the current map
- TeGeomRepVisualMap::iterator currMapIt = visualMap_.begin();
- while( currMapIt != visualMap_.end() )
- {
- if (currMapIt->second)
- {
- delete currMapIt->second;
- currMapIt->second = NULL;
- }
- ++currMapIt;
- }
- visualMap_.clear();
-}
-
-string
-TeLegendEntry::label()
-{
- if (label_.empty())
- {
- int npos = slice_.from_.find("mean = ");
- if (npos >= 0 || slice_.to_.empty())
- label_ = slice_.from_;
- else
- label_ = slice_.from_ + " ~ " + slice_.to_;
- }
- return label_;
-}
-
-TeVisual*
-TeLegendEntry::visual(TeGeomRep rep, const string& visualType)
-{
- if(visualMap_.find(rep) == visualMap_.end())
- {
- TeVisual* visual = TeVisualFactory::make(visualType);
- visualMap_[rep] = visual;
- }
- return visualMap_[rep];
-}
-
-void
-TeLegendEntry::color( TeColor& color )
-{
- if(visualMap_.find(TePOLYGONS) != visualMap_.end())
- {
- TeVisual* tmpVisual = visualMap_[TePOLYGONS];
- if (tmpVisual)
- {
- tmpVisual->color( color );
- if ( tmpVisual->style() != 1 )
- tmpVisual->contourColor( color );
- }
- }
- if(visualMap_.find(TeLINES) != visualMap_.end())
- {
- TeVisual* tmpVisual = visualMap_[TeLINES];
- if (tmpVisual)
- tmpVisual->color( color );
- }
- if(visualMap_.find(TePOINTS) != visualMap_.end())
- {
- TeVisual* tmpVisual = visualMap_[TePOINTS];
- if (tmpVisual)
- tmpVisual->color( color );
- }
-}
-
-void
-TeLegendEntry::setVisual(TeVisual* vis, TeGeomRep rep)
-{
- if ( visualMap_.find(rep) != visualMap_.end() )
- {
- if ((visualMap_[rep] != NULL) && (visualMap_[rep] != vis))
- delete visualMap_[rep];
- }
- visualMap_[rep] = vis;
-}
-
-void
-TeLegendEntry::setVisual(TeVisual& vis, TeGeomRep rep)
-{
- return (setVisual(vis.copy(), rep));
-}
diff --git a/src/terralib/kernel/TeLegendEntry.h b/src/terralib/kernel/TeLegendEntry.h
deleted file mode 100644
index 3ffb0e4..0000000
--- a/src/terralib/kernel/TeLegendEntry.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeLegendEntry.h
- \brief This file deals with legends in TerraLib
-*/
-#ifndef __TERRALIB_INTERNAL_LEGENDENTRY_H
-#define __TERRALIB_INTERNAL_LEGENDENTRY_H
-
-#include <string>
-#include <vector>
-#include <map>
-
-using namespace std;
-
-#include "TeUtils.h"
-#include "TeDataTypes.h"
-#include "TeSlice.h"
-#include "TeVisual.h"
-
-class TeTheme;
-struct TeColor;
-
-//! A map from representation types to a presentation visual characteristics
-typedef map<TeGeomRep,TeVisual*> TeGeomRepVisualMap;
-
-
-//! A Legend Entry represents a group of objects of a theme
-/*!
- A legend entry is associated to a group of a theme. It has a label and a TeSlice
- that defines a property of of the objects that fall into this legend.
- A legend entry has an associated label and the visual presentation characteristics
- of the objects that fall into this legend.
-*/
-class TL_DLL TeLegendEntry
-{
-public:
-
- //! Empty constructor
- TeLegendEntry () :
- label_(""),
- id_(-1),
- theme_(0),
- group_(0)
- {}
-
- //! Constructor from a slice
- TeLegendEntry (const TeSlice& slice);
-
- //! Copy constructor
- TeLegendEntry (const TeLegendEntry& leg);
-
- //! Operator =
- TeLegendEntry& operator = (const TeLegendEntry& leg);
-
- //! Destructor
- virtual ~TeLegendEntry()
- { clear(); }
-
- //! Clear the legend
- void clear();
-
- //! Returns the legend id
- int id ()
- { return id_; }
- //! Sets the legend id
- void id (int i) { id_ = i; }
-
- //! Returns the theme identifier to which the legend belongs
- int theme () { return theme_; }
- //! Sets the theme id to which this legend belongs to
- void theme (int i) { theme_ = i; }
-
- //! Returns the group identifier associated to the legend
- int group () { return group_; }
- //! Sets the group identification to which this legend refers to
- void group (int i) { group_ = i; }
-
- //! Returns the visual presentation characteristics associated to a given representation
- TeVisual* visual (TeGeomRep rep, const string& visualType="tevisual");
-
- //! Sets the visual presentation characteristics associated to a given representation
- void setVisual (TeVisual* vis, TeGeomRep rep);
-
- //! Sets the visual presentation characteristics associated to a given representation
- void setVisual (TeVisual& vis, TeGeomRep rep);
-
- //! Return the visual presentation characteristics map
- TeGeomRepVisualMap& getVisualMap()
- { return visualMap_; }
-
- //! Returns the slice associated to this legend
- TeSlice& slice()
- { return slice_; }
- // Sets the slice associated to this legend
- void setSlice(const TeSlice& sl)
- { slice_ = sl; }
- //! Returns the number of objects of the legend
- int count()
- { return slice_.count_; }
- //! Sets the number of objects with the legend
- void count(int n)
- { slice_.count_ = n; }
- //! Increase the number of objects with the legend
- void incCount(int n=1)
- { slice_.count_ += n; }
-
- //! Returns the lower value associated to the legend
- string from()
- { return slice_.from_; }
- //! Sets the lower value associated to the legend
- void from(string& s)
- { slice_.from_ = s; }
-
- //! Returns the upper value associated to the legend
- string to()
- { return slice_.to_; }
- //! Sets the upper value associated to the legend
- void to(string& s)
- { slice_.to_ = s; }
-
- //! Returns the label associated to the legend
- string label();
-
- //! Sets the label associated to the legend
- void label(string& s)
- { label_ = s; }
-
- //! Sets the color associated to the legend
- void color(TeColor& color);
-
-private:
-
- TeGeomRepVisualMap visualMap_;
- TeSlice slice_;
- string label_;
- int id_;
- int theme_;
- int group_;
-};
-
-//! A vector of legendy entries
-typedef vector<TeLegendEntry> TeLegendEntryVector;
-
-//! A map of legend identifiers to legend entrie pointers
-typedef map<int, TeLegendEntry*> TeLegendEntryMap;
-
-#endif
-
diff --git a/src/terralib/kernel/TeMappedMemory.cpp b/src/terralib/kernel/TeMappedMemory.cpp
deleted file mode 100644
index 987f285..0000000
--- a/src/terralib/kernel/TeMappedMemory.cpp
+++ /dev/null
@@ -1,415 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeMappedMemory.h"
-#include "TeException.h"
-#include "TeErrorLog.h"
-#include "TeUtils.h"
-#include "TeAgnostic.h"
-#include "TeDefines.h"
-
-#if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- #include <io.h>
- #include <fcntl.h>
- #include <sys/stat.h>
-#elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
-#else
- #error "Unsupported platform"
-#endif
-
-
-void TeMappedMemory::init()
-{
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- m_hFile_ = 0;
- m_hMapping_ = 0;
- m_lpszFile_ = 0;
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- m_hFile_ = 0;
- m_lpszFile_ = 0;
- #else
- #error "Unsupported platform"
- #endif
-
- mapping_is_active_ = false;
- curr_size_ = 0;
- must_delete_file_ = false;
-};
-
-
-TeMappedMemory::TeMappedMemory()
-{
- init();
-}
-
-
-TeMappedMemory::~TeMappedMemory()
-{
- reset();
-}
-
-
-void TeMappedMemory::reset()
-{
- TEAGN_TRUE_OR_THROW( toggle( false ), "Error disabling mapped memory" );
-
- if( must_delete_file_ ) {
- remove( disk_file_name_.c_str() );
- }
-
- disk_file_name_.clear();
-
- init();
-}
-
-
-bool TeMappedMemory::reset( unsigned long int size, bool enabled )
-{
- reset();
-
- std::string disk_file_name;
-
- TEAGN_TRUE_OR_RETURN( TeGetTempFileName( disk_file_name ),
- "Unable to get temporary file name" );
-
- return( reset( disk_file_name, size, false, enabled ) );
-}
-
-
-bool TeMappedMemory::reset( const std::string& filename,
- unsigned long int size, bool keep_disk_file, bool enabled )
-{
- reset();
-
- if( filename.empty() || ( size == 0 ) ) {
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE,
- "Invalid mapped file name or invalid file size" );
-
- return false;
- } else {
- TEAGN_TRUE_OR_RETURN( createNewDiskFile( filename, size ),
- "Unable to create memory mapped disk file" );
-
- disk_file_name_ = filename;
- must_delete_file_ = ( ! keep_disk_file );
-
- if( toggle( enabled ) ) {
- return true;
- } else {
- reset();
- return false;
- }
- }
-}
-
-
-bool TeMappedMemory::reset( const std::string& filename, bool enabled )
-{
- reset();
-
- disk_file_name_ = filename;
-
- if( toggle( enabled ) ) {
- return true;
- } else {
- reset();
- return false;
- }
-}
-
-
-bool TeMappedMemory::toggle( bool enabled )
-{
- if( enabled ) {
- if( mapping_is_active_ ) {
- return true;
- } else {
- curr_size_ = 0;
-
- /* Activating mapping */
-
- if( ! TeCheckFileExistence( disk_file_name_.c_str() ) ) {
- return false;
- }
-
- unsigned long int filesize = TeGetFileSize( disk_file_name_ );
-
- if( filesize > 0 ) {
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- HANDLE m_hFile = CreateFileA(
- disk_file_name_.c_str(), GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
- 0, NULL);
-
- if( m_hFile == INVALID_HANDLE_VALUE ) {
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE,
- "Temporary file creation error" );
-
- return false;
- }
-
- HANDLE m_hMapping = CreateFileMapping( m_hFile, NULL, PAGE_READWRITE,
- 0, 0, NULL );
-
- if( m_hMapping == NULL ) {
- CloseHandle(m_hFile);
-
- TEAGN_LOGERR( "Mapping creation error - " +
- getLastErrorStr() );
-
- return false;
- }
-
- LPVOID m_lpszFile = (LPVOID) MapViewOfFile( m_hMapping,
- FILE_MAP_ALL_ACCESS, 0, 0, 0);
-
- if( m_lpszFile == 0 ) {
- CloseHandle( m_hMapping );
- CloseHandle( m_hFile );
-
- TEAGN_LOGERR( "Mapping view creation error - " +
- getLastErrorStr() );
-
- return false;
- }
-
- m_hFile_ = m_hFile;
- m_hMapping_ = m_hMapping;
- m_lpszFile_ = m_lpszFile;
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- int m_hFile = open( disk_file_name_.c_str(), O_RDWR );
-
- if( m_hFile == -1 ) {
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE,
- "Temporary file creation error" );
-
- return false;
- }
-
- void* m_lpszFile = mmap(0, (long)filesize, (PROT_READ | PROT_WRITE),
- MAP_SHARED, m_hFile, 0);
-
- if( m_lpszFile == ((void*)-1) ) {
- close( m_hFile );
-
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE,
- "Mapping creation error" );
-
- return false;
- }
-
- m_hFile_ = m_hFile;
- m_lpszFile_ = m_lpszFile;
- #else
- #error "Unsupported platform"
- #endif
-
- mapping_is_active_ = true;
- curr_size_ = filesize;
-
- return true;
- } else {
- return false;
- }
- }
- } else {
- if( mapping_is_active_ ) {
- /* Disabling mapping */
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- if( ! UnmapViewOfFile( m_lpszFile_ ) ) {
- throw TeException( UNKNOWN_ERROR_TYPE, "Unable to unmap disk file",
- false );
- }
-
- CloseHandle( m_hMapping_ );
- CloseHandle( m_hFile_ );
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- if( munmap( m_lpszFile_ , (long)curr_size_ ) == -1) {
- throw TeException( UNKNOWN_ERROR_TYPE, "Unable to unmap disk file",
- false );
- }
-
- close(m_hFile_);
- #else
- #error "Unsupported platform"
- #endif
-
- mapping_is_active_ = false;
- curr_size_ = 0;
- }
-
- return true;
- }
-}
-
-
-void* TeMappedMemory::getPointer() const
-{
- TEAGN_TRUE_OR_THROW( mapping_is_active_,
- "Trying to access an inactive mapping" );
-
- return m_lpszFile_;
-}
-
-
-std::string TeMappedMemory::getFileName() const
-{
- TEAGN_TRUE_OR_THROW( mapping_is_active_,
- "Trying to access an inactive mapping" );
-
- return disk_file_name_;
-}
-
-
-bool TeMappedMemory::createNewDiskFile( const std::string& filename,
- unsigned long int size ) const
-{
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- int m_hFile = open( filename.c_str(),_O_RDWR|_O_CREAT,
- _S_IREAD | _S_IWRITE);
-
- if( m_hFile == -1 ) {
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE,
- "Temporary file creation error" );
-
- return false;
- }
-
- off_t seek_off = ( off_t )( size - 1 );
-
- if( lseek(m_hFile, seek_off, SEEK_SET) == -1 ) {
- close( m_hFile );
-
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE,
- "Temporary file seek error" );
-
- return false;
- }
-
- unsigned char c = '\0';
-
-
- if( write( m_hFile, (void*)&c, sizeof( unsigned char ) ) == -1 ) {
- close( m_hFile );
-
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE,
- "Temporary file write error" );
-
- return false;
- }
-
- close( m_hFile );
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- int m_hFile = open( filename.c_str(),O_RDWR|O_CREAT,S_IRWXU);
-
- if( m_hFile == -1 ) {
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE,
- "Temporary file creation error" );
-
- return false;
- }
-
- off_t seek_off = ( off_t )( size - 1 );
-
- if( lseek(m_hFile, seek_off, SEEK_SET) == -1 ) {
- close( m_hFile );
-
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE,
- "Temporary file seek error" );
-
- return false;
- }
-
- unsigned char c = '\0';
-
-
- if( write( m_hFile, (void*)&c, sizeof( unsigned char ) ) == -1 ) {
- close( m_hFile );
-
- TeErrorLog::instance().insert( UNKNOWN_ERROR_TYPE,
- "Temporary file write error" );
-
- return false;
- }
-
- close( m_hFile );
- #else
- #error "Unsupported platform"
- #endif
-
- return true;
-}
-
-
-std::string TeMappedMemory::getLastErrorStr()
-{
- std::string error_string;
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- LPVOID lpMsgBuf = 0;
- DWORD dw = GetLastError();
- int written_chars_nmb = 0;
-
- written_chars_nmb = FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- dw,
- 0,
- (LPTSTR) &lpMsgBuf,
- 1024,
- NULL );
-
- if( written_chars_nmb > 0 ) {
- int str_size = MIN( 1024, 2 * written_chars_nmb );
- error_string = std::string( ( (char*)lpMsgBuf ), 1024 );
- }
-
- if( lpMsgBuf ) {
- LocalFree(lpMsgBuf);
- }
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- #else
- #error "Unsuported platform"
- #endif
-
- return error_string;
-}
-
-
-unsigned long int TeMappedMemory::size() const
-{
- return curr_size_;
-}
diff --git a/src/terralib/kernel/TeMappedMemory.h b/src/terralib/kernel/TeMappedMemory.h
deleted file mode 100644
index 6abfe24..0000000
--- a/src/terralib/kernel/TeMappedMemory.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeMappedMemory.h
- \brief This file deals with mapped memory resources
-*/
-
-#ifndef TEMAPPEDMEMORY_H
- #define TEMAPPEDMEMORY_H
-
- #include "TeSharedPtr.h"
- #include "TeDefines.h"
-
- #include <string>
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- #include <windows.h>
- #include <winbase.h>
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- #include <sys/mman.h>
- #else
- #error "ERROR: Unsupported platform"
- #endif
-
- /**
- * @brief This is class deals with mapped memory resources.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup Utils
- */
- class TL_DLL TeMappedMemory {
- public :
- typedef TeSharedPtr< TeMappedMemory > pointer;
- typedef const TeSharedPtr< TeMappedMemory > const_pointer;
-
- /**
- * @brief Default Constructor.
- */
- TeMappedMemory();
-
- /**
- * @brief Default Destructor.
- */
- ~TeMappedMemory();
-
- /**
- * @brief Reset the current instance (free all allocated resources).
- */
- void reset();
-
- /**
- * @brief Reset the current instance to new size.
- * @note The mapped memory file will be automatically created.
- * @param size The new mapped memory size (bytes).
- * @param enabled Mapping enabled/disabled state.
- * @return true if OK. false on errors.
- */
- bool reset( unsigned long int size, bool enabled );
-
- /**
- * @brief Reset the current instance using a new created disk file.
- *
- * @note The mapped memory size will follow the disk file size.
- *
- * @param filename The mapped memory disk file name.
- * @param size The new mapped memory size (bytes).
- * @param keep_disk_file if true, the file will not be deleted.
- * @param enabled Mapping enabled/disabled state.
- * @return true if OK. false on errors.
- */
- bool reset( const std::string& filename, unsigned long int size,
- bool keep_disk_file, bool enabled );
-
- /**
- * @brief Reset the current instance using an exising disk file.
- * @note The mapped memory size will follow the disk file size.
- * @param filename The mapped memory disk file name.
- * @param enabled Mapping enabled/disabled state.
- * @return true if OK. false on errors.
- */
- bool reset( const std::string& filename, bool enabled );
-
- /**
- * @brief Enable / disable the current mapping instance.
- *
- * @return true if OK. false on errors.
- */
- bool toggle( bool enabled );
-
- /**
- * @brief Returns a pointer reference to the mapped memory.
- *
- * @note Throws an exception if no mapped memory is active.
- */
- void* getPointer() const;
-
- /**
- * @brief Returns the current mapped file name.
- * @return The current mapped file name.
- * @note Throws an exception if no mapped memory is active.
- */
- std::string getFileName() const;
-
- /**
- * @brief The current allocated mapped memory size (bytes).
- *
- * @return The current allocated mapped memory size (bytes).
- */
- unsigned long int size() const;
-
- protected :
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- /**
- * @brief Handle to file we're currently zapping
- */
- HANDLE m_hFile_;
-
- /**
- * @brief Handle to memory-mapping of that file
- */
- HANDLE m_hMapping_;
-
- /**
- * @brief Pointer to mapped to memory
- */
- LPVOID m_lpszFile_;
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- /**
- * @brief Handle to file we're currently zapping
- */
- int m_hFile_;
-
- /**
- * @brief Pointer to mapped to memory
- */
- void* m_lpszFile_;
-
- #else
- #error "Unsuported platform"
- #endif
-
- /**
- * @brief A flag indicating when this map is active.
- * @note Default value : false.
- */
- bool mapping_is_active_;
-
- /**
- * @brief The disk file name.
- * @note Default value : empty string.
- *
- */
- std::string disk_file_name_;
-
- /**
- * @brief The current mapped memory size.
- * @note Default value : 0.
- */
- unsigned long int curr_size_;
-
- /**
- * @brief True if the mapped file must be deleted.
- * @note Default value : false.
- */
- bool must_delete_file_;
-
- /**
- * @brief Initiates the global initial state.
- *
- */
- void init();
-
- /**
- * @brief Create a new disk file suitable for memory mapping.
- * @param filename The file name.
- * @param size The file size.
- * @return true if OK. false on errors.
- */
- bool createNewDiskFile( const std::string& filename,
- unsigned long int size ) const;
-
- /**
- * @brief Generate the last error string.
- * @return The last error string.
- */
- std::string getLastErrorStr();
-
- private :
-
- /**
- * @brief Alternative Constructor.
- *
- */
- TeMappedMemory( const TeMappedMemory& ) {};
-
- /**
- * @brief Operator= overload.
- *
- */
- const TeMappedMemory& operator=( const TeMappedMemory& )
- {
- return *this;
- };
- };
-
-/** @example TeMappedMemory_test.cpp
- * Shows how to use this class.
- */
-
-#endif
diff --git a/src/terralib/kernel/TeMatrix.cpp b/src/terralib/kernel/TeMatrix.cpp
deleted file mode 100644
index 9ddd11f..0000000
--- a/src/terralib/kernel/TeMatrix.cpp
+++ /dev/null
@@ -1,1540 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
- // TeMatrix.c -- matrix of type double
-
-#include <TeMatrix.h>
-
-#include <TeAgnostic.h>
-
-#include <math.h>
-#include <stdio.h>
-
-
-TeMatrix::TeMatrix(){
- nrow = 0;
- ncol = 0;
- mat = NULL;
- lixo = 0.;
-}
-
-void
-TeMatrix::Clear()
-{
- if( mat != NULL ){
- int i;
- for( i = 0; i < nrow; i++ )
- if( mat[i] != NULL )
- {
- delete []mat[i];
- mat[i]=NULL;
- }
- delete []mat;
- mat = NULL;
- }
- nrow = ncol = 0;
- lixo = (double)0;
-}
-
-TeMatrix::~TeMatrix()
-{
- Clear();
-}
-
-short
-TeMatrix::Alloc(int nl, int nc)
-{
- Clear();
- if( nl <= 0 || nc <= 0 ){
- return true;
- }
- nrow = nl;
- ncol = nc;
- if ( (mat = new double*[nrow]) == NULL ){
- Clear();
- return false;
- }
- int i,j;
- for( i = 0; i < nrow; i++ ) mat[i] = NULL;
- for( i = 0; i < nrow; i++ ){
- if( (mat[i] = new double[ncol]) == NULL ){
- Clear();
- return false;
- }
- for( j = 0; j < ncol; j++ ) mat[i][j] = (double)0.;
- }
- return true;
-}
-
-TeMatrix::TeMatrix(const TeMatrix& m)
-{
- nrow = ncol = 0;
- mat = NULL;
- lixo = 0.;
- *this = m;
-}
-
-int
-TeMatrix::Init( int nl, int nc , double* f )
-{
- if( f == NULL )
- return Init( nl, nc, (double) 0 );
- if( Alloc( nl, nc ) ){
- int c=0;
- int i,j;
- for ( i = 0; i < nrow; i++)
- for (j = 0; j < ncol; j++)
- mat[i][j] = f[c++];
- return true;
- }
- return false;
-}
-
-int
-TeMatrix::Init(int nl, int nc, double f )
-{
- // initialize matrix
- if( Alloc( nl, nc ) ){
- int i,j;
- for (i = 0; i < nrow; i++)
- for (j = 0; j < ncol; j++)
- mat[i][j] = f;
- return true;
- }
- return false;
-}
-
-int
-TeMatrix::Init(int k, double* f)
-{
- if( f == NULL )
- return Init( k, k, (double) 0 );
- if( Alloc(k,k) == false )
- return false;
- int i,j;
- for ( i = 0; i < nrow; i++ )
- for (j = 0; j < ncol; j++)
- mat[i][j] = (i==j)? f[i]: (double)0.;
- return true;
-}
-
-int
-TeMatrix::Init(int k, double f)
-{
- if( Alloc(k,k) == false )
- return false;
- int i,j;
- for (i=0; i<nrow; i++)
- for (j=0; j<ncol; j++)
- mat[i][j] = (i==j)? (double)f:0;
- return true;
-}
-
-TeMatrix&
-TeMatrix::operator=(const TeMatrix& m)
-{
-
- if( Alloc(m.nrow,m.ncol) == false ){
- printf("\nMatrix::operator=:no memory available \n");
- return *this;
- }
- int i,j;
- for( i = 0; i < nrow; i++)
- for( j = 0; j < ncol; j++)
- mat[i][j] = m.mat[i][j];
- return *this;
-}
-
-int
-TeMatrix::operator==(const TeMatrix& m) const
-{
- if( nrow != m.nrow || ncol != m.ncol )
- return false;
- int i,j;
- for ( i = 0; i < nrow; i++)
- for ( j = 0; j < ncol; j++)
- if ( mat[i][j]!= m.mat[i][j] )
- return false;
- return true;
-}
-
-void
-TeMatrix::operator*=(double f)
-{
- int i,j;
- for( i = 0; i < nrow; i++)
- for( j = 0; j < ncol; j++)
- mat[i][j] *= f;
- return;
-}
-
-
-//-------------------------------------------------------------friend methods
-
-TeMatrix
-operator+(const TeMatrix& m,const TeMatrix& n)
-{
- if( m.nrow != n.nrow || m.ncol != n.ncol ){
- printf("\nMatrix::operator+ >>> Operandos com tamanhos diferentes\n");
- return m;
- }
- TeMatrix rm;
- if( rm.Init(m.Nrow(),m.Ncol()) == false ){
- printf("\nMatrix::operator+ >>> Memoria nao disponivel\n");
- return m;
- }
- int i,j;
- for ( i = 0; i < m.Nrow(); i++)
- for ( j = 0; j < m.Ncol(); j++)
- rm.mat[i][j] = m.mat[i][j] + n.mat[i][j];
- return rm;
-}
-
-TeMatrix
-operator-(const TeMatrix& m,const TeMatrix& n)
-{
- if( m.nrow != n.nrow || m.ncol != n.ncol ){
- printf("\nMatrix::operator+ >>> Operandos com tamanhos diferentes\n");
- return m;
- }
- TeMatrix rm;
- if( rm.Init(m.Nrow(),m.Ncol()) == false ){
- printf("\nMatrix::operator- >>> Memoria nao disponivel\n");
- return m;
- }
-
- int i,j;
- for ( i = 0; i < m.Nrow(); i++)
- for ( j = 0; j < m.Ncol(); j++)
- rm.mat[i][j] = m.mat[i][j] - n.mat[i][j];
- return rm;
-}
-
-TeMatrix
-TeMatrix::operator-()
-{
- TeMatrix rm;
- if( rm.Init(Nrow(),Ncol()) == false ){
- printf("\n operator-:no memory \n");
- return *this;
- }
- int i,j;
- for (i=0; i<Nrow(); i++)
- for (j=0; j<Ncol(); j++)
- rm.mat[i][j] = -mat[i][j];
- return rm;
-}
-
-TeMatrix
-operator*(const TeMatrix& m,const TeMatrix& n)
-{
- if ( m.Ncol() != n.Nrow() ) {
- printf( "\nMatrix::operator* >>> Operandos com tamanhos diferentes\n");
- return m;
- }
- int nr = m.Nrow(), nc =n.Ncol();
- TeMatrix result;
- if( result.Init(nr,nc) == false){
- printf("\nMatrix::operator* >>> Memoria nao disponivel\n");
- return m;
- }
-
- double sum = (double)0.;
- int l,c,i;
-
- for ( l = 0; l < m.Nrow(); l++){
- for ( c = 0; c < n.Ncol(); c++){
- sum = (double)0.;
- for ( i = 0; i < m.Ncol(); i++)
- sum += m.mat[l][i] * n.mat[i][c];
- result.mat[l][c] = sum;
-
- }
- }
- return result;
-}
-
-TeMatrix
-operator*(double f,const TeMatrix& m)
-{
- int nr = m.Nrow(), nc =m.Ncol();
- TeMatrix rm;
- if( rm.Init(nr,nc) == false){
- printf("\noperator*:no memory");
- return m;
- }
- int i,j;
- for (i = 0; i < rm.Nrow(); i++)
- for (j = 0; j < rm.Ncol(); j++)
- rm.mat[i][j] = f * m.mat[i][j];
- return rm;
-}
-
-//VRMC 12/98
-int
-TeMatrix::isUpperTriangle() const
-{
- // elements above diagonal != 0
- int i,j;
- for(j = 0; j < ncol; j++)
- for(i = j+1; i < nrow; i++)
- if ( mat[i][j] != (double)0. )
- return false;
- return true;
-}
-
-//VRMC 12/98
-int
-TeMatrix::isLowerTriangle() const
-{
- // elements under diagonal different 0
- int i,j;
- // VRMC 11/98
- for (i=0; i< nrow; i++)
- for (j= i+1; j <ncol; j++)
- if ( mat[i][j] != (double)0. )
- return false;
- return true;
-}
-
-double
-TeMatrix:: Determinant() const
-{
- if (Nrow() != Ncol()) {
- return lixo;
- }
- if (Nrow()==1) return mat[0][0];
- if (Nrow()==2)
- return mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0];
- if (Nrow()==3)
- return ( mat[0][0] * mat[1][1] * mat[2][2]
- +mat[0][1] * mat[1][2] * mat[2][0]
- +mat[0][2] * mat[1][0] * mat[2][1]
- -mat[0][1] * mat[1][0] * mat[2][2]
- -mat[0][0] * mat[1][2] * mat[2][1]
- -mat[0][2] * mat[1][1] * mat[2][0] );
- if ( isUpperTriangle() ) {
- double val = 1;
- int i;
- for (i = 0; i < Nrow(); i++) val *= mat[i][i];
- return val;
- }
- TeMatrix mt;
- double val = 0;
- double det;
- int sign = 1;
- int j;
- for(j = 0; j < Ncol(); j++) {
- if( CoFactor(0,j, mt) == false )
- return (double)0;
- det = mt.Determinant();
- val += sign * mat[0][j] * det;
- sign *= -1;
- }
- return val;
-}
-
-int
-TeMatrix::CoFactor(int irow, int jcol, TeMatrix& mt ) const
-{
- if ( nrow == 1||ncol == 1 ) {
- printf("\nMatrix::CoFactor >>> can't CoFactor row or column matrix\n");
- return false;
- }
- if( mt.Init(nrow-1,ncol-1) == false){
- printf("\nMatrix::CoFactor: Memoria nao disponivel\n");
- return false;
- }
- int getcol, getrow =0;
- int i,j;
- for(i=0; i < mt.Nrow(); i++) {
- if ( getrow == irow ) ++getrow;
- if ( getrow == nrow ) break;
- getcol = 0;
- for(j=0; j < mt.Ncol(); j++) {
- if ( getcol==jcol ) ++getcol;
- if ( getcol==ncol ) continue;
- mt.mat[i][j] = mat[getrow][getcol];
- ++getcol;
- }
- ++getrow;
- }
- return true;
-}
-
-int
-TeMatrix::Transpose( TeMatrix &rm ) const
-{
- if( &rm == this ){
- printf("\nMatrix::Transpose >>> Operacao usa duas matrizes\n");
- return false;
- }
-
- if( rm.Init( ncol, nrow ) == false){
- printf("\nMatrix::Transpose >>> Memoria nao disponivel\n");
- return false;
- }
- int i,j;
- for(i = 0; i < ncol; i++)
- for( j = 0; j < nrow; j++)
- rm.mat[i][j] = mat[j][i];
- return true;
-}
-
-// VRMC 12/98
-int
-TeMatrix::isSimetric() const
-{
- int i,j;
-
- if (nrow != ncol){
- printf("\nMatrix::isSimetric >>> Memoria nao disponivel\n");
- return false;
- }
-
- for (i = 0; i < nrow; i++)
- for (j = 0; j < ncol; j++)
- if ( mat[i][j] != mat[j][i]) return false;
-
- return true;
-}
-
-// VRMC 12/98
-int
-TeMatrix::isPositiveDefinide() const
-{
- int i, j, dim, subdim;
- TeMatrix Submat;
-
- if (nrow != ncol){
- printf("\nMatrix::isPositiveDefinide >>> Matriz tem que ser quadrada\n");
- return false;
- }
- dim = nrow;
-
- for (subdim=1 ; subdim <= dim; subdim++)
- {
- if( Submat.Init( subdim,subdim ) == false ){
- printf("\nMatrix::isPositiveDefinide>>>Memoria nao disponivel!\n");
- return false;
- }
-
- for ( i=0; i < subdim; i++)
- for (j = 0; j < subdim; j++)
- Submat(i,j) = mat[i][j];
-
- if (Submat.Determinant() <= 0.) {
- printf("\nMatrix::isPositiveDefinide>>>Matriz nao e positiva definida!\n");
- return false;
- }
-
- Submat.Clear();
- }
- return true;
-}
-
-// VRMC 12/98
-int
-TeMatrix :: MatTransf( TeMatrix& mt )
-{
- TeMatrix TI; // inverse of a inferior triangular matrix
- int dim;
-
- if( &mt == this ){
- printf("\nMatrix::MatTransf >>> Operacao usa duas matrizes\n");
- return false;
- }
-
- if( nrow <= 0 || ncol <= 0 ){
- printf("\nMatrix::MatTransf >>> Dimensoes da matriz invalidas!\n");
- return false;
- }
-
- if( nrow != ncol ){
- printf("\nMatrix::MatTransf >>> Dimensoes da matriz invalidas!\n");
- return false;
- }
-
- dim = nrow;
- if( mat[0][0] <= 0. ){
- printf("\nMatrix::MatTranf >>> ERROR\n");
- return false;
- }
-
- if( TI.Init( dim, (double)0. ) == false ){
- printf("\nMatrix::MatTransf >>> Memoria nao disponivel!\n");
- return false;
- }
-
-
- //-- Calculate inferior triangular matrix by Cholesky decomposition method
- if ((*this).CholeskyDecomp(TI) == false) {
- printf("\nMatrix::MatTransf>>> Nao foi possivel decompor a matriz!\n");
- return false;
- }
-
- //-- Calculate the inverse of Cholesky matrix
-// if (TI.CholeskyInv(mt) != true)
- if (!(TI.CholeskyInv(mt)))
- {
- printf("\nMatrix::MatTransf>>> Matriz nao inversivel!\n");
- return false;
- }
-
- return true;
-}
-
-// VRMC 12/98
-int
-TeMatrix::CholeskyInv (TeMatrix& mt) const
-{
- if( mt.Init(nrow,(double)0.) == false ){
- printf("\nMatrix::CholeskyInv >>> Memoria nao disponivel!\n");
- return false;
- }
-
- if( &mt == this ){
- printf("\nMatrix::CholeskyInv >>> Operacao usa duas matrizes\n");
- return false;
- }
- if ( nrow != ncol ){
- printf("\nMatrix::CholeskyInv>>> Can't invert a non-square matrix");
- return false;
- }
-// if (this->isLowerTriangle() != true) {
- if (!(this->isLowerTriangle())) {
- printf("\nMatrix::CholeskyInv >>> Matriz nao e triangular inferior\n");
- return false;
- }
-
- int i; double rf;
- for( i = 0; i < nrow; i++ ){
- if( this->mat[i][i] == (double)0. ){
- printf("\nMatrix::CholeskyInv >>> ERROR IV\n");
- return false;
- }
- mt.mat[i][i] = (double)1. / this->mat[i][i];
- int j,k;
- for( j = i-1; j >= 0; j-- ){
- rf = (double)0.;
- for( k = j; k <= i-1; k++ ){
- rf += ( this->mat[i][k] * mt.mat[k][j] );
- }
- mt.mat[i][j] = -rf * mt.mat[i][i];
- }
- }
- return true;
-}
-
-
-int
-TeMatrix::EigenValues( TeMatrix& mt ) const
-{
- //--- calcula os eigenvalues de uma
- // matriz representada na forma vetorial
- // Os auto valores sao devolvidos em ordem decrescente
- // e ocupam as posicoes: 0, 2, 5, 9, ... .
-
- if( &mt == this ){
- printf("\nMatrix::EigenValues >>> Operacao usa duas matrizes\n");
- return false;
- }
-
-double *cov = NULL, /* matriz de covariancia */
- *e_val = NULL; /* " de auto_valores */
-
-int dim = (*this).Nrow(); /* ordem da matriz*/
-
-int i,j,k, /* cov[], e_val[] */
- ia, /* */
- ind, /* |0 | */
- l,m, /* |1 2 | */
- mq,lm, /* |3 4 5 | */
- ll,mm, /* |6 7 8 9| */
- ilq,imq, /* */
- im,iq,il,lq, /* (para DIM=4) */
- jq;
-
-double range, /* e_vec[] */
- dim1,fdim, /* */
- anorm, /* |0 4 8 12| */
- anrmx, /* |1 5 9 13| */
- thr, /* |2 6 10 14| */
- x,y,z, /* |3 7 11 15| */
- sinx,cosx, /* */
- sinx2,cosx2,
- sincs;
-
-int fat = (dim*dim+dim)/2;
-
- if( dim <= 0 ){
- printf("\nMatrix::EigenValues >>> dimensao da matriz nula!\n");
- return false;
- }
- if( mt.Init( dim, (double)1 ) == false ){
- printf("\nMatrix::EigenValues >>> Memoria nao disponivel\n");
- return false;
- }
- range = 1.0e-6 ;
- dim1 = dim - 1 ;
- fdim = dim;
-
- cov = new double[fat];
-
- if( cov == NULL ){
- printf("\nMatrix::EigenValues >>> Memoria nao disponivel (COV)\n");
- return false;
- }
-
- e_val = new double[fat];
- if( e_val == NULL ){
- delete []cov; //SSL0296
- cov = NULL;
- printf("\nMatrix::EigenValues >>> Memoria nao disponivel (EVAL)\n");
- return false;
- }
- k = 0;
- for ( i = 0; i< dim; i++)
- for ( j = 0; j <= i; j++)
- cov[k++] = mat[i][j];
-
- for (i=0; i < ((dim*dim+dim)/2); i++) e_val[i] = cov[i];
-
- anorm = 0.0;
-
- for ( j = 0; j < dim; j++){
- for (i = 0; i <= j; i++){
- if (i != j){
- ia = i + (j*j+j)/2;
- anorm = anorm + e_val[ia] * e_val[ia];
- }
- }
- }
-
- if (anorm <= 0) goto l5;
-
- anorm = 1.414 * sqrt((double)anorm);
- anrmx = anorm * range/fdim;
- ind = 0;
- thr = anorm;
-
-l1:
- thr = thr/fdim;
-l2:
- l = 0;
-l3:
- m = l+1;
-l4:
- mq = (m*m + m)/2;
- lq = (l*l + l)/2;
- lm = l + mq;
-
- if ( fabs((double)(e_val[lm])) >= thr )
- {
- ind = 1;
- ll = l + lq;
- mm = m + mq;
-
- x = 0.5 * (e_val[ll] - e_val[mm]);
- z = e_val[lm] * e_val[lm] + x*x;
- y = - e_val[lm] / sqrt((double)(z));
-
- if (x < 0)
- {
- y = -y;
- }
-
- z = sqrt( (double)(1.0-y*y) );
- sinx = y / sqrt( (double)( 2.0*(1.0 + z) ) );
- sinx2 = sinx * sinx;
-
- cosx = sqrt( (double)(1.0 - sinx2) );
- cosx2 = cosx * cosx;
-
- sincs = sinx * cosx;
-
- ilq = dim * l;
- imq = dim * m;
-
- for (i = 0; i < dim; i++)
- {
- iq = (i*i + i)/2;
- if ( i != l )
- {
- if (i != m)
- {
- if (i > m)
- im = m + iq;
- else
- im = i + mq;
- if (i < l)
- il = i + lq;
- else
- il = l + iq;
-
- x = e_val[il] * cosx - e_val[im] * sinx;
- e_val[im] = e_val[il] * sinx + e_val[im] * cosx;
- e_val[il] = x;
- }
- }
- }
- x = 2.0 * e_val[lm] * sincs;
- y = e_val[ll] * cosx2 + e_val[mm] * sinx2 - x;
- x = e_val[ll] * sinx2 + e_val[mm] * cosx2 + x;
-
- e_val[lm] = (e_val[ll]-e_val[mm])*sincs+e_val[lm]*(cosx2-sinx2);
- e_val[ll] = y;
- e_val[mm] = x;
- }
-
- if (m != (dim-1))
- {
- m = m + 1; goto l4;
- }
- if (l != (dim-2))
- {
- l = l + 1; goto l3;
- }
- if (ind == 1)
- {
- ind = 0; goto l2;
- }
- if (thr > anrmx) goto l1;
-
-l5:
- iq = -dim;
-
- for (i = 0; i < dim; i++)
- {
- iq = iq + dim;
- ll = i + (i*i + i)/2;
- jq = dim * (i-1);
-
- for (j = i; j < dim; j++)
- {
- jq = jq + dim;
- mm = j + (j*j + j)/2;
-
- if (e_val[ll] < e_val[mm])
- {
- x = e_val[ll];
- e_val[ll] = e_val[mm];
- e_val[mm] = x;
- }
- }
- }
-
- for ( i = 0; i< dim; i++){
- mt(i,0) = e_val[(i*(i+1))/2+i];
- }
-
- delete []cov; //SSL0296
- delete []e_val; //SSL0296
-
- return true;
-}
-
-//--------------------------------------------------EigenVectors
-//
-// Metodo adaptado a partir de uma implementacao em C
-// utilizada no software SITIM.
-
-int
-TeMatrix::EigenVectors( TeMatrix& mt ) const
-{
- if( &mt == this ){
- printf("\nMatrix::EigenVectors >>> Operacao usa duas matrizes\n");
- return false;
- }
-
-double *cov = NULL, /* matriz de covariancia */
- *e_val = NULL, /* " de auto_valores */
- *e_vec = NULL; /* " de auto_vetores */
-
-int dim = (*this).Nrow(); /* ordem da matriz*/
-
-int i,j,ij,k, /* cov[], e_val[] */
- ia, /* */
- ind, /* |0 | */
- l,m, /* |1 2 | */
- mq,lm, /* |3 4 5 | */
- ll,mm, /* |6 7 8 9| */
- ilq,imq, /* */
- im,iq,il,lq, /* (para DIM=4) */
- ilr,imr,
- jq;
-
-double range, /* e_vec[] */
- dim1,fdim, /* */
- anorm, /* |0 4 8 12| */
- anrmx, /* |1 5 9 13| */
- thr, /* |2 6 10 14| */
- x,y,z, /* |3 7 11 15| */
- sinx,cosx, /* */
- sinx2,cosx2,
- sincs;
-
- if( dim <= 0 ){
- printf("\nMatrix::EigenValues >>> dimensao da matriz nula!\n");
- return false;
- }
- if( mt.Init( dim, (double)1 ) == false ){
- printf("\nMatriz::EigenVectors >>> Memoria nao disponivel!\n");
- return false;
- }
-
- int fat =(dim*dim+dim)/2;
- range = 1.0e-6 ;
- dim1 = dim - 1 ;
- fdim = dim;
-
- cov = new double[fat];
- e_vec = new double[dim*dim];
- e_val = new double[fat];
-
- if( cov == NULL || e_vec == NULL || e_val == NULL ){
- printf("\nMatrix::EigenVectors >>> Memoria nao disponivel\n");
- return false;
- }
-
- k = 0;
- for ( i = 0; i< dim; i++)
- for ( j = 0; j <= i; j++)
- cov[k++] = (*this)(i,j);
-
- for (i=0; i < ((dim*dim+dim)/2); i++) e_val[i] = cov[i];
-
- iq = -dim;
- for (i = 0; i < dim; i++)
- {
- iq = iq + dim;
- for ( j = 0; j < dim; j++)
- {
- ij = iq + j;
- if (i == j)
- e_vec[ij] = 1.0;
- else
- e_vec[ij] = 0.0;
- }
- }
-
- anorm = 0.0;
-
- for ( j = 0; j < dim; j++)
- {
- for (i = 0; i <= j; i++)
- {
- if (i != j)
- {
- ia = i + (j*j+j)/2;
- anorm = anorm + e_val[ia] * e_val[ia];
- }
- }
- }
-
- if (anorm <= 0) goto l5;
-
- anorm = 1.414 * sqrt((double)anorm);
- anrmx = anorm * range/fdim;
- ind = 0;
- thr = anorm;
-
-l1:
- thr = thr/fdim;
-l2:
- l = 0;
-l3:
- m = l+1;
-l4:
- mq = (m*m + m)/2;
- lq = (l*l + l)/2;
- lm = l + mq;
-
- if ( fabs((double)(e_val[lm])) >= thr )
- {
- ind = 1;
- ll = l + lq;
- mm = m + mq;
-
- x = 0.5 * (e_val[ll] - e_val[mm]);
- z = e_val[lm] * e_val[lm] + x*x;
- y = - e_val[lm] / sqrt((double)(z));
-
- if (x < 0)
- {
- y = -y;
- }
-
- z = sqrt( (double)(1.0-y*y) );
- sinx = y / sqrt( (double)( 2.0*(1.0 + z) ) );
- sinx2 = sinx * sinx;
-
- cosx = sqrt( (double)(1.0 - sinx2) );
- cosx2 = cosx * cosx;
-
- sincs = sinx * cosx;
-
- ilq = dim * l;
- imq = dim * m;
-
- for (i = 0; i < dim; i++)
- {
- iq = (i*i + i)/2;
- if ( i != l )
- {
- if (i != m)
- {
- if (i > m)
- im = m + iq;
- else
- im = i + mq;
- if (i < l)
- il = i + lq;
- else
- il = l + iq;
-
- x = e_val[il] * cosx - e_val[im] * sinx;
- e_val[im] = e_val[il] * sinx + e_val[im] * cosx;
- e_val[il] = x;
- }
- }
-
- //--- calculate eigenvectors
-
- ilr = ilq + i;
- imr = imq + i;
- x = e_vec[ilr] * cosx - e_vec[imr] * sinx;
- e_vec[imr] = e_vec[ilr] * sinx + e_vec[imr] * cosx;
- e_vec[ilr] = x;
- }
-
- x = 2.0 * e_val[lm] * sincs;
- y = e_val[ll] * cosx2 + e_val[mm] * sinx2 - x;
- x = e_val[ll] * sinx2 + e_val[mm] * cosx2 + x;
-
- e_val[lm] = (e_val[ll]-e_val[mm])*sincs+e_val[lm]*(cosx2-sinx2);
- e_val[ll] = y;
- e_val[mm] = x;
- }
-
- if (m != (dim-1))
- {
- m = m + 1; goto l4;
- }
- if (l != (dim-2))
- {
- l = l + 1; goto l3;
- }
- if (ind == 1)
- {
- ind = 0; goto l2;
- }
- if (thr > anrmx) goto l1;
-
-l5:
- iq = -dim;
-
- for (i = 0; i < dim; i++)
- {
- iq = iq + dim;
- ll = i + (i*i + i)/2;
- jq = dim * (i-1);
-
- for (j = i; j < dim; j++)
- {
- jq = jq + dim;
- mm = j + (j*j + j)/2;
-
- if (e_val[ll] < e_val[mm])
- {
- x = e_val[ll];
- e_val[ll] = e_val[mm];
- e_val[mm] = x;
-
- for (k = 0; k < dim; k++)
- {
- ilr = iq + k;
- imr = jq + k;
- x = e_vec[ilr];
- e_vec[ilr] = e_vec[imr];
- e_vec[imr] = x;
- }
- }
- }
- }
-
- k=0;
- for ( i = 0; i< dim; i++){
- for ( j = 0; j< dim; j++)
- mt(j,i) = e_vec[k++];
- }
-
- delete []cov; //SSL0296
- delete []e_vec; //SSL0296
- delete []e_val; //SSL0296
-
- return true;
-}
-
-//--------------------------------------------------EigenVec
-//
-// Metodo desenvolvido para suporte de decisao (suporte_stubs.cpp)
-// Missae Yamamoto (junho/1999)
-
-int
-TeMatrix::EigenVec( double e_vec[] )
-{
-
-double *e_vec_aux = NULL, soma = 0.0;
-
-int dim = (*this).Nrow(); /* ordem da matriz*/
-
-TeMatrix aux1, aux2, mt;
-
-int i,j,k;
-
- if( dim <= 0 )
- {
- printf("\nMatrix::EigenVecVal >>> dimensao da matriz nula!\n");
- return false;
- }
-
- if( aux1.Init( dim, (double)1 ) == false )
- {
- printf("\nMatrix::EigenVecVal >>> Memoria nao disponivel!\n");
- return false;
- }
-
- if( aux2.Init( dim, (double)1 ) == false )
- {
- printf("\nMatrix::EigenVecVal >>> Memoria nao disponivel!\n");
- return false;
- }
-
- e_vec_aux = new double[dim];
-
- if( e_vec_aux == NULL )
- {
- printf("\nMatrix::EigenVecVal >>> Memoria nao disponivel\n");
- return false;
- }
-
- for ( k = 0; k< dim; k++)
- {
- e_vec_aux[k] = 0.0;
- e_vec[k] = 0.0;
- }
-
- aux1 = *this;
- aux2 = *this;
-
- for (;;)
- {
- mt = aux1 * aux2;
-
- for (i=0; i<dim; i++)
- {
- for (j=0; j<dim; j++)
- e_vec[i] = e_vec[i] + mt(i,j);
- soma = soma + e_vec[i];
- }
-
- for (j=0; j<dim; j++)
- e_vec[j] = e_vec[j] / soma;
-
- for (j=0; j<dim; j++)
- {
- if ( fabs(e_vec_aux[j] - e_vec[j]) < 0.001 )
- {
- delete []e_vec_aux;
- return true;
- }
- e_vec_aux[j] = e_vec[j];
- }
-
- aux1 = mt;
- aux2 = mt;
- }
-
-}
-
-double TeMatrix::getTrace() const
-{
- TEAGN_TRUE_OR_THROW( ( nrow == ncol ),
- "Cannot get trace from a non-square matrix" );
-
- double trace = 0.0;
-
- for( int curr_row = 0 ; curr_row < nrow ; ++curr_row ) {
- trace += mat[ curr_row ][ curr_row ];
- }
-
- return trace;
-}
-
-
-bool TeMatrix::getIdentity( TeMatrix& identity, unsigned int width )
-{
- if( identity.Init( width, width, 0.0 ) == 0 ) return false;
-
- for( unsigned int curr_row = 0 ; curr_row < width ; ++curr_row ) {
- identity( curr_row, curr_row ) = 1.0;
- }
-
- return true;
-}
-
-//------------------------------------------ Print
-void
-TeMatrix::Print()
-{
- //printf("\nMATRIZ ( %d, %d ) LIXO %f **mat %p\n", nrow,ncol, lixo, mat);
- printf("\nMATRIZ ( %d, %d )\n\n", nrow,ncol);
- if( mat == NULL ){
- printf("\n>>> mat e NULL \n");
- return;
- }
- int i,j;
- for(i = 0; i < nrow; i++){
- for( j = 0; j < ncol;j++){
- printf("%10.4f ",(float)mat[i][j]);
- }
- printf("\n\n");
- }
-}
-
-// VRMC 12/98
-int
-TeMatrix::CholeskyDecomp( TeMatrix& mt )
-{
-
- //-- Verify if the matrix is simetric
- if ((*this).isSimetric() == false){
- printf("\nMatrix::CholeskyDecomp >>> Matriz nao e simetrica!\n");
- return false;
- }
- //-- Verify if the matrix is positive definide
- if ((*this).isPositiveDefinide() == false){
- printf("\nMatrix::CholeskyDecomp >>> Matriz nao e positiva definida!\n");
- return false;
- }
- if( &mt == this ){
- printf("\nMatrix::CholeskyDecomp >>> Operacao usa duas matrizes\n");
- return false;
- }
- if( mat[0][0] <= 0. ){
- printf("\nMatrix::CholeskyDecomp >>> Posicao [0,0] e' nula\n");
- return false;
- }
- if( mt.Init(nrow,ncol) == false ){
- printf("\nMatrix::CholeskyDecomp>>>no memory \n");
- return false;
- }
- mt(0,0) = (double)sqrt((double)(*this)(0,0));
-
- //--- Calculate the first column of the TeMatrix mt
-
- int i,j,k;
- for( i= 0; i < nrow; i++){
- mt(i,0) = (*this)(i,0)/mt(0,0);
- }
-
- for( i= 1; i < nrow; i++){
- for( j= 1; j <= i; j++){
- //int m = (j*j - j)/2 + 1;
- double rf = 0.;
- //int k2 = j - 1;
- //for( k = 0;k<=k2;k++)
- for( k = 0;k < j;k++)
- rf += mt(i,k) * mt(j,k);
- if( i == j ){
- rf = (*this)(i,j) - rf;
- if( rf < 0. ){
- printf("\nMatrix::CholeskyDecomp:ERRO \n");
- return false;
- }
- mt(i,j) = (double)sqrt((double)rf);
- }
- else{
- if( mt(j,j) == 0. ){
- printf("\nMatrix::CholeskyDecomp:ERRO \n");
- return false;
- }
- mt(i,j) = ((*this)(i,j)-rf)/mt (j,j );
- }
- }
- }
- return true;
-}
-
-
-//-------------------------------------------------Inverse(SITIM)
-//
-//--- Calcula a matriz inversa pelo metodo de Gauss-Jordan.
-//
-
-int
-TeMatrix::Inverse( TeMatrix& matinv ) const
-{
-
- if( &matinv == this ){
- printf("\nMatrix::Inverse >>> Operacao usa duas matrizes\n");
- return false;
- }
- if ( nrow != ncol ){
- printf("\nMatrix::Inverse: can't invert a non-square matrix");
- return false;
- }
-
- if( matinv.Init( this->nrow, (double)1 ) == false ){
- printf("\nMatrix::Inverse >>> Memoria nao disponivel\n");
- return false;
- }
-
-//--- Calculo da inversa se a matriz tem dimensao unitaria
-
- if(nrow == 1){
- if(mat[0][0] == 0.0) {
- printf("\noperator~: can't invert singular matrix");
- return false;
- }
- matinv(0,0) = 1. / mat[0][0];
- return true;
- }
-
-//--- Formacao da matriz aumentada mataum
-
- int m2 = 2 * nrow ;
- TeMatrix mataum;
-
- if( mataum.Init( nrow , m2 ) == false ){
- printf("\nInverse:no memory");
- return false;
- }
-
- int i1,i2,i3;
- for(i1 = 0 ; i1 < nrow ; i1++){
- for( i2 = 0 ; i2 < ncol ; i2++)
- mataum(i1,i2) = mat[i1][i2];
-
- for( i3 = nrow ; i3 < m2 ; i3++)
- mataum(i1,i3) = 0.0;
-
- mataum( i1, i1 + nrow) = 1.0;
- }
-
-//-- Inicializa ponteiro de linhas
-
- double *maxlinha = NULL;
-
- if( ( maxlinha = new double[nrow] ) == NULL ){
- printf("\nMatrix::Inverse>>no memory");
- return false;
- }
-
- double sup,lcon1,amul,pivo;
- int * lp = NULL;
-
- if( (lp = new int[nrow]) == NULL ){
- printf("\nMatrix::Inverse>>no memory");
- if( maxlinha != NULL){delete []maxlinha; maxlinha = NULL;} //SSL0296
- return false;
- }
-
- for(i1 = 0 ; i1 < nrow ; i1++)
- lp[i1] = i1;
-
- int lcon = 0;
- int m1 = nrow - 1;
-
- while(lcon < nrow){
-//--- Selecao do maior valor em cada linha . seu inverso e armazenado em maxlinha.
- for(i1 = 0 ; i1 < nrow ; i1++){
- sup = 0.0;
- for(i2 = 0 ; i2 < nrow ; i2++){
- lcon1 = (double)fabs(mataum(lp[i1],i2));
- if((lcon1 - sup ) > 0.000001 )
- sup = lcon1;
- }
- if(sup == 0.0){
- if( maxlinha != NULL){ delete []maxlinha; maxlinha = NULL; } //SSL0296
- if( lp != NULL){ delete []lp; lp = NULL; } //SSL0296
- return false;
- }
- maxlinha[lp[i1]] = 1.0 / sup;
- }
-
-//--- Selecao do pivo em cada linha
-
- int lpi;
- double supc = fabs((double)( mataum(lp[lcon],lcon) * maxlinha[lp[lcon]] ));
- pivo = mataum(lp[lcon],lcon);
- lpi = lcon;
- for(i1 = lcon ; i1 < nrow ; i1++){
- amul = mataum(lp[i1],lcon) * maxlinha[lp[i1]];
- if (fabs(amul) > supc ){
- supc = (fabs((double)amul));
- pivo = mataum(lp[i1],lcon);
- lpi = i1;
- }
- }
-
- if(pivo == 0.0){
- if( maxlinha != NULL){ delete []maxlinha; maxlinha = NULL; } //SSL0296
- if( lp != NULL){ delete []lp; lp = NULL; } //SSL0296
- return false;
- }
-
- /* troca de linhas */
- i1 = lp[lcon];
- lp[lcon] = lp[lpi];
- lp[lpi] = i1;
-
-//--- Divide a linha pelo pivo
- for(i2 = 0 ; i2 < m2 ; i2++){
- mataum(lp[lcon],i2) = mataum(lp[lcon],i2) / pivo ;
- }
-
-//--- Realiza subtracoes nas linhas de forma a zerar os elementos da coluna
-//--- dada pelo indice lcon
-
- int il = lcon;
-
- for(i2 = 0; i2 < m1 ; i2++){
- il = il + 1;
- if(il >= nrow ) il = 0;
- double aux = - mataum(lp[il],lcon);
- for(i3 = lcon; i3 < m2 ; i3++)
- mataum(lp[il],i3) = mataum(lp[il],i3) + aux * mataum(lp[lcon],i3);
-
- mataum(lp[il],lcon) = 0.0;
- }
-
- lcon = lcon + 1;
- }
-
-//--- Copia a parte extendida de mataum em matinv que passa a ser a matriz inversa
- for(i1 = 0 ; i1 < nrow ; i1++){
- for(i2 = nrow ; i2 < m2 ; i2++)
- {
- i3 = i2 - nrow ;
- matinv(i1,i3) = mataum(lp[i1],i2);
- }
- }
-
- if( maxlinha != NULL){
- delete []maxlinha; //SSL0296
- maxlinha = NULL;
- }
- if( lp != NULL){
- delete []lp; //SSL0296
- lp = NULL;
- }
-
- return true;
-}
-
-// Esse mtodo, no esta correto
-//------------------------------------------Inverse
-// NIH library
-// 1. triangulate: *this = ~P*T
-// 2. when T isUpperTriangle ~T isUpperTriangle
-// 3. split: T = T.row(0) + subT
-// 4. I = ~T*T
-// 5. ~T.at(0,0) = 1/T.at(0,0)
-// 6. sub~T = ~(subT)
-// 7. ~T.row(0) = [1/T.at(0,0)]&B
-// where T.at(0,0)*B = [t21 ... t2n]*~subT
-// 8. ~*this = ~T*P
-
-/*int
-TeMatrix::InverseNIH( TeMatrix& mt ) const
-{
- TeMatrix r;
- TeMatrix _subT;
- TeMatrix B;
- TeMatrix val;
-
- if ( nrow!=ncol || nrow <= 0 || ncol <= 0 ){
- printf("\nMatrix::Inverse >>> Matriz nao inversivel!\n");
- return false;
- }
-
- if( mt.Init( this->nrow, (double)1 ) == false ){
- printf("\nMatrix::Inverse >>> Memoria nao disponivel\n");
- return false;
- }
-
- if ( nrow==1 ){
- if( mat[0][0] == (double)0 ){
- printf("\nMatrix::Inverse >>> Matriz nao inversivel!\n");
- return false;
- }
- mt.mat[0][0] = 1/mat[0][0];
- return true;
- }
- TeMatrix T(*this);
- if( T.Initialized() == false ){
- printf("\nMatrix::Inverse >>> Memoria nao disponivel\n");
- return false;
- }
-
- // 1. triangulate: *this = ~P*T
- TeMatrix P;
- if( P.Init(nrow,ncol) == false){
- printf("\nMatrix::Inverse >>> Memoria nao disponivel\n");
- return false;
- }
- if( T.UpperTriangle( P ) == false ){
- printf("\nMatriz::Inverse >>> ERRO!\n");
- return false;
- }
- if ( T.Determinant()==0 ) {
- printf("\nMatrix::Inverse >>> can't invert singular matrix\n");
- return false;
- }
-
- // 2. when T isUpperTriangle ~T isUpperTriangle
- // 3. split: T = T.row(0) + subT
-
- if( r.Init(1,ncol-1,&(T.mat[0][1])) == false){
- printf("\nMatrix::Inverse* >>> Memoria nao disponivel\n");
- return false;
- }
-
- T.CoFactor(0,0,mt);
- mt.Inverse(_subT);
- if( _subT.Initialized() == false){
- printf("\nMatrix::Inverse >>> Memoria nao disponivel\n");
- return false;
- }
-
-
- B = (-(1/T.mat[0][0])*r*_subT);
- if( B.Initialized() == false ){
- printf("\nMatrix::Inverse >>> Memoria nao disponivel\n");
- return false;
- }
-
- if( val.Init(nrow,ncol) == false){
- printf("\nMatrix::Inverse >>> Memoria nao disponivel\n");
- return false;
- }
-
- val.mat[0][0] = 1/T.mat[0][0];
- int i;
- for(i=1; i<ncol; i++) val.mat[0][i]=B.mat[0][i-1];
- val.CoFactor(0,0,_subT);
-
- mt = val*P; // P is now the row-reduction transformation
-
- return true;
-}
-*/
-
-// os mtodos switchRows e combineRows ficarao comentados
-// pois s sao utilizados no calculo da matriz inversa NIH,
-// inversaNIH, que tambem foi comentado
-/*void
-TeMatrix::switchRows(int i,int j)
-{
- double *tmp;
-
- if( i < 0 || j < 0 || i >= nrow || j >= ncol ){
- printf("\nMatrix::switchRows >>> Switching linhas invalidas\n");
- return;
- }
- tmp = mat[i];
- mat[i] = mat[j];
- mat[j] = tmp;
-}
-
-void
-TeMatrix::combineRows(int i, double a, int j)
-{
- if( i < 0 || j < 0 || i >= nrow || j >= ncol ){
- printf("\nMatrix::combineRows >>> Combining linhas invalidas\n");
- return;
- }
- int h;
- for(h = 0; h < ncol; h++)
- mat[i][h] += a * mat[j][h];
-}
-*/
-
-//--------Esse metodo nao esta correto e por isso ficar comentado VRMC
-//----------------------------------------------------
-/*int
-TeMatrix::UpperTriangle( TeMatrix& mt )
-{
- if( &mt == this ){
- printf("\nMatrix::UpperTriangle >>> Operacao usa duas matrizes\n");
- return false;
- }
- if( mt.Init(nrow,(double)1) == false){
- printf("\nMatrix::UpperTriangle >>> Memoria nao disponivel\n");
- return false;
- }
-
- if ( this->isUpperTriangle() )
- return true;
-
- int j;
- for(j = 0; j < ncol; j++) {
- int b_row = nrow-1; // 1st non-zero entry from bottom
- int t_row = j; // 1st zero entry from the top
-
- //--- switch rows until all zeros are at
- //--- the bottom of jTH column
-
- while ( b_row>=t_row ) {
- while ( b_row > j && mat[b_row][j] == 0. )
- --b_row;
- if ( b_row == j )
- break; // bottom at diagonal
- while ( b_row >= t_row && mat[t_row][j] != 0. )
- ++t_row;
- if ( t_row == Nrow() )
- break; // top at last row
- if ( t_row > b_row )
- break;
- switchRows(b_row,t_row);
- mt.switchRows(b_row,t_row);
- }
-
- //--- now b_row is last non-zero entry from the top
- //--- now t_row is first zero entry from the bottom
- //--- combine until all entries below diagonal in jTH column = 0
-
- if ( b_row <= j )
- continue;
- int i;
- for( i = j+1; i<= b_row; i++) {
- double f = -mat[i][j] / mat[j][j];
- combineRows(i,f,j);
- mt.combineRows(i,f,j);
- }
- }
- return true;
-}
-*/
diff --git a/src/terralib/kernel/TeMatrix.h b/src/terralib/kernel/TeMatrix.h
deleted file mode 100644
index 12d1db0..0000000
--- a/src/terralib/kernel/TeMatrix.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeMatrix.h
- \brief This file models the object matrix of type double
-*/
-#ifndef __TERRALIB_INTERNAL_MATRIX_H
-#define __TERRALIB_INTERNAL_MATRIX_H
-
-#include "TeDefines.h"
-#include <TeException.h>
-
-//! This class represents a matrix of elements of type double
-class TL_DLL TeMatrix
-{
-private:
- int nrow; // Number of rows
- int ncol; // Number of columns
- double **mat; // TeMatrix of double elements
- double lixo; // Ancillary variable
-
- //! Allocates memory to holds a matrix of l lines by c columns
- short Alloc( int l, int c);
-
-public:
- //! Normal constructor
- TeMatrix();
-
- //! Copy constructor
- TeMatrix(const TeMatrix& );
-
- //! Destructor
- ~TeMatrix();
-
- //! Clear memory for matrix.
- void Clear();
-
- //! Checks if the matrix is initialized.
- int Initialized(){ return ( nrow > 0 && ncol > 0 ) ? (true) : (false); }
-
- //! Initializes the matrix with a vector of values
- int Init( int nrow = 1, int ncol = 1 , double* f=0);
-
- //! Initializes the matrix with the same value.
- int Init( int nrow , int ncol , double f );
-
- //! Diagonal matrix with different values.
- int Init(int k, double* f);
-
- //! Diagonal matrix with the same value
- int Init(int k, double f);
-
- //! Acess element in position (lin,col)
- const double& operator()( int lin, int col ) const {
- if( ( lin >= 0 ) && ( lin < nrow ) && ( col >= 0 ) &&
- ( col < ncol ) ) {
-
- return mat[lin][col];
- } else {
- throw TeException( UNKNOWN_ERROR_TYPE,
- "Trying to access an invalid matrix position" );
-
- return lixo;
- }
- }
-
- //! Acess element in position (lin,col)
- double& operator()( int lin, int col ){
- if( ( lin >= 0 ) && ( lin < nrow ) && ( col >= 0 ) &&
- ( col < ncol ) ) {
-
- return mat[lin][col];
- } else {
- throw TeException( UNKNOWN_ERROR_TYPE,
- "Trying to access an invalid matrix position" );
-
- return lixo;
- }
- }
-
- //! Assign matrix values to another one using operator =
- TeMatrix& operator=( const TeMatrix& m );
-
- //! Compares two matrix using the operator ==
- int operator==(const TeMatrix& m) const;
-
- //! Operator *=
- void operator*=(double);
-
- //! Operator unary minus
- TeMatrix operator-();
-
- //! Returns the number of rows.
- int Nrow() const { return nrow; }
-
- //! Returns the number of columns.
- int Ncol() const { return ncol; }
-
- //! Print the matrix elements .
- void Print();
-
- //! Switches two rows "a" and "b".
- void switchRows(int a ,int b);
-
- //! Combines two rows in according to row(i) += b*row(j)
- void combineRows(int i,double b,int j);
-
- //! Finds the transpose of a matrix.
- int Transpose( TeMatrix& mt ) const;
-
- //! Finds the inverse of a matrix, if any.
- int Inverse ( TeMatrix& mt ) const;
-
- //! Finds the inverse of a triangle matrix acquired from Cholesky decomposition
- int CholeskyInv (TeMatrix& mt) const;
-
- //! Calculates the inverse of a lowertriangle matrix aquired from the Cholesky decomposition of a simetric positive definide matrix.
- int MatTransf( TeMatrix& mt );
-
-//! Checks if the matrix is an uppertriangle matrix.
- int isUpperTriangle() const;
-
-//! Checks if the matrix is an lowertriangle matrix.
- int isLowerTriangle() const;
-
-//! Checks if the matrix is a simetric matrix
- int isSimetric() const;
-
-//! Checks if the matrix is positive definide
- int isPositiveDefinide() const;
-
-//! Calculates the cofactor value of a matrix.
- int CoFactor(int irow, int jcol, TeMatrix& m) const;
-
-//! Calculates the determinant value.
- double Determinant() const;
-
-// Extracts a triangle matrix from a simetric positive definide one
- int CholeskyDecomp( TeMatrix& mt );
-
-//! Calculates the EigenVectors.
- int EigenVectors( TeMatrix& mt ) const;
-
-//! Calculates the EigenValues.
- int EigenValues( TeMatrix& mt ) const;
-
-//! Calculates the EigenVectors.
- int EigenVec( double e_vec[] );
-
- /**
- * @brief Matrix trace calcule (the sum of diagonal elements).
- * @return The matrix trace.
- */
- double getTrace() const;
-
- /**
- * @brief Generate a identity matrix .
- * @param identity The generated identity matrix.
- * @param width The identity matrix width.
- * @return true if OK, false on errors.
- */
- static bool getIdentity( TeMatrix& identity, unsigned int width );
-
-//! Sums two matrices.
- friend TL_DLL TeMatrix operator+(const TeMatrix& m1,const TeMatrix& m2);
-
-//! Subtracts two matrices.
- friend TL_DLL TeMatrix operator-(const TeMatrix&,const TeMatrix&);
-
-//! Calculates the product of two matrices.
- friend TL_DLL TeMatrix operator*(const TeMatrix&,const TeMatrix&);
-
-//! Product of the matrix by a constant.
- friend TL_DLL TeMatrix operator*(double c,const TeMatrix&);
-};
-
-
-#endif
-
diff --git a/src/terralib/kernel/TeMeasure.h b/src/terralib/kernel/TeMeasure.h
index c9908da..cc68af3 100644
--- a/src/terralib/kernel/TeMeasure.h
+++ b/src/terralib/kernel/TeMeasure.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeMeasure.h
\brief This file defines a class for handling a measure
*/
diff --git a/src/terralib/kernel/TeMetaModelCache.cpp b/src/terralib/kernel/TeMetaModelCache.cpp
deleted file mode 100644
index 04da12c..0000000
--- a/src/terralib/kernel/TeMetaModelCache.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include "TeMetaModelCache.h"
-
-void TeMetaModelCache::clear()
-{
- TeViewMap::iterator viewIt;
- for (viewIt = viewMap_.begin(); viewIt != viewMap_.end(); ++viewIt)
- {
- if(viewIt->second)
- delete viewIt->second;
- }
-
- TeLayerMap::iterator layerIt;
- for (layerIt = layerMap_.begin(); layerIt != layerMap_.end(); ++layerIt)
- {
- if (layerIt->second)
- delete layerIt->second;
- }
-
- TeProjectMap::iterator projectIt;
- for (projectIt = projectMap_.begin(); projectIt != projectMap_.end(); ++projectIt)
- {
- if (projectIt->second)
- delete projectIt->second;
- }
-
- TeThemeMap::iterator invThemeIt;
- for (invThemeIt = invalidThemeMap_.begin(); invThemeIt != invalidThemeMap_.end(); ++invThemeIt)
- {
- if (invThemeIt->second)
- delete invThemeIt->second;
- }
-
- legendMap_.clear();
- themeMap_.clear();
- invalidThemeMap_.clear();
- viewMap_.clear();
- layerMap_.clear();
- projectMap_.clear();
-}
-
diff --git a/src/terralib/kernel/TeMetaModelCache.h b/src/terralib/kernel/TeMetaModelCache.h
deleted file mode 100644
index 314a9e9..0000000
--- a/src/terralib/kernel/TeMetaModelCache.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeMetaModelCache.h
- \brief This file contains structures and definitions about TerraLib database meta model.
-*/
-#ifndef __TERRALIB_INTERNAL_METAMODELCACHE_H
-#define __TERRALIB_INTERNAL_METAMODELCACHE_H
-
-#include "TeLayer.h"
-#include "TeAbstractTheme.h"
-#include "TeView.h"
-#include "TeProject.h"
-
-//! A class for storing TerraLib's metamodel objects (TeTheme, TeLayer, ...)
-/*!
- An instance of this class keeps track of
- meta objects stored in a TerraLib Database.
- This instance can be shared by all database connections.
-
- \sa TeTheme, TeView, TeLayer, TeAttribute
-*/
-class TL_DLL TeMetaModelCache
-{
- public:
-
-
- //! Empty constructor
- TeMetaModelCache()
- {}
-
- //! Destructor
- ~TeMetaModelCache()
- { clear(); }
-
- //! Clears metadata
- void clear();
-
- //! Returns the map of layers in the database
- TeLayerMap& layerMap ()
- { return layerMap_; }
-
- //! Returns the map of views in the database
- TeViewMap& viewMap ()
- { return viewMap_; }
-
- //! Returns the map of themes in the database
- TeThemeMap& themeMap ()
- { return themeMap_; }
-
- //! Returns the map of invalid themes in the database
- TeThemeMap& invalidThemeMap ()
- { return invalidThemeMap_; }
-
- //! Returns the map of projects in the database
- TeProjectMap& projectMap ()
- { return projectMap_; }
-
- //! Returns the map of legends in the database
- TeLegendEntryMap& legendMap ()
- { return legendMap_; }
-
- //! Returns the set of relations between tables
- multiset<int>& relationMSet ()
- { return relationMSet_; }
-
- map<int, map<string, string> >& mapThemeAlias()
- {return mapThemeAlias_;}
-
- private:
-
- //! Copy constructor not allowed.
- TeMetaModelCache(const TeMetaModelCache& rhs);
-
- //! Assignment operator not allowed.
- TeMetaModelCache& operator=(const TeMetaModelCache& rhs);
-
- private:
-
- TeLayerMap layerMap_; //!< layer map
- TeViewMap viewMap_; //!< view map
- TeThemeMap themeMap_; //!< theme map
- TeThemeMap invalidThemeMap_; //!< invalid theme map
- TeLegendEntryMap legendMap_; //!< view map
- TeProjectMap projectMap_; //!< project map
- multiset<int> relationMSet_; //!< multiset of relations between tables
- /*! \brief An associative container from theme identifier (int)
- to legend alias (map<string, string>). The theme alias
- is another container, where key is a string with a column name
- used in a group that maps to a legend alias (string value).
- */
- map<int, map<string, string> > mapThemeAlias_;
-};
-
-
-
-#endif
-
-
diff --git a/src/terralib/kernel/TeMultiContainer.h b/src/terralib/kernel/TeMultiContainer.h
deleted file mode 100644
index c2a73c6..0000000
--- a/src/terralib/kernel/TeMultiContainer.h
+++ /dev/null
@@ -1,625 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-/*! \file TeMultiContainer.h
- \brief A container class to store multiple types os object copies.
-*/
-
-
-#ifndef TEMULTICONTAINER_H
- #define TEMULTICONTAINER_H
-
- #include "TeSharedPtr.h"
- #include "TeMutex.h"
- #include "TeAgnostic.h"
-
- #include <time.h>
-
- #include <vector>
- #include <typeinfo>
-
- /**
- * @brief Multi-container node interface.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup Utils
- */
- template< typename TeMultiContainerKeyT >
- class TeMCNodeInterface {
- public :
-
- /**
- * @brief Default Constructor.
- */
- TeMCNodeInterface() {};
-
- /**
- * @brief Default Destructor.
- */
- virtual ~TeMCNodeInterface() {};
-
- /**
- * @brief Copies the the current node instance by calling
- * the operator= from the contained object instance.
- * @return A pointer to the new node copy.
- */
- virtual TeMCNodeInterface< TeMultiContainerKeyT >* clone()
- const = 0;
-
- /**
- * @brief Get the internal object type info.
- * @return The internal object type info.
- */
- virtual const std::string& getObjTypeInfo() const = 0;
-
- private :
-
- /**
- * @brief Alternative constructor.
- */
- TeMCNodeInterface(
- const TeMCNodeInterface< TeMultiContainerKeyT >& ) {};
-
- /**
- * @brief operator= overload.
- *
- * @param ext_instance External instance reference.
- * @return The external instance reference.
- */
- const TeMCNodeInterface< TeMultiContainerKeyT >& operator=(
- const TeMCNodeInterface< TeMultiContainerKeyT >& ) {};
- };
-
-
- /**
- * @brief Multi-container node class.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup Utils
- */
- template< typename ObjectT, typename TeMultiContainerKeyT >
- class TeMCNode : public TeMCNodeInterface< TeMultiContainerKeyT > {
- public :
-
- /**
- * @brief Default Constructor.
- */
- TeMCNode()
- {
- obj_ptr_ = 0;
- };
-
- /**
- * @brief Default Destructor.
- */
- ~TeMCNode()
- {
- if( obj_ptr_ ) {
- delete obj_ptr_;
- }
- };
-
- /**
- * @brief Copies the the current node instance by calling
- * the operator= from the contained object instance.
- * @return A pointer to the new node copy.
- */
- TeMCNodeInterface< TeMultiContainerKeyT >* clone() const
- {
- TeMCNode< ObjectT, TeMultiContainerKeyT >* new_node_ptr =
- new TeMCNode< ObjectT, TeMultiContainerKeyT >;
-
- if( obj_ptr_ ) {
- new_node_ptr->obj_ptr_ = new ObjectT;
- ( *( new_node_ptr->obj_ptr_ ) ) = ( *obj_ptr_ );
-
- new_node_ptr->obj_type_str_ = obj_type_str_;
- }
-
- return new_node_ptr;
- };
-
- /**
- * @brief Set the internal object pointer.
- * @param ptr Object pointer.
- */
- void setObjPtr( ObjectT* ptr )
- {
- TEAGN_DEBUG_CONDITION( ptr, "Invalid pointer" )
-
- if( obj_ptr_ ) {
- delete obj_ptr_;
- }
-
- obj_ptr_ = ptr;
- obj_type_str_ = std::string( typeid( *ptr ).name() );
- };
-
- /**
- * @brief Get the internal object pointer.
- * @return The object pointer.
- */
- ObjectT* getObjPtr() const
- {
- return obj_ptr_;
- };
-
- /**
- * @brief Get the internal object type info.
- * @return The internal object type info.
- */
- const std::string& getObjTypeInfo() const
- {
- return obj_type_str_;
- };
-
- protected :
-
- /**
- * @brief The internal object pointer.
- */
- ObjectT* obj_ptr_;
-
- /**
- * @brief The internal object type.
- */
- std::string obj_type_str_;
-
- };
-
- /**
- * @brief A container class to store multiple types os object copies.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @note This is a thread-safe class.
- * @note Do not use this class with polymorphic types !!
- * @ingroup Utils
- */
- template< typename TeMultiContainerKeyT >
- class TeMultiContainer {
-
- public :
-
- /** @typedef TeSharedPtr< TeMultiContainer< TeMultiContainerKeyT > > pointer
- Type definition for a instance pointer */
- typedef TeSharedPtr< TeMultiContainer< TeMultiContainerKeyT > > pointer;
-
- /** @typedef const TeSharedPtr< TeMultiContainer< TeMultiContainerKeyT > > const_pointer
- Type definition for a const instance pointer */
- typedef const TeSharedPtr< TeMultiContainer< TeMultiContainerKeyT > > const_pointer;
-
- /**
- * @brief Default Constructor
- */
- TeMultiContainer();
-
- /**
- * @brief Alternative Constructor
- * @param external External reference.
- */
- TeMultiContainer(
- const TeMultiContainer< TeMultiContainerKeyT >& external );
-
- /**
- * @brief Default Destructor
- */
- ~TeMultiContainer();
-
- /**
- * @brief Operator == overload.
- *
- * @param ext_instance External instance reference.
- * @return true if this instance have the same internal
- * update time that the external instance.
- */
- bool operator==(
- const TeMultiContainer< TeMultiContainerKeyT >& ext_instance ) const;
-
- /**
- * @brief Operator != overload.
- *
- * @param ext_instance External instance reference.
- * @return true if this instance don't have the same internal
- * update time that the external instance.
- */
- bool operator!=(
- const TeMultiContainer< TeMultiContainerKeyT >& ext_instance ) const;
-
- /**
- * @brief operator= overload.
- *
- * @param ext_instance External instance reference.
- * @return The external instance reference.
- */
- const TeMultiContainer< TeMultiContainerKeyT >& operator=(
- const TeMultiContainer< TeMultiContainerKeyT >& ext_instance );
-
- /**
- * @brief Clear all contents.
- *
- */
- void clear();
-
- /**
- * @brief Store a object copy.
- *
- * @param obj_key Object key.
- * @param obj_reference Object instance.
- */
- template< typename ObjectT >
- void store( const TeMultiContainerKeyT& obj_key,
- const ObjectT& obj_reference );
-
- /**
- * @brief Retrive a copy of a stored object.
- *
- * @param obj_key Object key.
- * @param obj_reference Object instance.
- * @return true if OK, false if the parameter was no found or error.
- */
- template< typename ObjectT >
- bool retrive( const TeMultiContainerKeyT& obj_key,
- ObjectT& obj_reference ) const;
-
- /**
- * @brief Retrive copies of all stored objects of a defined type.
- *
- * @param objs_vector A vector with copies of all found objects.
- * @note An empty vector will be returned if no object was found.
- */
- template< typename ObjectT >
- void multiRetrive( std::vector< std::pair< TeMultiContainerKeyT,
- ObjectT > >& objs_vector ) const;
-
- /**
- * @brief Checks if a object is stored.
- *
- * @param obj_key Object key.
- * @note The object type must be specified.
- * @return true if OK, false if the object is not stored.
- */
- template< typename ObjectT >
- bool isStored( const TeMultiContainerKeyT& obj_key ) const;
-
- /**
- * @brief Remove a stored object.
- *
- * @param obj_key Object key.
- */
- void remove( const TeMultiContainerKeyT& obj_key );
-
- protected :
-
- /** @brief Internal container type definition. */
- typedef typename std::map< TeMultiContainerKeyT,
- TeMCNodeInterface< TeMultiContainerKeyT >* > IntContainerT;
-
- /** @brief The nodes container instance. */
- IntContainerT container_instance_;
-
- /**
- * @brief The last update time.
- */
- time_t last_up_time_;
-
- /**
- * @brief This instance locking mutex.
- */
- mutable TeMutex lock_instance_;
-
- /**
- * @brief Updates the internal last update time.
- *
- * @note Needed by comparison between two multi containers.
- */
- void update_time();
-
-};
-
-
-template< typename TeMultiContainerKeyT >
-TeMultiContainer< TeMultiContainerKeyT >::TeMultiContainer()
-{
- last_up_time_ = 0;
-}
-
-
-template< typename TeMultiContainerKeyT >
-TeMultiContainer< TeMultiContainerKeyT >::TeMultiContainer(
- const TeMultiContainer< TeMultiContainerKeyT >& external )
-{
- last_up_time_ = 0;
-
- operator=( external );
-}
-
-
-template< typename TeMultiContainerKeyT >
-TeMultiContainer< TeMultiContainerKeyT >::~TeMultiContainer()
-{
- clear();
-}
-
-
-template< typename TeMultiContainerKeyT >
-void TeMultiContainer< TeMultiContainerKeyT >::clear()
-{
- lock_instance_.lock();
-
- typename IntContainerT::iterator it = container_instance_.begin();
- typename IntContainerT::iterator it_end = container_instance_.end();
-
- while( it != it_end ) {
- delete (it->second);
-
- ++it;
- }
-
- container_instance_.clear();
-
- lock_instance_.unLock();
-}
-
-
-template< typename TeMultiContainerKeyT >
-bool TeMultiContainer< TeMultiContainerKeyT >::operator==(
- const TeMultiContainer< TeMultiContainerKeyT >& ext_instance ) const
-{
- if( last_up_time_ == ext_instance.last_up_time_ ) {
- return true;
- } else {
- return false;
- }
-}
-
-
-template< typename TeMultiContainerKeyT >
-bool TeMultiContainer< TeMultiContainerKeyT >::operator!=(
- const TeMultiContainer< TeMultiContainerKeyT >& ext_instance )
- const
-{
- if( last_up_time_ == ext_instance.last_up_time_ ) {
- return false;
- } else {
- return true;
- }
-}
-
-
-template< typename TeMultiContainerKeyT >
-const TeMultiContainer< TeMultiContainerKeyT >&
-TeMultiContainer< TeMultiContainerKeyT >::operator=(
- const TeMultiContainer< TeMultiContainerKeyT >& ext_instance )
-{
- if( ( &ext_instance ) != this ) {
- lock_instance_.lock();
-
- /* Clearing the current objects */
-
- typename IntContainerT::iterator my_container_it =
- container_instance_.begin();
- typename IntContainerT::iterator my_container_it_end =
- container_instance_.end();
-
- while( my_container_it != my_container_it_end ) {
- delete (my_container_it->second);
-
- ++my_container_it;
- }
-
- container_instance_.clear();
-
- /* Cloning external objects */
-
- ext_instance.lock_instance_.lock();
-
- typename IntContainerT::const_iterator container_it =
- ext_instance.container_instance_.begin();
- typename IntContainerT::const_iterator container_it_end =
- ext_instance.container_instance_.end();
-
- while( container_it != container_it_end ) {
- container_instance_[ container_it->first ] =
- container_it->second->clone();
-
- ++container_it;
- }
-
- last_up_time_ = ext_instance.last_up_time_;
-
- ext_instance.lock_instance_.unLock();
-
- lock_instance_.unLock();
- }
-
- return *this;
-}
-
-
-template< typename TeMultiContainerKeyT >
-void TeMultiContainer< TeMultiContainerKeyT >::update_time()
-{
- last_up_time_ = time( 0 );
-}
-
-
-template< typename TeMultiContainerKeyT >
-template< typename ObjectT >
-void TeMultiContainer< TeMultiContainerKeyT >::store(
- const TeMultiContainerKeyT& obj_key, const ObjectT& obj_reference )
-{
- lock_instance_.lock();
-
- /* Creating a new node */
-
- ObjectT* newobjptr = new ObjectT;
- ( *newobjptr ) = obj_reference;
-
- TeMCNode< ObjectT, TeMultiContainerKeyT >* newnodeptr =
- new TeMCNode< ObjectT, TeMultiContainerKeyT >;
- newnodeptr->setObjPtr( newobjptr );
-
- typename IntContainerT::iterator container_it =
- container_instance_.find( obj_key );
-
- /* If a old node with the same key exists, it will be deleted */
-
- if( container_it == container_instance_.end() ) {
- container_instance_[ obj_key ] = newnodeptr;
- } else {
- delete (container_it->second);
-
- container_it->second = newnodeptr;
- }
-
- update_time();
-
- lock_instance_.unLock();
-}
-
-
-template< typename TeMultiContainerKeyT >
-template< typename ObjectT >
-bool TeMultiContainer< TeMultiContainerKeyT >::retrive(
- const TeMultiContainerKeyT& obj_key, ObjectT& obj_reference ) const
-{
- lock_instance_.lock();
-
- typename IntContainerT::const_iterator container_it =
- container_instance_.find( obj_key );
-
- if( container_it == container_instance_.end() ) {
- lock_instance_.unLock();
-
- return false;
- } else {
- if( typeid( ObjectT ).name() ==
- container_it->second->getObjTypeInfo() ) {
-
- obj_reference =
- ( *( ( (TeMCNode< ObjectT, TeMultiContainerKeyT >* )
- container_it->second )->getObjPtr() ) );
-
- lock_instance_.unLock();
-
- return true;
- } else {
- lock_instance_.unLock();
-
- return false;
- }
- }
-}
-
-
-template< typename TeMultiContainerKeyT >
-template< typename ObjectT >
-void TeMultiContainer< TeMultiContainerKeyT >::multiRetrive(
- std::vector< std::pair< TeMultiContainerKeyT,
- ObjectT > >& objs_vector ) const
-{
- objs_vector.clear();
-
- lock_instance_.lock();
-
- typename IntContainerT::const_iterator container_it =
- container_instance_.begin();
- typename IntContainerT::const_iterator container_it_end =
- container_instance_.end();
-
- std::pair< TeMultiContainerKeyT, ObjectT > temp_pair;
-
- while( container_it != container_it_end ) {
- if( typeid( ObjectT ).name() ==
- container_it->second->getObjTypeInfo() ) {
-
- temp_pair.first = container_it->first;
- temp_pair.second =
- ( *( ( ( TeMCNode< ObjectT, TeMultiContainerKeyT >* )
- container_it->second )->getObjPtr() ) );
-
- objs_vector.push_back( temp_pair );
- }
-
- ++container_it;
- }
-
- lock_instance_.unLock();
-}
-
-
-template< typename TeMultiContainerKeyT >
-template< typename ObjectT >
-bool TeMultiContainer< TeMultiContainerKeyT >::isStored(
- const TeMultiContainerKeyT& obj_key ) const
-{
- lock_instance_.lock();
-
- typename IntContainerT::const_iterator container_it =
- container_instance_.find( obj_key );
-
- if( container_it == container_instance_.end() ) {
- lock_instance_.unLock();
-
- return false;
- } else {
- if( typeid( ObjectT ).name() ==
- container_it->second->getObjTypeInfo() ) {
-
- lock_instance_.unLock();
-
- return true;
- } else {
- lock_instance_.unLock();
-
- return false;
- }
- }
-}
-
-
-template< typename TeMultiContainerKeyT >
-void TeMultiContainer< TeMultiContainerKeyT >::remove(
- const TeMultiContainerKeyT& obj_key )
-{
- lock_instance_.lock();
-
- typename IntContainerT::iterator container_it =
- container_instance_.find( obj_key );
-
- /* If a old node with the same key exists, it will be deleted */
-
- if( container_it != container_instance_.end() ) {
- delete (container_it->second);
-
- container_instance_.erase( container_it );
- }
-
- update_time();
-
- lock_instance_.unLock();
-}
-
-/** @example TeMultiContainer_test.cpp
- * Shows how to use this class.
- */
-
-#endif
-
diff --git a/src/terralib/kernel/TeMultiGeometry.cpp b/src/terralib/kernel/TeMultiGeometry.cpp
index 828c131..772bd7d 100644
--- a/src/terralib/kernel/TeMultiGeometry.cpp
+++ b/src/terralib/kernel/TeMultiGeometry.cpp
@@ -1,25 +1,12 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "TeMultiGeometry.h"
diff --git a/src/terralib/kernel/TeMultiGeometry.h b/src/terralib/kernel/TeMultiGeometry.h
index 322bf86..32995f1 100644
--- a/src/terralib/kernel/TeMultiGeometry.h
+++ b/src/terralib/kernel/TeMultiGeometry.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeMultiGeometry.h
\brief This file contains structures and definitions to deal with a multigeometry.
*/
diff --git a/src/terralib/kernel/TeMutex.cpp b/src/terralib/kernel/TeMutex.cpp
deleted file mode 100644
index 925343b..0000000
--- a/src/terralib/kernel/TeMutex.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "TeMutex.h"
-
-#if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- #include <stdio.h>
-
-#elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
-#else
- #error "Unsuported plataform"
-#endif
-
-TeMutex::TeMutex()
-{
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- m_sa_.nLength = sizeof( m_sa_ );
- m_sa_.lpSecurityDescriptor = NULL;
- m_sa_.bInheritHandle = TRUE;
-
- m_access_ = ::CreateMutex( &m_sa_, false, 0 );
-
- TEAGN_TRUE_OR_THROW( ( m_access_ != 0 ),
- "Unable to create mutex object instance" )
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- pthread_mutexattr_t access_attr;
- TEAGN_TRUE_OR_THROW( ( pthread_mutexattr_init( &access_attr ) == 0 ),
- "Unable to init mutex attributes" );
-
- pthread_mutexattr_settype( &access_attr, PTHREAD_MUTEX_DEFAULT );
- TEAGN_TRUE_OR_THROW(
- ( pthread_mutex_init( &m_access_, &access_attr ) == 0 ),
- "Unable to init mutex" )
-
- #else
- #error "Unsuported plataform"
- #endif
-}
-
-
-TeMutex::~TeMutex()
-{
- unLock();
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- ::CloseHandle( m_access_ );
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- pthread_mutex_destroy( &m_access_ );
-
- #else
- #error "Unsuported plataform"
- #endif
-}
-
diff --git a/src/terralib/kernel/TeMutex.h b/src/terralib/kernel/TeMutex.h
deleted file mode 100644
index 1dd1256..0000000
--- a/src/terralib/kernel/TeMutex.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeMutex.h
- \brief This file contains definitions about a class to deal with critical
- region locking.
-*/
-
-
-#ifndef TEMUTEX_H
- #define TEMUTEX_H
-
- #include "TeAgnostic.h"
- #include "TeDefines.h"
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- #include <windows.h>
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- #include <pthread.h>
- #include <errno.h>
- #else
- #error "ERROR: Unsupported platform"
- #endif
-
- /**
- * @brief A class to deal with critical region locking.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- */
- class TL_DLL TeMutex
- {
- public :
-
- /**
- * @brief Default constructor.
- */
- TeMutex();
-
- /**
- * @brief Default destructor.
- */
- ~TeMutex();
-
- /**
- * @brief Lock the current object instance.
- * @note If section is already busy then the current thread will be
- * blocked until it's ready again.
- */
- inline void lock()
- {
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- DWORD return_value = 0;
- return_value = ::WaitForSingleObject( m_access_, INFINITE );
- TEAGN_DEBUG_CONDITION( ( ( return_value == WAIT_ABANDONED ) ||
- ( return_value == WAIT_OBJECT_0 ) ),
- "Unable to get mutex lock" );
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- pthread_mutex_lock( &m_access_ );
-
- #else
- #error "Unsuported plataform"
- #endif
- };
-
- /**
- * @brief Try to lock the current object instance.
- * @return true if OK, false if unable to lock.
- * @note If section is busy, this method will return false
- * without blocking the current thread.
- */
- inline bool tryLock()
- {
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- DWORD return_value = ::WaitForSingleObject( m_access_,
- 10 );
-
- if( ( return_value == WAIT_OBJECT_0 ) ||
- ( return_value == WAIT_ABANDONED ) ) {
-
- return true;
- } else {
- return false;
- }
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- if( pthread_mutex_trylock( &m_access_ ) == EBUSY ) {
- return false;
- } else {
- return true;
- }
-
- #else
- #error "Unsuported plataform"
- #endif
- };
-
- /**
- * @brief Unlock the current object instance.
- */
- inline void unLock()
- {
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- ::ReleaseMutex( m_access_ );
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- pthread_mutex_unlock( &m_access_ );
-
- #else
- #error "Unsuported plataform"
- #endif
- };
-
- protected :
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- /**
- * @brief The mutex instance.
- */
- HANDLE m_access_;
-
- /**
- * @brief The mutex instance attributes.
- */
- SECURITY_ATTRIBUTES m_sa_;
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- /**
- * @brief The mutex instance.
- */
- pthread_mutex_t m_access_;
-
- #else
- #error "Unsuported plataform"
- #endif
-
- private :
-
- /**
- * Alternative constructor.
- */
- TeMutex( const TeMutex& ) {};
-
-
- /**
- * operator= overload.
- * @return A const reference to the current instance.
- */
- const TeMutex& operator=( const TeMutex& ) { return *this; };
-
- };
-
-#endif
diff --git a/src/terralib/kernel/TeNeighbours.cpp b/src/terralib/kernel/TeNeighbours.cpp
deleted file mode 100644
index 49b836e..0000000
--- a/src/terralib/kernel/TeNeighbours.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeNeighbours.h"
-
-TeProxMatrixAttributes::TeProxMatrixAttributes()
-{
- _weight = 1; //default
- _slice = 1; //default
- _order = 1; //defaul
- _centroid_distance = -1.0; //not computed
- _borders_length = -1.0; //not computed
- _net_objects_distance = -1.0; //not computed
- _net_minimum_path= -1.0; //not computed
-}
-
-
-TeProxMatrixAttributes::TeProxMatrixAttributes (const TeProxMatrixAttributes& att)
-{
- _weight = att._weight;
- _slice = att._slice;
- _order = att._order;
- _centroid_distance = att._centroid_distance;
- _borders_length = att._borders_length;
- _net_objects_distance = att._net_objects_distance;
- _net_minimum_path = att._net_minimum_path;
-}
-
-
-TePropertyVector
-TeProxMatrixAttributes::getProperties ()
-{
- TePropertyVector vec;
- TeProperty prop1; prop1.value_ = Te2String (_weight); vec.push_back ( prop1 );
- TeProperty prop2; prop2.value_ = Te2String (_slice); vec.push_back ( prop2 );
- TeProperty prop3; prop3.value_ = Te2String (_order); vec.push_back ( prop3 );
- TeProperty prop4; prop4.value_ = Te2String (_borders_length); vec.push_back ( prop4 );
- TeProperty prop5; prop5.value_ = Te2String (_centroid_distance); vec.push_back ( prop5 );
- TeProperty prop6; prop6.value_ = Te2String (_net_objects_distance); vec.push_back ( prop6 );
- TeProperty prop7; prop7.value_ = Te2String (_net_minimum_path); vec.push_back ( prop7 );
- return vec;
-}
-
-
-TeProxMatrixAttributes&
-TeProxMatrixAttributes::operator= (const TeProxMatrixAttributes& att)
-{
- _weight = att._weight;
- _slice = att._slice;
- _order = att._order;
- _centroid_distance = att._centroid_distance;
- _borders_length = att._borders_length;
- _net_objects_distance = att._net_objects_distance;
- _net_minimum_path = att._net_minimum_path;
- return *this;
-}
-
-
-
-bool
-TeProxMatrixAttributes::operator==(const TeProxMatrixAttributes& att) const
-{
- return ((_weight == att._weight) &&
- (_slice == att._slice) &&
- (_order == att._order) &&
- (_centroid_distance == att._centroid_distance) &&
- (_borders_length == att._borders_length) &&
- (_net_objects_distance == att._net_objects_distance) &&
- (_net_minimum_path == att._net_minimum_path));
-}
-
-
-TeNeighbours::TeNeighbours(const TeNeighboursMap& neigh)
-{
-
- TeNeighboursMap::const_iterator pos = neigh.begin();
-
- for (pos = neigh.begin(); pos != neigh.end(); ++pos)
- _neigh.push_back(make_pair (pos->first, pos->second));
-}
-
-
-
-TeNeighbours::TeNeighbours (const TeNeighbours& neigh)
-{
- const_iterator it;
- for (it = neigh._neigh.begin(); it != neigh._neigh.end(); ++it)
- _neigh.push_back(*it);
-}
-
-
-string
-TeNeighbours::ObjectId (int n)
-{
- if (n < (int)_neigh.size())
- return _neigh[n].first;
-
- else {
- string empty;
- return empty;
- }
-}
-
-
-string
-TeNeighbours:: operator[](int n)
-{
- if (n < (int)_neigh.size())
- return _neigh[n].first;
-
- else {
- string empty;
- return empty;
- }
-}
-
-double
-TeNeighbours:: Weight (int n)
-{
- if (n < (int)_neigh.size())
- return _neigh[n].second.Weight();
-
- else
- return 0.0;
-}
-
-
-double
-TeNeighbours:: Weight (const string& object_id)
-{
- for (unsigned int i = 0; i< _neigh.size(); ++i) {
- if (object_id == _neigh[i].first)
- return _neigh[i].second.Weight();
- }
- return 0.0;
-}
-
-
-TeProxMatrixAttributes
-TeNeighbours:: Attributes (int n)
-{
- TeProxMatrixAttributes attr;
-
- if (n < (int)_neigh.size())
- return _neigh[n].second;
- else
- return attr;
-}
-
-bool
-TeNeighbours:: operator== (const TeNeighbours& neigh)
-{
- if (_neigh == neigh._neigh) return true;
- else return false;
-}
-
-
-TeNeighbours&
-TeNeighbours::operator= (const TeNeighbours& neigh)
-{
- if (*this == neigh)
- return *this;
-
- _neigh.clear();
-
- const_iterator it;
- for (it = neigh._neigh.begin(); it != neigh._neigh.end(); ++it)
- _neigh.push_back(*it);
-
- return *this;
-}
-
-
-bool
-TeNeighbours:: Insert (const string& object_id, const TeProxMatrixAttributes& attr)
-{
- for (unsigned int i = 0; i< _neigh.size(); i++) {
- if (object_id == _neigh[i].first)
- return false;
- }
- _neigh.push_back (make_pair (object_id, attr));
- return true;
-}
-
-
-bool
-TeNeighbours:: Remove (const string& object_id)
-{
- iterator it = _neigh.begin();
- while (it!= _neigh.end())
- if (object_id == (*it).first)
- {
- _neigh.erase (it);
- return true;
- }
- return false;
-}
diff --git a/src/terralib/kernel/TeNeighbours.h b/src/terralib/kernel/TeNeighbours.h
deleted file mode 100644
index 9d22dbc..0000000
--- a/src/terralib/kernel/TeNeighbours.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeNeighbours.h
- \brief This file contains structures and definitions about neighborhood
-*/
-
-#ifndef __TERRALIB_INTERNAL_NEGHBOURS_H
-#define __TERRALIB_INTERNAL_NEGHBOURS_H
-
-#include "TeUtils.h"
-#include "TeAttribute.h"
-
-#include <vector>
-#include <string>
-#include <map>
-using namespace std;
-
-
-//! Attributes associated with each neighborhood of a proximity matrix
-class TL_DLL TeProxMatrixAttributes
-{
- private:
- double _weight;
- int _slice;
- int _order;
- double _centroid_distance;
- double _borders_length;
- double _net_objects_distance;
- double _net_minimum_path;
-
-
- public:
-
- //! Empty constructor
- TeProxMatrixAttributes();
-
- //! Constructor
- TeProxMatrixAttributes(const double& w, const int& slice, const int& order,
- const double& cent_dist, const double& border_length,
- const double& net_distance, const double& net_minimun_path):
- _weight(w), _slice(slice),
- _order(order), _centroid_distance(cent_dist),
- _borders_length(border_length),
- _net_objects_distance(net_distance),
- _net_minimum_path(net_minimun_path)
- {}
-
- //! Copy constuctor
- TeProxMatrixAttributes (const TeProxMatrixAttributes& att);
-
- //! Return weight
- double Weight() {return _weight;}
-
- //! Return slice
- int Slice () {return _slice;}
-
- //! Return order
- int Order() {return _order;}
-
- //! Return border length
- double BorderLength() {return _borders_length;}
-
- //! Return centroid distance
- double CentroidDistance() {return _centroid_distance;}
-
- //! Return network objects distance
- double NetworkObjectsDistance() {return _net_objects_distance;}
-
- //! Return network minimum path
- double NetworkMinimumPath () {return _net_minimum_path;}
-
- //! Set weight
- void Weight(double w) {_weight = w;}
-
- //! Set slice
- void Slice (int s) {_slice = s;}
-
- //! Set order
- void Order(int o) {_order = o;}
-
- //! Set border length
- void BorderLength(double l) {_borders_length = l;}
-
- //! Set centroid distance
- void CentroidDistance(double d) {_centroid_distance = d;}
-
- //! Set network objects distance
- void NetworkObjectsDistance(double d) {_net_objects_distance = d;}
-
- //! Set network minimum path
- void NetworkMinimumPath (double d) {_net_minimum_path = d;}
-
- //! Return the attributes as a TePropertyVector
- TePropertyVector getProperties ();
-
- //! Return if the border length was computed
- bool WasBordersLengthComputed () {if (_borders_length == -1.0) return false; else return true;}
-
- //! Return if the centroid distance was computed
- bool WasCentroidDistanceComputed () {if (_centroid_distance == -1.0) return false; else return true;}
-
- //! Return if the network objects distance was computed
- bool WasNetworkObjectsDistanceComputed () {if (_net_objects_distance == -1.0) return false; else return true;}
-
- //! Return if the network minimal path was computed
- bool WasNetworkMinimumPathComputed () {if (_net_minimum_path == -1.0) return false; else return true;}
-
- //! Copy operator
- TeProxMatrixAttributes& operator= (const TeProxMatrixAttributes& att);
-
- //! Comparison Operator
- bool operator==(const TeProxMatrixAttributes& att) const;
-
- //! Destructor
- virtual ~TeProxMatrixAttributes() {}
-};
-
-//! A map from a object to its attributes
-typedef map<string, TeProxMatrixAttributes> TeNeighboursMap;
-
-
-//! A class to representate the neighbours of a object
-class TL_DLL TeNeighbours
-{
-private:
- typedef pair<string, TeProxMatrixAttributes> neigh_values;
- typedef vector<neigh_values> neigh_vector;
-
- neigh_vector _neigh;
-
-
-public:
-
- typedef neigh_vector::iterator iterator;
- typedef neigh_vector::const_iterator const_iterator;
-
- //! Empty constructor
- TeNeighbours () {};
-
- //! Copy constructor
- TeNeighbours(const TeNeighboursMap& neigh);
-
- //! Copy constructor
- TeNeighbours(const TeNeighbours& neigh);
-
- //! Return the number of the neighbours
- int size() const { return _neigh.size();}
-
- //! Return a iterator to the begin of the neighbours
- iterator begin() { return _neigh.begin();}
-
- //! Return a iterator to the one past end of the neighbours
- iterator end() { return _neigh.end();}
-
- //! Return the n-th neighbour object_id, if n < map size.
- string ObjectId (int n);
-
- //! Return the n-th neighbour object_id, if n < map size.
- string operator[](int n);
-
- //! Return the n-th connection weight (corresponding to the n-th neighbour), if n < map size.
- double Weight (int n);
-
- //! Return the connection weight, given the neighbour object_id
- double Weight (const string& object_id);
-
- //! Return the complete set of connection attributes (corresponding to the ith neighbour), packed in a TeProxMatrixAttributes object.
- TeProxMatrixAttributes Attributes (int n);
-
- //! Insert a new neighbour
- bool Insert (const string& object_id, const TeProxMatrixAttributes& attr);
-
- //! Remove a neighbour
- bool Remove (const string& object_id);
-
- //! Copy operator
- TeNeighbours& operator= (const TeNeighbours& neigh);
-
- //! Comparison Operator
- bool operator==(const TeNeighbours& p);
-
- //! Destructor
- virtual ~TeNeighbours() {}
-
-};
-
-#endif
diff --git a/src/terralib/kernel/TeNetwork.cpp b/src/terralib/kernel/TeNetwork.cpp
deleted file mode 100644
index 3b4a987..0000000
--- a/src/terralib/kernel/TeNetwork.cpp
+++ /dev/null
@@ -1,578 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeNetwork.h"
-#include "TeGeometryAlgorithms.h"
-#include "TeSTElementSet.h"
-#include "Gra_algo.h"
-
-
-
-TeGraphNetwork:: TeGraphNetwork (TeLineSet& ls) : graph_ (false)
-{
- TeLineSet ls2;
- ls2.copyElements(ls);
-
-// The initial and final points of each line will be the nodes
- TeLineSet::iterator it = ls2.begin();
- while (it != ls2.end())
- {
- insertLine ((*it), TeLength(*it));
- it++;
- }
-}
-
-
-TeGraphNetwork:: TeGraphNetwork (TeLineSet& ls, map<string, double>& line_costs) : graph_ (false)
-{
- if (ls.size() == line_costs.size())
- {
- TeLineSet::iterator it_line = ls.begin();
-
- while (it_line != ls.end())
- {
- string id = (*it_line).objectId ();
- map<string, double>:: iterator it_val = line_costs.find(id);
- if (it_val != line_costs.end())
- insertLine ((*it_line), (*it_val).second);
- it_line++;
- }
- }
-
-}
-
-
-bool
-TeGraphNetwork:: Add (TeLineSet& ls, map<string, double>& line_costs)
-{
- if (ls.size() == line_costs.size())
- {
- TeLineSet::iterator it_line = ls.begin();
-
- while (it_line != ls.end())
- {
- string id = (*it_line).objectId ();
- map<string, double>:: iterator it_val = line_costs.find(id);
- if (it_val != line_costs.end())
- insertLine ((*it_line), (*it_val).second);
- it_line++;
- }
- return true;
- }
- else
- return false;
-
-}
-
-
-TeGraphNetwork:: TeGraphNetwork (TeSTElementSet& stos, string& attrName) : graph_ (false)
-{
- TeSTElementSet::iterator it = stos.begin();
- while (it != stos.end())
- {
- string value;
- if ((*it).getPropertyValue (attrName, value))
- {
- double val = atof(value.c_str());
- TeLineSet objGeom;
- if ((*it).getGeometry(objGeom))
- {
- double total_length = 0.0;
- TeLineSet::iterator it_geom = objGeom.begin();
- while (it_geom != objGeom.end())
- {
- total_length += TeLength (*it_geom);
- it_geom++;
- }
-
- it_geom = objGeom.begin();
- while (it_geom != objGeom.end())
- {
- double w = TeLength(*it_geom)/total_length;
- insertLine (*it_geom, val*w);
- it_geom++;
- }
- }
- }
- ++it;
- }
-}
-
-
-void
-TeGraphNetwork:: insertLine (TeLine2D& line, const double& attr)
-{
-
- // Change line identifiers, to allow lines from different layers
- int j = line_set_.size();
- string line_objId = "l" + Te2String (j);
- line.objectId (line_objId);
-
-
- // The initial and final nodes will be the first and last points of the line
- TeNode n1;
- n1.add(line.first());
- string id1 = line.objectId() + "_p1";
- n1.objectId (id1);
- n1.geomId (0);
-
- TeNode n2;
- n2.add(line.last());
- string id2 = line.objectId() + "_p2";
-
- n2.objectId (id2);
- n2.geomId (0);
-
- for (unsigned int i = 0; i < graph_.size(); i++)
- {
- if (TeDistance (line.first(), graph_[i].first.location()) < 0.001)
- n1 = graph_[i].first;
-
- if (TeDistance (line.last(), graph_[i].first.location()) < 0.001)
- n2 = graph_[i].first;
- }
-
- if (n1 == n2)
- {
- cout << "linha circular" << endl;
- }
- else
- {
- graph_.insert (n1, n2, attr); // if graph is non-directed, edge from n2 to n1 will also be added
- line_cost_ [line.objectId()] = attr;
- line_set_.add (line);
- }
-
-}
-
-
-
-bool
-TeGraphNetwork:: minimumPath (TeNode& n1, TeNodeSet& nodeSet,vector<double>& result)
-{
- vector<double> dist;
- vector<int> pred;
-
- // Compute minimum path to all vertex
- unsigned int j = 0;
- br_stl::Graph<TeNode, double>::iterator it = graph_.begin();
- while (it != graph_.end())
- {
- if ((*it).first == n1)
- it = graph_.end();
- else
- {
- it++;
- j++;
- }
- }
- if (j == graph_.size()) return false;
-
- br_stl::Dijkstra<br_stl::Graph<TeNode, double>, double> (graph_, dist, pred, j);
-
- for (unsigned int i = 0; i< nodeSet.size(); i++)
- {
- br_stl::Graph<TeNode, double>::iterator it = graph_.begin();
- unsigned int vertex = 0;
- while (it != graph_.end())
- {
- if ((*it).first == nodeSet[i])
- it = graph_.end();
- else
- {
- it++;
- vertex++;
- }
- }
-
- if (vertex == graph_.size()) return false;
- result.push_back (dist[vertex]);
- }
-
-
- return true;
-
-}
-
-bool
-TeGraphNetwork::getNode (int i, TeNode& node)
-{
- if ((i >0) && (i < (int) graph_.size()))
- {
- node = graph_[i].first;
- return true;
- }
- else
- return false;
-}
-
-bool
-TeGraphNetwork:: nearestNodePoint (TeCoord2D& p1, int& index, TeCoord2D& p2, double& distance, double tol)
-{
- TeNodeSet node_set;
- for (unsigned int i = 0; i < graph_.size(); i++)
- node_set.add (graph_[i].first);
-
- if (node_set.size() == 0) return false;
-
- TeNearest (p1, node_set, index, tol);
- p2 = node_set[index].elem();
- distance = TeDistance (p1, p2);
- return true;
-}
-
-
-
-
-
-bool
-TeGraphNetwork:: breakLineSet (TeNode& node, int line)
-{
-
- if ((line >= 0) && (line < (int) line_set_.size()))
- {
- // Break line
- int segment;
- if (TeLocateLineSegment (node.location(), line_set_[line], segment, 0.001))
- {
- if (segment <= (int) (line_set_[line].size()) - 2)
- {
- TeLine2D l1, l2;
- int j = 0;
- TeLine2D::iterator it = line_set_[line].begin();
-
- while (j <= segment)
- {
- l1.add (*it);
- it++;
- j++;
- }
-
- l1.add (node.location());
- l2.add (node.location ());
-
- while (it != line_set_[line].end())
- {
- l2.add (*it);
- it++;
- }
-
- string old_line_id = line_set_[line].objectId();
- string line1_id = old_line_id + "l1";
- string line2_id = old_line_id + "l2";
-
- l1.objectId(line1_id);
- l2.objectId(line2_id);
-
- // Compute proportional costs for broken lines
-
- double d1 = TeLength (l1);
- double d2 = TeLength (l2);
- double d_tot = TeLength (line_set_[line]);
-
- double w1 = d1/d_tot;
- double w2 = d2/d_tot;
-
- double val1 = w1*line_cost_[old_line_id];
- double val2 = w2*line_cost_[old_line_id];
-
- // update line cost
-
- line_cost_[line1_id] = val1;
- line_cost_[line2_id] = val2;
- line_cost_.erase (old_line_id);
-
- // update line set
-
- line_set_.add (l1);
- line_set_.add (l2);
- line_set_.erase (line);
-
- return true;
- }
- else return false;
- }
- else return false;
- }
- else return false;
-}
-
-
-
-
-bool
-TeGraphNetwork:: nearestNetworkPoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol)
-{
- if (line_set_.size() == 0) return false;
- return TeNearest (p1, line_set_, lindex, pinter, distance, tol);
-
- bool TeNearest(TeCoord2D& pt, TeLineSet& ls , int& i, TeCoord2D& pi, const double& tol);
-
-}
-
-
-///////////////////////////////////// Old version - not modified
-
-TeNetwork:: TeNetwork (TeLineSet& ls) : graph_ (false)
-{
- line_set_ = ls;
-
-
- // The initial and final points of each line will be the nodes
- TeLineSet::iterator it = ls.begin();
- int j = 0;
- while (it != line_set_.end())
- {
- string line_objId = "l" + Te2String (j);
- (*it).objectId (line_objId); //ANAP: modified to be able to use more than on layer.
- TeLine2D line = (*it);
-
- TeNode n1;
- n1.add(line.first());
- string id1 = line.objectId() + "_p1";
- n1.objectId (id1);
- n1.geomId (0);
-
- TeNode n2;
- n2.add(line.last());
- string id2 = line.objectId() + "_p2";
- n2.objectId (id2);
- n2.geomId (0);
-
- for (unsigned int i = 0; i < graph_.size(); i++)
- {
- if (TeDistance (line.first(), graph_[i].first.location()) < 0.01)
- n1 = graph_[i].first;
-
- if (TeDistance (line.last(), graph_[i].first.location()) < 0.01)
- n2 = graph_[i].first;
- }
-
- graph_.insert (n1, n2, TeLength(line));
-
- TeArc arc (n1, n2);
- // This is kept for updating purposes
- arcs_map_[line.objectId()] = arc;
- it++;
- j++;
- }
-}
-
-void
-TeNetwork:: insertLine (TeLine2D& line, const double& attr)
-{
-
- int j = line_set_.size();
-
- // The initial and final points of each line will be the nodes
- string line_objId = "l" + Te2String (j);
- line.objectId (line_objId); //ANAP: modified to be able to use more than one layer.
-
- TeNode n1;
- n1.add(line.first());
- string id1 = line.objectId() + "_p1";
- n1.objectId (id1);
- n1.geomId (0);
-
- TeNode n2;
- n2.add(line.last());
- string id2 = line.objectId() + "_p2";
-
- n2.objectId (id2);
- n2.geomId (0);
-
- for (unsigned int i = 0; i < graph_.size(); i++)
- {
- if (TeDistance (line.first(), graph_[i].first.location()) < 0.01)
- n1 = graph_[i].first;
-
- if (TeDistance (line.last(), graph_[i].first.location()) < 0.01)
- n2 = graph_[i].first;
- }
-
- graph_.insert (n1, n2, attr);
-
- TeArc arc (n1, n2);
- // This is kept for updating purposes
- arcs_map_[line.objectId()] = arc;
- line_set_.add (line);
-
-}
-
-
-bool
-TeNetwork:: insertNode (TeNode& node, int line)
-{
- if ((line >= 0) && (line < (int) line_set_.size()))
- {
- // Break line
- int segment;
- if (TeLocateLineSegment (node.location(), line_set_[line], segment, 0.001))
- {
- if (segment <= (int) (line_set_[line].size()) - 2)
- {
- TeLine2D l1, l2;
- int j = 0;
- TeLine2D::iterator it = line_set_[line].begin();
-
- while (j <= segment)
- {
- l1.add (*it);
- it++;
- j++;
- }
-
- l1.add (node.location());
- l2.add (node.location ());
-
- while (it != line_set_[line].end())
- {
- l2.add (*it);
- it++;
- }
-
- // get new and old lines ids
-
- string old_line_id = line_set_[line].objectId();
- string line1_id = old_line_id + "l1";
- string line2_id = old_line_id + "l2";
-
- l1.objectId(line1_id);
- l2.objectId(line2_id);
-
- // update line set
- line_set_.add (l1);
- line_set_.add (l2);
- line_set_.erase (line);
-
- // update map_nodes
- TeArc arc1 (arcs_map_[old_line_id].toNode(), node);
- arcs_map_[line1_id] = arc1;
-
- TeArc arc2 (arcs_map_[old_line_id].fromNode(),node);
- arcs_map_[line2_id] = arc2;
- arcs_map_.erase(old_line_id);
-
-
-/* // insert new arc connection in the network
- graph_.insert (arcs_map_ [old_line_id].fromNode(),node, l1.length());
- graph_.insert (arcs_map_ [old_line_id].toNode(), node, l2.length());
- // graph_.remove (arcs_map_[old_line_id].fromNode(), _map_nodes[old_line_id].toNode());
-
-
-*/
- return true;
- }
- else return false;
- }
- else return false;
- }
- else return false;
-}
-
-
-bool
-TeNetwork::getNode (int i, TeNode& node)
-{
- if ((i >0) && (i < (int) graph_.size()))
- {
- node = graph_[i].first;
- return true;
- }
- else
- return false;
-}
-
-
-bool
-TeNetwork:: minimumPath (TeNode& n1, TeNodeSet& nodeSet,vector<double>& result)
-{
- vector<double> dist;
- vector<int> pred;
-
- // Compute minimum path to all vertex
- unsigned int j = 0;
- br_stl::Graph<TeNode, double>::iterator it = graph_.begin();
- while (it != graph_.end())
- {
- if ((*it).first == n1)
- it = graph_.end();
- else
- {
- it++;
- j++;
- }
- }
- if (j == graph_.size()) return false;
-
- br_stl::Dijkstra<br_stl::Graph<TeNode, double>, double> (graph_, dist, pred, j);
-
- for (unsigned int i = 0; i< nodeSet.size(); i++)
- {
- br_stl::Graph<TeNode, double>::iterator it = graph_.begin();
- unsigned int vertex = 0;
- while (it != graph_.end())
- {
- if ((*it).first == nodeSet[i])
- it = graph_.end();
- else
- {
- it++;
- vertex++;
- }
- }
-
- if (vertex == graph_.size()) return false;
- result.push_back (dist[vertex]);
- }
-
-
- return true;
-
-}
-
-
-bool
-TeNetwork:: nearestNodePoint (TeCoord2D& p1, int& index, TeCoord2D& p2, double& distance, double tol)
-{
- TeNodeSet node_set;
- for (unsigned int i = 0; i < graph_.size(); i++)
- node_set.add (graph_[i].first);
-
- if (node_set.size() == 0) return false;
-
- TeNearest (p1, node_set, index, tol);
- p2 = node_set[index].elem();
- distance = TeDistance (p1, p2);
- return true;
-}
-
-bool
-TeNetwork:: nearestNetworkPoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol)
-{
- if (line_set_.size() == 0) return false;
- return TeNearest (p1, line_set_, lindex, pinter, distance, tol);
-
- bool TeNearest(TeCoord2D& pt, TeLineSet& ls , int& i, TeCoord2D& pi, const double& tol = 0.0);
-
-}
diff --git a/src/terralib/kernel/TeNetwork.h b/src/terralib/kernel/TeNetwork.h
deleted file mode 100644
index 7ad4c4e..0000000
--- a/src/terralib/kernel/TeNetwork.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeNetwork.h
- \brief This file defines class for handling networks in Terralib
-*/
-#ifndef TeNetwork_H
-#define TeNetwork_H
-
-#include "TeGeometry.h"
-#include "graph.h"
-
-class TeSTElementSet;
-
-
-//! class for handling networks
-class TL_DLL TeGraphNetwork
-{
-protected:
- //! Set of nodes and the cost of each edge
- br_stl::Graph<TeNode, double> graph_;
-
- //! Set of geometric representation of edges
- TeLineSet line_set_;
-
- //! A map to associate each edge (line object_id) to its cost
- map<string, double> line_cost_;
-
-
-public:
-
- //! Empty constructor
- TeGraphNetwork() : graph_ (true) {}; // directed graph
-
-
- //! Create a graph from TeLineSet; the line size is considered the cost. In this case, graph non-directed.
- TeGraphNetwork (TeLineSet& ls);
-
-
- //! Create a graph from TeLineSet; the cost is given by the map.
- TeGraphNetwork (TeLineSet& ls, map<string, double>& line_costs);
-
-
- //! Create a network from a set of line objects; the cost is given by the attrName sto property. The graph is non-directed.
- TeGraphNetwork (TeSTElementSet& stos, string& attrName);
-
-
- //! Assignment operator
- TeGraphNetwork& operator=(TeGraphNetwork& other)
- {
- if(this != &other)
- {
- graph_ = other.graph_;
- line_set_ = other.getLineSet();
- line_cost_ = other.getLineCosts();
- }
- return (*this);
- }
-
- //! Add lineset to graph. Useful specially for directed graphs (lines must be entered in both directions. It has to be tested for existing graphs.
- bool Add (TeLineSet& ls, map<string, double>& line_costs);
-
- //! Calculate the minimun path
- bool minimumPath (TeNode& n1, TeNodeSet& set, vector<double>& dist);
-
- //! Get the i-th node
- bool getNode (int i, TeNode& node);
-
- //! Get the nearest network node of a specific point (p1)
- bool nearestNodePoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
-
- //! Get the nearest network lines point from a specific point (p1)
- bool nearestNetworkPoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
-
- //! Get line Set
- TeLineSet getLineSet () { return line_set_;}
-
- //! Get line costs
- map<string, double> getLineCosts () {return line_cost_;}
-
- //! Insert a new line
- void insertLine (TeLine2D& line, const double& attr);
-
- //! Insert a new node
- bool breakLineSet (TeNode& node, int i); //maybe should be done externally.
-
- //! Destructor
- virtual ~TeGraphNetwork () {}
-
-};
-
-
-//! class for handling networks
-class TL_DLL TeNetwork
-{
-private:
- //! Set of nodes and the cost of each edge
- br_stl::Graph<TeNode, double> graph_;
-
- //! Set of edges
- TeLineSet line_set_;
-
- //! A map to associate each edge (line object_id) to its arc
- map<string, TeArc> arcs_map_;
-
-public:
- //! Empty constructor
- TeNetwork() : graph_ (false) { };
-
- //! Create a graph from TeLineSet, the line size is considered the cost
- TeNetwork (TeLineSet& ls);
-
- //! Calculate the minimun path
- bool minimumPath (TeNode& n1, TeNodeSet& set, vector<double>& dist);
-
-
- //! Insert a new line
- void insertLine (TeLine2D& line, const double& attr);
-
-
- //! Insert a new node
- bool insertNode (TeNode& node, int i);
-
- //! Get the i-th node
- bool getNode (int i, TeNode& node);
-
- //! Get the nearest network point of a specific point (p1)
- bool nearestNetworkPoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
-
- //! Get the nearest network node of a specific point (p1)
- bool nearestNodePoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
-
- //! Destructor
- virtual ~TeNetwork () {}
-
- //! Get line Set
- TeLineSet getLineSet () { return line_set_;}
-
-};
-
-#endif
diff --git a/src/terralib/kernel/TeOverlay.cpp b/src/terralib/kernel/TeOverlay.cpp
deleted file mode 100644
index 02708ff..0000000
--- a/src/terralib/kernel/TeOverlay.cpp
+++ /dev/null
@@ -1,763 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-// TerraLib's include
-#include "TeOverlay.h"
-#include "TeOverlayUtils.h"
-#include "TeIntersector.h"
-#include "TeGeometryAlgorithms.h"
-#include "TeFragmentation.h"
-#include "TeRTree.h"
-
-//---------------- Overlay operations ----------------//
-
-// Operacao de uniao otimizada: consome memoria!
-bool TeOVERLAY::TeUnion(TePolygonSet& polsIn, TePolygonSet& polsOut, const bool& makeCopy, const bool fixOrientation)
-{
-// limpa a lista de saida
- polsOut.clear();
-
-// verifica se e necessario realizar uma copia dos pol�gonos
- TePolygonSet polygonSetIn;
-
- if(makeCopy)
- {
- if(!TeOVERLAY::TeClonePolygonSet(polsIn, polygonSetIn))
- return false;
- //polygonSetIn.copyElements(polsIn);
- }
- else
- {
- polygonSetIn = polsIn;
- }
-
- if(polygonSetIn.empty())
- return false;
-
- if(polygonSetIn.size() == 1)
- {
- polsOut.copyElements(polygonSetIn);
-
- return true;
- }
-
-// verifica a orientacao de cada linha se necessario: aneis externos devem estar no sentido horario e os internos devem estar no sentido anti-horario
- if(fixOrientation)
- TeFixOrientation(polygonSetIn, TeCOUNTERCLOCKWISE, TeCLOCKWISE);
-
-// cria uma arvore que indexara os segmentos de cada linha e
-// chama uma rotina que calcula os pontos de intersecao e ja indexa os segmentos
- TeINTERSECTOR2::TeSegmentRTree segmentTree(polygonSetIn.box());
-
- TeINTERSECTOR2::TeVectorBoundaryIP report;
-
- TeINTERSECTOR2::TeIntersection(polygonSetIn, segmentTree, report);
-
-// fragmenta as linhas
- TeLineSet fragments;
- TeLineSet boundaryFragments;
- vector<pair<unsigned int, unsigned int> > fragmentsIds;
- vector<pair<unsigned int, unsigned int> > boundaryFragmentsIds;
-
- TeFragmentBoundary(polygonSetIn, report, boundaryFragments, boundaryFragmentsIds, fragments, fragmentsIds);
-
- report.clear();
-
- short mask = TeUNKNOWNPOSITION;
-
-// os fragmentos de fronteira ja sao separados
- TeLineIndex boundaryFragmentsIndex;
- unsigned int i;
- if(boundaryFragments.size())
- {
- mask = TeBOUNDARY;
-
- unsigned int boundaryFragmentsSize = boundaryFragments.size();
-
- for(i = 0; i < boundaryFragmentsSize; ++i)
- boundaryFragmentsIndex.insert(TeLineIndex::value_type(boundaryFragments[i][0], pair<unsigned int, TeLine2D>(i, boundaryFragments[i])));
- }
-
-// escolhe os fragmentos que estiverem localizados dentro de cada pol�gono
- short locationFragments = TeOUTSIDE;
-
- TeLineIndex fragmentsIndex;
-
- vector<TeLinearRing> rings;
-
- TeRtreeGetFragments(polygonSetIn, segmentTree, fragments, fragmentsIds, locationFragments, mask, fragmentsIndex, rings);
-
- // Tenta eliminar fragmentos de fronteira no mesmo sentido, deixando apenas um nesta direcao
- TeRemoveSameBoundaryFragments(boundaryFragmentsIndex);
-
- // Tenta eliminar fragmentos sobre fronteira opostos
- TeRemoveOpositeBoundaryFragments(boundaryFragmentsIndex);
-
- //--remover do boundaryfragments os fragmentos removidos do boundaryFragmentsIndex
- TeRtreeRemoveFragments(polygonSetIn, segmentTree, boundaryFragmentsIndex, boundaryFragmentsIds, TeINSIDE, mask, rings);
- segmentTree.clear();
-
-// Faz um merge dos fragmentos de fronteira para o �ndice de fragmentos normal
- TeJoinFragments(fragmentsIndex, boundaryFragmentsIndex);
-
-// monta os poligonos a partir dos fragmentos
- bool returnValue = TeMergeFragments(fragmentsIndex, rings, true);
-
- vector<TeLinearRing> ringsOut;
-
- bool resultSplit = true;
-
- if(TeOVERLAY::TeSplitRings(rings, ringsOut) == false)
- {
- ringsOut.clear();
-
- ringsOut = rings;
-
- resultSplit = false;
- }
-
-// separate holes from islands
- vector<TeLinearRing> holes;
-
- bool result = TeClassifyRings(ringsOut, polsOut, holes);
-
-// mount topology
- if((polsOut.size() == 0) && (holes.size() == 0))
- {
- return false; // Na uniao deve haver a formacao de poligonos
- }
-
- bool mountResult = TeMountTopology(polsOut, holes);
-
- return (returnValue && result && mountResult && resultSplit);
-}
-
-
-// Operacao geral de conjunto: uniao, intersecao e diferenca
-bool TeOverlay(TePolygonSet& redPols, vector<TePolygonSet>& bluePols, vector<TePolygonSet>& vecPolsOut, vector<bool>& resultVec, const short& operation, const bool& makeCopy, const bool fixOrientation)
-{
-// limpa a saida
- vecPolsOut.clear();
- resultVec.clear();
-
-// verifica se a lista dos poligonos vermelhos esta vazia
- unsigned int numBluePols = bluePols.size();
- unsigned int i;
-
- if(redPols.empty())
- {
-// se os poligonos vermelhos nao foram informados, no caso da uniao tenta copiar os azuis para o vetor de saida
- if(operation == TeUNION)
- {
- for(i = 0; i < numBluePols; ++i)
- {
- TePolygonSet bluePolsInAux;
-
- if(!TeOVERLAY::TeClonePolygonSet(bluePols[i], bluePolsInAux))
- return false;
-
- //bluePolsInAux.copyElements(bluePols[i]);
-
-// se nao existir tambem o poligono azul, entao retirn falso
- vecPolsOut.push_back(bluePolsInAux);
- resultVec.push_back (true);
- }
-
- if(vecPolsOut.empty())
- return false;
-
- return true;
- }
-
-// TeDIFFERENCE ou TeINTERSECTION: resultado eh vazio, logo ja retorna true
- return true;
- }
-
-
-// Defines location to choose fragments
- short locationRedFragments = TeINSIDE;
- short locationBlueFragments = TeINSIDE;
-
- TeOVERLAY::TeChooseBoundaryLocation(operation, locationRedFragments, locationBlueFragments);
-
-// verifica se e necessario realizar uma copia dos poligonos
- TePolygonSet redPolsIn;
- vector<TePolygonSet> bluePolsIn;
-
- if(makeCopy)
- {
- if(!TeOVERLAY::TeClonePolygonSet(redPols, redPolsIn))
- return false;
-
- //redPolsIn.copyElements(redPols);
-
- for(i = 0; i < numBluePols; ++i)
- {
- TePolygonSet bluePolsInAux;
-
- if(!TeOVERLAY::TeClonePolygonSet(bluePols[i], bluePolsInAux))
- return false;
-
- //bluePolsInAux.copyElements(bluePols[i]);
-
- bluePolsIn.push_back(bluePolsInAux);
- }
- }
- else
- {
- redPolsIn = redPols;
-
- bluePolsIn = bluePols;
- }
-
-
-// verifica a orientacao de cada linha se necessario: aneis externos devem estar no sentido horario e os internos devem estar no sentido anti-horario
- if(fixOrientation)
- {
- if(operation == TeINTERSECTION || operation == TeUNION)
- {
- TeOVERLAY::TeFixOrientation(redPolsIn, TeCOUNTERCLOCKWISE, TeCLOCKWISE);
-
- for(i = 0; i < numBluePols; ++i)
- TeOVERLAY::TeFixOrientation(bluePolsIn[i], TeCOUNTERCLOCKWISE, TeCLOCKWISE);
- }
- else
- {
- TeOVERLAY::TeFixOrientation(redPolsIn, TeCOUNTERCLOCKWISE, TeCLOCKWISE);
-
- for(i = 0; i < numBluePols; ++i)
- TeOVERLAY::TeFixOrientation(bluePolsIn[i], TeCLOCKWISE, TeCOUNTERCLOCKWISE);
- }
- }
-
-
-// cria uma arvore que indexara os segmentos dos poligonos vermelhos
- TeINTERSECTOR2::TeSegmentRTree redSegmentTree(redPolsIn.box());
- TeINTERSECTOR2::TeIndexPolygonSet(redPolsIn, redSegmentTree);
-
- bool resultValue = true;
-
-// para cada conjunto de poligonos azuis, faz a operacao dele com os vermelhos
- for(i = 0; i < numBluePols; ++i)
- {
-// verifica se tem poligonos no polygonset azul
- if(bluePolsIn[i].empty())
- {
- if((operation == TeUNION) || (operation == TeDIFFERENCE))
- {
- vecPolsOut.push_back(redPolsIn);
- resultVec.push_back(true); // mario - 2006-03
- }
- else
- {
- TePolygonSet emptySet;
-
- vecPolsOut.push_back(emptySet);
- resultVec.push_back(true); // mario - 2006-03
- }
-
- continue;
- }
-
-// Indexa os segmentos azuis
- TeINTERSECTOR2::TeSegmentRTree blueSegmentTree(bluePolsIn[i].box());
- TeINTERSECTOR2::TeIndexPolygonSet(bluePolsIn[i], blueSegmentTree);
-
-// calcula os potos de intersecao dos vermelhos com os azuis
- TeINTERSECTOR2::TeVectorBoundaryIP report;
- TeINTERSECTOR2::TeIntersection(redPolsIn, redSegmentTree, bluePolsIn[i], report);
-
-// fragmenta as linhas vermelhas
- TeLineSet redFragments;
- TeLineSet redBoundaryFragments;
- vector<pair<unsigned int, unsigned int> > redFragmentsIds;
- vector<pair<unsigned int, unsigned int> > boundaryFragmentsIds;
-
- TeFragmentBoundary(redPolsIn, report, redBoundaryFragments, boundaryFragmentsIds, redFragments, redFragmentsIds);
-
- short mask = TeUNKNOWNPOSITION;
-
-// os fragmentos de fronteira ja sao separados
- TeOVERLAY::TeLineIndex boundaryFragmentsIndex;
-
- unsigned int boundaryId_ = 0;
-
- if(redBoundaryFragments.size())
- {
- mask = TeBOUNDARY;
-
- unsigned int boundaryFragmentsSize = redBoundaryFragments.size();
-
- for(unsigned int ti = 0; ti < boundaryFragmentsSize; ++ti)
- {
- boundaryFragmentsIndex.insert(TeOVERLAY::TeLineIndex::value_type(redBoundaryFragments[ti][0], pair<unsigned int, TeLine2D>(boundaryId_, redBoundaryFragments[ti])));
- ++boundaryId_;
- }
- }
-
-// escolhe os fragmentos vermelhos que estiverem localizados dentro/fora (dependendo da oparacao) dos poligonos azuis
- vector<TeLinearRing> rings;
-
- TeOVERLAY::TeLineIndex fragmentsIndex;
-
- TeOVERLAY::TeRtreeGetFragments(bluePolsIn[i], blueSegmentTree, redFragments, locationRedFragments, mask, fragmentsIndex, rings);
-
-// inverte a ordem dos pontos de intersecao para fragmentar as linhas azuis
- TeINTERSECTOR2::TeVectorBoundaryIP::iterator it = report.begin();
- TeINTERSECTOR2::TeVectorBoundaryIP::iterator it_end = report.end();
-
- while(it != it_end)
- {
- swap(it->bluePolNum_, it->redPolNum_);
- swap(it->bluePartNum_, it->redPartNum_);
- swap(it->blueSegNum_, it->redSegNum_);
-
- if(it->coords_.size() == 2) //overlap
- {
- // Verificar se os pontos estao em ordem crescente
- if(it->coords_[0].x_ < it->coords_[1].x_)
- {
- }
- else if(it->coords_[0].x_ > it->coords_[1].x_)
- {
- swap(it->coords_[0], it->coords_[1]);
- }
- else if(it->coords_[0].y_ < it->coords_[1].y_)
- {
-
- }
- else
- {
- swap(it->coords_[0], it->coords_[1]);
- }
- }
-
- ++it;
- }
-
-// fragmenta as linhas azuis
- TeLineSet blueFragments;
- TeLineSet blueBoundaryFragments;
- vector<pair<unsigned int, unsigned int> > blueFragmentsIds;
- boundaryFragmentsIds.clear();
-
- TeFragmentBoundary(bluePolsIn[i], report, blueBoundaryFragments, boundaryFragmentsIds, blueFragments, blueFragmentsIds);
-
- report.clear();
-
- mask = TeUNKNOWNPOSITION;
-
-// os fragmentos de fronteira ja sao separados
- if(blueBoundaryFragments.size())
- {
- mask = TeBOUNDARY;
-
- unsigned int boundaryFragmentsSize = blueBoundaryFragments.size();
-
- for(unsigned int ti = 0; ti < boundaryFragmentsSize; ++ti)
- {
- boundaryFragmentsIndex.insert(TeOVERLAY::TeLineIndex::value_type(blueBoundaryFragments[ti][0], pair<unsigned int, TeLine2D>(boundaryId_, blueBoundaryFragments[ti])));
- ++boundaryId_;
- }
- }
-
-// escolhe os fragmentos vermelhos que estiverem localizados fora dos poligonos azuis - fragmenta as linhas vermelhas
- TeRtreeGetFragments(redPolsIn, redSegmentTree, blueFragments, locationBlueFragments, mask, fragmentsIndex, rings);
-
-// libera a memoria usada pelos indice azul
- blueSegmentTree.clear();
-
-// tenta eliminar fragmentos de fronteira no mesmo sentido, deixando apenas um nesta direcao
- TeRemoveSameBoundaryFragments(boundaryFragmentsIndex);
-
-// tenta eliminar fragmentos sobre fronteira opostos
- TeRemoveOpositeBoundaryFragments(boundaryFragmentsIndex);
-
-// faz um merge dos fragmentos de fronteira para o indice de fragmentos normal
- TeJoinFragments(fragmentsIndex, boundaryFragmentsIndex);
-
-// monta os poligonos a partir dos fragmentos
- bool returnValue = TeMergeFragments(fragmentsIndex, rings, true);
-
- // faz o split
- vector<TeLinearRing> ringsOut;
-
- bool resultSplit = true;
-
- if(TeOVERLAY::TeSplitRings(rings, ringsOut) == false)
- {
- ringsOut.clear();
-
- ringsOut = rings;
-
- resultSplit = false;
- }
-
-// separate holes from islands
- vector<TeLinearRing> holes;
- TePolygonSet polsOut;
-
- bool result = TeOVERLAY::TeClassifyRings(ringsOut, polsOut, holes);
-
- returnValue = returnValue && result && resultSplit;
-
-// mount topology
- if((polsOut.size() == 0) && (holes.size() == 0))
- {
- if(operation == TeUNION)
- {
- resultVec.push_back(false); // mario - 2006-03
- resultValue = false; // uniao nao pode dar vazio
- }
- else
- {
- resultVec.push_back(returnValue); // mario - 2006-03
- resultValue = (resultValue && returnValue); // Diferenca e intersecao podem retornar vazio
- }
-
- vecPolsOut.push_back(polsOut); // only to mark result
- }
- else
- {
- bool mountResult = TeOVERLAY::TeMountTopology(polsOut, holes);
-
- resultVec.push_back(returnValue && mountResult); // mario - 2006-03
-
- resultValue = resultValue && returnValue && mountResult;
-
- vecPolsOut.push_back(polsOut);
- }
-
- }
-
- redSegmentTree.clear();
-
- return resultValue;
-}
-
-bool TeOVERLAY::TeIntersection(TePolygonSet& redPols, vector<TePolygonSet>& bluePols, vector<TePolygonSet>& vecPolsOut, vector<bool>& resultVec, const bool& makeCopy, const bool fixOrientation)
-{
- return TeOverlay(redPols, bluePols, vecPolsOut, resultVec, TeINTERSECTION, makeCopy, fixOrientation);
-}
-
-bool TeOVERLAY::TeUnion(TePolygonSet& redPols, vector<TePolygonSet>& bluePols, vector<TePolygonSet>& vecPolsOut, vector<bool>& resultVec, const bool& makeCopy, const bool fixOrientation)
-{
- return TeOverlay(redPols, bluePols, vecPolsOut, resultVec, TeUNION, makeCopy, fixOrientation);
-}
-
-bool TeOVERLAY::TeDifference(TePolygonSet& redPols, vector<TePolygonSet>& bluePols, vector<TePolygonSet>& vecPolsOut, vector<bool>& resultVec, const bool& makeCopy, const bool fixOrientation)
-{
- return TeOverlay(redPols, bluePols, vecPolsOut, resultVec, TeDIFFERENCE, makeCopy, fixOrientation);
-}
-
-// deprecated functions
-bool TeOVERLAY::TeOverlay(const TePolygonSet& redPols, const TePolygonSet& bluePols, TePolygonSet& polsOut, const short& operation)
-{
- vector<TePolygonSet> bluePolsVec;
- bluePolsVec.push_back(bluePols);
- vector<TePolygonSet> resultPols;
- TePolygonSet redPolsAux = redPols;
- vector<bool> resultVec;
-
- bool result = TeOverlay(redPolsAux, bluePolsVec, resultPols, resultVec, operation, true, true);
-
- if(resultPols.size() > 0)
- polsOut = resultPols[0];
-
- return result;
-}
-
-bool TeOVERLAY::TeUnion(TePolygonSet& redPols, TePolygonSet& bluePols, TePolygonSet& polsOut)
-{
- return TeOVERLAY::TeOverlay(redPols, bluePols, polsOut, TeUNION);
-}
-
-bool TeOVERLAY::TeIntersection(TePolygonSet& redPols, TePolygonSet& bluePols, TePolygonSet& polsOut)
-{
- return TeOVERLAY::TeOverlay(redPols, bluePols, polsOut, TeINTERSECTION);
-}
-
-bool TeOVERLAY::TeDifference(TePolygonSet& redPols, TePolygonSet& bluePols, TePolygonSet& polsOut)
-{
- return TeOVERLAY::TeOverlay(redPols, bluePols, polsOut, TeDIFFERENCE);
-}
-
-TeMultiGeometry TeOverlay(const TeLineSet& redLinesIn, const TePolygonSet& bluePolsIn, TeINTERSECTOR2::TeSegmentRTree& blueTree, const short& operation)
-{
-// short location = TeUNKNOWNPOSITION;
- short locationRedFragments = TeUNKNOWNPOSITION;
- short locationBlueFragments = TeUNKNOWNPOSITION;
-
- TeMultiGeometry mGeom;
-
- TeLineSet redLines;
- TePolygonSet bluePols;
-
-// copia o conteudo das linhas de entrada
- redLines.copyElements(redLinesIn);
-
-// copia o conteudo dos poligonos de entrada
- bluePols.copyElements(bluePolsIn);
-
-// determina a localizacao dos fragmentos que serao utilizados
- TeOVERLAY::TeChooseBoundaryLocation(operation, locationRedFragments, locationBlueFragments);
-
-// gets intersection list
- TeINTERSECTOR2::TeVectorBoundaryIP report;
-
- TeINTERSECTOR2::TeIntersection(redLines, bluePols, blueTree, report);
-
-// fragment lines
- TeLineSet redFragments;
- TeLineSet redBoundaryFragments;
-
- TeFragmentBoundary(redLines, report, redBoundaryFragments, redFragments);
-
-// choose red fragments
- vector<TeLinearRing> rings;
-
- TeOVERLAY::TeLineIndex fragmentsIndex;
-
- short mask = 0;
-
- TeRtreeGetFragments(bluePols, blueTree, redFragments, locationRedFragments, mask, fragmentsIndex, rings);
-
-// report fragments from red lines
- TeOVERLAY::TeLineIndex::iterator it = fragmentsIndex.begin();
-
- while(it != fragmentsIndex.end())
- {
- mGeom.addGeometry(it->second.second);
- ++it;
- }
-
- unsigned int nrings = rings.size();
- unsigned int i;
- for(i = 0; i < nrings; ++i)
- {
- mGeom.addGeometry(rings[i]);
- }
-
-// if the operaton is union, so push bluepols
-
- if(operation == TeUNION)
- {
- mGeom.setGeometry(bluePols);
- }
-
- return mGeom;
-}
-
-void TeOverlay(vector<TeLineSet>& redLinesIn, const TePolygonSet& bluePolsIn, vector<TeMultiGeometry>& outPutGeoms, const short& operation)
-{
- TeINTERSECTOR2::TeSegmentRTree blueTree(bluePolsIn.box());
-
- unsigned int nLines = redLinesIn.size();
- unsigned int i;
- for(i = 0; i < nLines; ++i)
- {
- TeMultiGeometry mg;
-
- mg = TeOverlay(redLinesIn[i], bluePolsIn, blueTree, operation);
-
- outPutGeoms.push_back(mg);
- }
-
- blueTree.clear();
-
- return;
-}
-
-// overlay for lines/polygons
-TeMultiGeometry TeOVERLAY::TeOverlay(const TeLineSet& redLinesIn, const TePolygonSet& bluePolsIn, const short& operation)
-{
- vector<TeMultiGeometry> mgeoms;
- vector<TeLineSet> redLines;
- redLines.push_back(redLinesIn);
- TeMultiGeometry outputGeom;
-
- ::TeOverlay(redLines, bluePolsIn, mgeoms, operation);
-
- if(mgeoms.empty())
- return outputGeom;
-
- outputGeom = mgeoms[0];
-
- return outputGeom;
-}
-
-TeMultiGeometry TeOVERLAY::TeUnion(TeLineSet& redLines, TePolygonSet& bluePols)
-{
- return TeOVERLAY::TeOverlay(redLines, bluePols, TeUNION);
-}
-
-TeMultiGeometry TeOVERLAY::TeIntersection(TeLineSet& redLines, TePolygonSet& bluePols)
-{
- return TeOVERLAY::TeOverlay(redLines, bluePols, TeINTERSECTION);
-}
-
-TeMultiGeometry TeOVERLAY::TeDifference(TeLineSet& redLines, TePolygonSet& bluePols)
-{
- return TeOVERLAY::TeOverlay(redLines, bluePols, TeDIFFERENCE);
-}
-
-bool TeOVERLAY::TePairUnion(TePolygonSet& psetIn, TePolygonSet& psetOut)
-{
- psetOut.clear();
-
- vector<TePolygonSet> outPutSet;
- unsigned int i;
- for(i = 0; i < psetIn.size(); ++i)
- {
- TePolygonSet pset;
- pset.add(psetIn[i]);
- outPutSet.push_back(pset);
- }
-
- unsigned int outsize = outPutSet.size();
-
- bool resultUnion = true;
-
- while(outsize > 1)
- {
-// une dois a dois
- unsigned int auxsize = 0;
- unsigned int i;
- for(i = 0; i < outsize; i += 2)
- {
- TePolygonSet psRed = outPutSet[i];
- if((i + 1) < outsize)
- {
- TePolygonSet psBlue = outPutSet[i+1];
- TePolygonSet psUnidoAgregado;
- resultUnion = resultUnion && TeOVERLAY::TeUnion(psRed, psBlue, psUnidoAgregado);
- if(psUnidoAgregado.size() > 0)
- {
- outPutSet[auxsize] = psUnidoAgregado;
- ++auxsize;
- }
- }
- else
- {
- outPutSet[auxsize] = psRed;
- ++auxsize;
- }
- }
-
- outsize = auxsize;
- }
-
- for(unsigned int i = 0; i < outsize; ++i)
- for(unsigned int j = 0; j < outPutSet[i].size(); ++j)
- psetOut.add(outPutSet[i][j]);
-
- return resultUnion;
-}
-
-bool TeOVERLAY::TeValidPolygonHoles(TePolygon& polygon, TePolygonSet& psValid)
-{
- string objectId = polygon.objectId();
- int geomId = polygon.geomId();
-
- psValid.clear();
-
- if(polygon.size() == 0)
- return false;
-
- if(polygon.size() == 1)
- {
- TePolygon paux;
- paux.copyElements(polygon);
- paux.geomId(geomId);
- paux.objectId(objectId);
- psValid.add(paux);
- return true;
- }
-
- TePolygon fixedPolygon;
- fixedPolygon.add(polygon[0]);
-
-//adiciona todos os buracos em um TePolygonSet
- TePolygonSet psHoles;
- unsigned int i;
- for(i = 1; i < polygon.size(); i++)
- {
- TePolygon hole;
- hole.add(polygon[i]);
-
- psHoles.add(hole);
- }
-
-//faz a uniao dos buracos
- TePolygonSet psOut;
- if(!TeOVERLAY::TeUnion(psHoles, psOut))
- return false;
-
- psHoles = TePolygonSet();
- psHoles.copyElements(psOut);
- psOut = TePolygonSet();
-
-//faz a diferenca entre o poligono original e a uniao dos seus buracos
- TePolygonSet psTemp;
- psTemp.add(fixedPolygon);
-
- if(!TeOVERLAY::TeDifference(psTemp, psHoles, psOut))
- return false;
-
- for(i = 0; i < psOut.size(); i++)
- {
- psOut[i].geomId(geomId);
- psOut[i].objectId(objectId);
- psValid.add(psOut[i]);
- }
-
- return true;
-}
-
-bool TeOVERLAY::TeValidPolygonHoles(TePolygonSet& polygons, TePolygonSet& psValid)
-{
- psValid.clear();
- unsigned int i, j;
- for(i = 0; i < polygons.size(); ++i)
- {
-// do valid for each polygon
- TePolygon pol = polygons[i];
-
- TePolygonSet psAux;
-
- if(TeValidPolygonHoles(pol, psAux))
- {
- for(j = 0; j < psAux.size(); ++j)
- {
- psValid.add(psAux[j]);
- }
- }
- else
- {
- return false;
- }
- }
-
- return true;
-}
-
diff --git a/src/terralib/kernel/TeOverlay.h b/src/terralib/kernel/TeOverlay.h
deleted file mode 100644
index 01b3dff..0000000
--- a/src/terralib/kernel/TeOverlay.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeOverlay.h
- \brief This file contains structures and definitions for set operation on polygons.
- \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
- */
-
-#ifndef __TERRALIB_INTERNAL_OVERLAY_H
-#define __TERRALIB_INTERNAL_OVERLAY_H
-
-#include "TeMultiGeometry.h"
-
-/**
- * @brief Contains structures and definitions needed to execute Set Operations for polygons and lines (union, intersection e difference).
- */
-
-namespace TeOVERLAY
-{
-/** @defgroup SetOperations Set Operations
- * Set operations for polygons and lines: intersection, union or difference.
- * @{
- */
-
-/** \brief Executes one of the possible Set Operations on polygons.
- \param redPols The first list of disjoint polygons (and without self-intersections).
- \param bluePols The second list of disjoint polygons (and without self-intersections).
- \param polsOut The polygon list from the operation result.
- \param operation Type of operation: TeUNION, TeINTERSECTION or TeDIFFERENCE.
- \return True if the operation success and false if an error has ocurried.
-
- \note Each polygon list must have disjoint polygons, otherwise, the result is undefined. This function must not be called directly,
- instead of call it, choose a specific function below, because, this signature is deprecated and will change in near future.
-*/
-TL_DLL bool TeOverlay(const TePolygonSet& redPols, const TePolygonSet& bluePols, TePolygonSet& polsOut, const short& operation);
-
-/** \brief Calculates the union Set Operation for polygons.
- \param redPols The first list of disjoint polygons (and without self-intersections).
- \param bluePols The second list of disjoint polygons (and without self-intersections).
- \param polsOut The polygon list from the operation result.
- \return True if the operation success and false if an error has ocurried.
-
-*/
-TL_DLL bool TeUnion(TePolygonSet& redPols, TePolygonSet& bluePols, TePolygonSet& polsOut);
-
-
-/** \brief Calculates the intersection Set Operation for polygons.
- \param redPols The first list of disjoint polygons (and without self-intersections).
- \param bluePols The second list of disjoint polygons (and without self-intersections).
- \param polsOut The polygon list from the operation result.
- \return True if the operation success and false if an error has ocurried.
-
-*/
-TL_DLL bool TeIntersection(TePolygonSet& redPols, TePolygonSet& bluePols, TePolygonSet& polsOut);
-
-
-/** \brief Calculates the difference set operation for polygons (redPols minus bluePols).
- \param redPols The first list of disjoint polygons (and without self-intersections).
- \param bluePols The second list of disjoint polygons (and without self-intersections).
- \param polsOut The polygon list from the operation result.
- \return True if the operation success and false if an error has ocurried.
-
-*/
-TL_DLL bool TeDifference(TePolygonSet& redPols, TePolygonSet& bluePols, TePolygonSet& polsOut);
-
-
-/** \brief Executes one of the possible Set Operations for lines and polygons.
- \param redLines A disjoint line list (and without self-intersections).
- \param bluePols A list of disjoint polygons (and without self-intersections).
- \param operation Type of operation: TeUNION, TeINTERSECTION or TeDIFFERENCE.
- \return A geometry that can contains only lines on intersection and difference cases, and lines + polygons on union case.
-
- \note This function must not be called directly, instead of call it, choose a specific function below,
- because, this signature is deprecated and will change in near future.
-
-*/
-TL_DLL TeMultiGeometry TeOverlay(const TeLineSet& redLines, const TePolygonSet& bluePols, const short& operation);
-
-
-/** \brief Calculates the union set operation for lines and polygons.
- \param redLines A disjoint line list (and without self-intersections).
- \param bluePols A list of disjoint polygons (and without self-intersections).
- \return A geometry formed by lines and polygons or only by polygons.
-
-*/
-TL_DLL TeMultiGeometry TeUnion(TeLineSet& redLines, TePolygonSet& bluePols);
-
-
-/** \brief Calculates the intersection set operation for lines and polygons.
- \param redLines A disjoint line list (and without self-intersections).
- \param bluePols A list of disjoint polygons (and without self-intersections).
- \return A geometry formed only by lines or empty.
-
-*/
-TL_DLL TeMultiGeometry TeIntersection(TeLineSet& redLines, TePolygonSet& bluePols);
-
-
-/** \brief Calculates the defference set operation for lines and polygons.
- \param redLines A disjoint line list (and without self-intersections).
- \param bluePols A list of disjoint polygons (and without self-intersections).
- \return A geometry formed only by lines or empty.
-
-*/
-TL_DLL TeMultiGeometry TeDifference(TeLineSet& redLines, TePolygonSet& bluePols);
-
-
-/** \brief Calculates the union of all polygons passed in polsIn parameter, and returns a polygon set (polsOut).
- \param polsIn A list of polygons, may have overlap (disjoint or not).
- \param polsOut Where the union will be stored.
- \param makeCopy If true, before to start the union process a copy will be done for all coordinates, otherwise, the rings and coordinates of the input polygon will be used and so, the input can be invalidate (because of handle/body share of implementaton) bu this will save some memory.
- \param fixOrientation If true, the ring orientation is checked, otherwise, it is assumed that they are in correct order of processing (you may set to false only if you know implementation details otherwise an error may occur).
-*/
-TL_DLL bool TeUnion(TePolygonSet& polsIn, TePolygonSet& polsOut, const bool& makeCopy = true, const bool fixOrientation = true);
-
-
-/** \brief Calculates the intersection set operation for polygons. This version of intersection will reuse some pre-processing of redPols, and will do intersection between redPols and each polygonset in bluePols vector. The result of each individual operation (redPols x a polygonset from the blue vector) will be store in the output vector in the same order of polygonsets in bluePols. If an intersection is empty, an empty polygonset will be stored to indicate this.
- \param redPols A list of disjoint polygons (and without self-intersections) used as a mask to cut each polygonset in bluePols vector.
- \param bluePols A vector that contains polygonsets that will be individually cutted by redPols, and each blue polygonset must be disjoint (and without self-intersections).
- \param vecPolsOut A vector with the result of intersection between redPols and each polygonset in the blue polygonset vector.
- \param resultVec A vector of bool that tells if individual intersection succeed or not.
- \param makeCopy If true, before to start the union process a copy will be done for all coordinates, otherwise, the rings and coordinates of the input polygon will be used and so, the input can be invalidate (because of handle/body share of implementaton) bu this will save some memory.
- \param fixOrientation If true, the ring orientation is checked, otherwise, it is assumed that they are in correct order of processing (you may set to false only if you know implementation details otherwise an error may occur).
- \return True if the operation success and false if an error has ocurried.
-
- \note The output vector may contains polygonsets thar are empty, only to indicate that intersection was empty, so be carefull.
-
-*/
-TL_DLL bool TeIntersection(TePolygonSet& redPols, vector<TePolygonSet>& bluePols, vector<TePolygonSet>& vecPolsOut, vector<bool>& resultVec, const bool& makeCopy = true, const bool fixOrientation = true);
-
-
-/** \brief Calculates the union set operation for polygons.
- This version of union will reuse some pre-processing of redPols,
- and will do union between redPols and each polygonset in bluePols.
- The result of each individual operation (redPols x a polygonset from the blue vector)
- will be store in the output vector in the same order of polygonsets in bluePols.
- \param redPols A list of disjoint polygons (and without self-intersections) used as a mask to cut each polygonset in bluePols vector.
- \param bluePols A vector that contains polygonsets that will be individually cutted by redPols, and each blue polygonset must be disjoint (and without self-intersections).
- \param vecPolsOut A vector with the result of union between redPols and each polygonset in the blue polygonset vector.
- \param resultVec A vector of bool that tells if individual intersection succeed or not.
- \param makeCopy If true, before to start the union process a copy will be done for all coordinates, otherwise, the rings and coordinates of the input polygon will be used and so, the input can be invalidate (because of handle/body share of implementaton) bu this will save some memory.
- \param fixOrientation If true, the ring orientation is checked, otherwise, it is assumed that they are in correct order of processing (you may set to false only if you know implementation details otherwise an error may occur).
- \return True if the operation success and false if an error has ocurried.
-*/
-TL_DLL bool TeUnion(TePolygonSet& redPols, vector<TePolygonSet>& bluePols, vector<TePolygonSet>& vecPolsOut, vector<bool>& resultVec, const bool& makeCopy = true, const bool fixOrientation = true);
-
-
-/** \brief Calculates the difference set operation for polygons.
- This version of difference will reuse some pre-processing of redPols,
- and will do difference between redPols and each polygonset in bluePols vector.
- The result of each individual operation (redPols x a polygonset from the blue vector)
- will be store in the output vector in the same order of polygonsets in bluePols.
- If an intersection is empty, an empty polygonset will be stored to indicate this.
- \param redPols A list of disjoint polygons (and without self-intersections) used as a mask to cut each polygonset in bluePols vector.
- \param bluePols A vector that contains polygonsets that will be individually cutted by redPols, and each blue polygonset must be disjoint (and without self-intersections).
- \param vecPolsOut A vector with the result of differnce between redPols and each polygonset in the blue polygonset vector.
- \param resultVec A vector of bool that tells if individual intersection succeed or not.
- \param makeCopy If true, before to start the union process a copy will be done for all coordinates, otherwise, the rings and coordinates of the input polygon will be used and so, the input can be invalidate (because of handle/body share of implementaton) bu this will save some memory.
- \param fixOrientation If true, the ring orientation is checked, otherwise, it is assumed that they are in correct order of processing (you may set to false only if you know implementation details otherwise an error may occur).
- \return True if the operation success and false if an error has ocurried.
-
- \note The output vector may contains polygonsets thar are empty, only to indicate that intersection was empty, so be carefull.
-*/
-TL_DLL bool TeDifference(TePolygonSet& redPols, vector<TePolygonSet>& bluePols, vector<TePolygonSet>& vecPolsOut, vector<bool>& resultVec, const bool& makeCopy = true, const bool fixOrientation = true);
-
-/** \brief Calculates the union of all polygons passed in polsIn parameter,
- and returns a polygon set (polsOut).
- This type of union use a different strategy from the
- previous one: do union for each pair and
- then repeat until we have only two pairs.
- \param psetIn A list of polygons, may have overlap (disjoint or not).
- \param psetOut Where the union will be stored.
- */
-TL_DLL bool TePairUnion(TePolygonSet& psetIn, TePolygonSet& psetOut);
-
-/** \brief Valid polygon holes: if they have a commom edge,
- they will be joined (THIS IS FOR INTERNAL USE ONLY).
- \param polygon The polygon to check holes.
- \param psValid The result polygon.
- \return Returns true if the operation successed otherwise returns false.
- */
-TL_DLL bool TeValidPolygonHoles(TePolygon& polygon, TePolygonSet& psValid);
-
-/** \brief Valid polygon holes: if they have a commom edge, they will be joined (THIS IS FOR INTERNAL USE ONLY).
- \param polygons The polygons to check holes.
- \param psValid The result polygon.
- \return Returns true if the operation successed otherwise returns false.
- */
-TL_DLL bool TeValidPolygonHoles(TePolygonSet& polygons, TePolygonSet& psValid);
-
-/** @} */
-
-} // end namespace TeOVERLAY
-
-#endif //__TERRALIB_INTERNAL_OVERLAY_H
-
diff --git a/src/terralib/kernel/TeOverlayUtils.cpp b/src/terralib/kernel/TeOverlayUtils.cpp
deleted file mode 100644
index 2f178b5..0000000
--- a/src/terralib/kernel/TeOverlayUtils.cpp
+++ /dev/null
@@ -1,1222 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeOverlayUtils.h"
-#include "TeGeometryAlgorithms.h"
-
-//---------------- Auxiliary operations for overlay ----------------//
-
-inline void TeOverlayMiddle(const TeCoord2D& c1, const TeCoord2D& c2, TeCoord2D& m)
-{
- m.x_ = ((c1.x_ + c2.x_) / 2.0);
- m.y_ = ((c1.y_ + c2.y_) / 2.0);
-}
-
-// Verifies orientation for each line of polygon set, and reverse the orientation if need
-void TeOVERLAY::TeFixOrientation(TePolygonSet& polSet, const short& outerOrientationToReverse, const short& innerOrientationToReverse)
-{
- unsigned int polSetSize = polSet.size();
-
- for(unsigned int i = 0; i < polSetSize; ++i)
- {
- if(TeOrientation(polSet[i][0]) == outerOrientationToReverse)
- reverse(polSet[i][0].begin(), polSet[i][0].end());
-
- unsigned int polSize = polSet[i].size();
-
- for(unsigned int j = 1; j < polSize; ++j)
- {
- if(TeOrientation(polSet[i][j]) == innerOrientationToReverse)
- reverse(polSet[i][j].begin(), polSet[i][j].end());
- }
- }
-}
-
-// For each operation (union, intersection and difference) defines location for retrieval of fragments
-void TeOVERLAY::TeChooseBoundaryLocation(const short& operation, short& locationRedFragments, short& locationBlueFragments)
-{
- switch(operation)
- {
-// intersection: gets all fragments from red polygon wich are
-// inside the blue polygon and the blue fragments that are inside
-// the red polygon.
- case TeINTERSECTION: locationRedFragments = TeINSIDE;
- locationBlueFragments = TeINSIDE;
- break;
-
-// union: gets all fragments from red polygon wich are
-// outside the blue polygon and the blue fragments that are outside
-// the red polygon.
- case TeUNION: locationRedFragments = TeOUTSIDE;
- locationBlueFragments = TeOUTSIDE;
- break;
-
-// difference: gets all fragments from red polygon wich are
-// outside the blue polygon and the blue fragments that are inside
-// the red polygon.
- case TeDIFFERENCE: locationRedFragments = TeOUTSIDE;
- locationBlueFragments = TeINSIDE;
- break;
- }
-}
-
-// Erases from fragmentsIndex boundary fragments that are in oposite direction: each fragment must have a unique identifier in the pair first field (pair<unsigned int, TeLine2D>)
-void TeOVERLAY::TeRemoveOpositeBoundaryFragments(TeLineIndex& fragmentsIndex)
-{
- TeLineIndex::iterator indexIterator = fragmentsIndex.begin();
-
- while(indexIterator != fragmentsIndex.end())
- {
- pair<TeLineIndex::iterator, TeLineIndex::iterator> its = fragmentsIndex.equal_range(indexIterator->second.second[(indexIterator->second.second.size() - 1u)]);
-
- bool eraseOwn = false;
-
- while(its.first != its.second)
- {
-// Se nao achei o proprio fragmento, entao posso ver se e possivel apagar
- if(its.first->second.first != indexIterator->second.first)
- {
- if(TeEquals(its.first->second.second[its.first->second.second.size() - 1u], indexIterator->second.second[0u]))
- {
- TeLineIndex::iterator idxAux2 = its.first;
- ++(its.first);
- fragmentsIndex.erase(idxAux2);
-
- eraseOwn = true;
- }
- else
- {
- ++(its.first);
- }
- }
- else
- {
- ++(its.first);
- }
- }
-
- if(eraseOwn)
- {
- fragmentsIndex.erase(indexIterator);
- indexIterator = fragmentsIndex.begin();
- }
- else
- {
- ++indexIterator;
- }
- }
-}
-
-// Erases from fragmentsIndex boundary fragments that are equals to another boundary fragment
-void TeOVERLAY::TeRemoveSameBoundaryFragments(TeLineIndex& fragmentsIndex)
-{
- TeLineIndex::iterator indexIterator = fragmentsIndex.begin();
-
- while(indexIterator != fragmentsIndex.end())
- {
- pair<TeLineIndex::iterator, TeLineIndex::iterator> its = fragmentsIndex.equal_range(indexIterator->second.second[0u]);
-
- while(its.first != its.second)
- {
-// Se nao achei o proprio fragmento, entao posso ver se e possivel apagar
- if(its.first->second.first != indexIterator->second.first)
- {
- if(TeEquals(its.first->second.second[its.first->second.second.size() - 1u], indexIterator->second.second[indexIterator->second.second.size() - 1u]))
- {
- TeLineIndex::iterator idxAux2 = its.first;
- ++(its.first);
- fragmentsIndex.erase(idxAux2);
- }
- else
- {
- ++(its.first);
- }
- }
- else
- {
- ++(its.first);
- }
- }
-
- ++indexIterator;
- }
-}
-
-// Merge fragments ito first index (fragmentsIndex)
-void TeOVERLAY::TeJoinFragments(TeLineIndex& fragmentsIndex, TeLineIndex& boundaryFragmentsIndex)
-{
- TeLineIndex::iterator indexIterator = boundaryFragmentsIndex.begin();
-
- while(indexIterator != boundaryFragmentsIndex.end())
- {
- fragmentsIndex.insert(*indexIterator);
- ++indexIterator;
- }
-
- boundaryFragmentsIndex.clear();
-}
-
-// Moves closed rings from fragmentsIndex to rins vector
-void TeOVERLAY::TeFindAndMoveClosedRings(TeLineIndex& fragmentsIndex, vector<TeLinearRing>& rings)
-{
- TeLineIndex::iterator indexIterator = fragmentsIndex.begin();
-
- while(indexIterator != fragmentsIndex.end())
- {
- if(indexIterator->second.second.isRing())
- {
- rings.push_back(indexIterator->second.second);
-
- TeLineIndex::iterator idxAux;
- idxAux = indexIterator;
- ++indexIterator;
- fragmentsIndex.erase(idxAux);
- }
- else
- ++indexIterator;
- }
-}
-
-// Gets a polygonset with outer rings and a vector with holes and try to find to what polygon the hole belongs to
-bool TeOVERLAY::TeMountTopology(TePolygonSet& polysOut, vector<TeLinearRing>& holes)
-{
- bool returnValue = true;
-
- if((polysOut.size() == 0) && (holes.size() > 0))
- {
-// Formou buracos e nao formou os aneis externos
- return false;
- }
-
- if(polysOut.size() == 1)
- {
- for(unsigned int i = 0; i < holes.size(); ++i)
- polysOut[0].add(holes[i]);
- }
- else
- {
- for(unsigned int i = 0; i < holes.size(); ++i)
- {
- TeLinearRing ring = holes[i];
-
- vector<TePolygon> candidates;
- vector<unsigned int> candidatesPos;
-
- unsigned int j = 0;
-
- for(j = 0; j < polysOut.size(); ++j)
- {
- if(TeWithinOrCoveredByOrEquals(ring.box(), polysOut[j].box()))
- {
- candidates.push_back(polysOut[j]);
- candidatesPos.push_back(j);
- }
- }
-
- if(candidates.size() == 1)
- {
- candidates[0].add(ring);
- continue;
- }
-
- vector<TePolygon> newCandidates;
-
- for(j = 0; j < candidates.size(); ++j)
- {
- short rel = TeBOUNDARY;
-
- unsigned int nthVert = ring.size();
- unsigned int iVert = 0u;
-
- while(iVert < nthVert)
- {
- rel = TeRelation(ring[iVert], candidates[j][0]);
-
- if(rel & TeINSIDE)
- {
- newCandidates.push_back(candidates[j]);
- break;
- }
- else if(rel & TeOUTSIDE)
- {
- break;
- }
-
- ++iVert;
- }
-
- if(iVert == nthVert)
- {
-// Topologycal error: every point is on ring boundary...
- returnValue = false;
-
- TePolygon topTest;
- topTest.add(ring);
-
- short whatRel = TeRelation(topTest, candidates[j]);
-
-// Se um buraco for igual ao exterior, existe um erro topologico
-// No momento, eliminamos o anel externo
-// e o interno...
-// Se o buraco for coberto pelo poligono externo, entao ele ira ficar dentro deste
-// Caso contrario e erro sem possibilidades...
- if(whatRel & TeEQUALS)
- {
- polysOut.erase(candidatesPos[j]);
- continue;
- }
- }
- }
-
- if(newCandidates.size() <= 0)
- {
-// Didn't find outer ring to this hole.
- returnValue = false;
- continue;
- }
-
- int idxMinArea = 0;
-
- double minArea = TeMAXFLOAT;
-
- for(j = 0; j < newCandidates.size(); ++j)
- {
- if(TeGeometryArea(newCandidates[j].box()) < minArea)
- {
- idxMinArea = j;
- minArea = TeGeometryArea(newCandidates[j].box());
- }
- }
-
- newCandidates[idxMinArea].add(ring);
- }
- }
-
- return returnValue;
-}
-
-// faz a tentativa ingenua!
-bool TeMergeFragmentsFB(TeOVERLAY::TeLineIndex& fragmentsIndex, TeLine2D& line)
-{
- TeCoord2D endLineCoordinate = line[line.size() - 1];
-
- TeOVERLAY::TeLineIndex::iterator indexIterator = fragmentsIndex.begin();
-
- while(indexIterator != fragmentsIndex.end())
- {
- if(TeEquals(endLineCoordinate, indexIterator->second.second[0]))
- {
- for(unsigned int i = 1; i < indexIterator->second.second.size(); ++i)
- line.add(indexIterator->second.second[i]);
-
- line.setBox(::TeUnion(line.box(), indexIterator->second.second.box()));
- fragmentsIndex.erase(indexIterator);
-
- return true;
- }
-
- ++indexIterator;
- }
-
- return false;
-}
-
-// Make polygons from fragments.
-bool TeOVERLAY::TeMergeFragments(TeLineIndex& fragmentsIndex, vector<TeLinearRing>& rings, const bool& doExaustive)
-{
- bool returnValue = true;
-
- TeLine2D lAux;
- TeCoord2D endLineCoordinate;
-
- while(!(fragmentsIndex.empty()))
- {
- if(lAux.size() == 0)
- {
- TeLineIndex::iterator indexIterator = fragmentsIndex.begin();
-
- if(indexIterator != fragmentsIndex.end())
- {
- if(indexIterator->second.second.isRing())
- {
- rings.push_back(indexIterator->second.second);
- fragmentsIndex.erase(indexIterator);
- continue;
- }
-
- for(unsigned int i = 0; i < indexIterator->second.second.size(); ++i)
- lAux.add(indexIterator->second.second[i]);
-
- lAux.setBox(::TeUnion(lAux.box(), indexIterator->second.second.box()));
-
- fragmentsIndex.erase(indexIterator);
- }
- else
- {
- returnValue = false; //Nao poderia vir aqui, deveria ter saido no teste do laco!!
- }
- }
- else
- {
- endLineCoordinate = lAux[lAux.size() - 1];
-
- // Try to find the beginning of the next fragment that is part of the polygon in the same list
- TeLineIndex::iterator indexIterator = fragmentsIndex.find(endLineCoordinate);
-
- if(indexIterator != fragmentsIndex.end())
- {
- for(unsigned int i = 1; i < indexIterator->second.second.size(); ++i)
- lAux.add(indexIterator->second.second[i]);
-
- lAux.setBox(::TeUnion(lAux.box(), indexIterator->second.second.box()));
- fragmentsIndex.erase(indexIterator);
- }
- else
- {
- if(doExaustive)
- {
- if(!TeMergeFragmentsFB(fragmentsIndex, lAux))
- {
- // Nao foi achada continuacao para a linha: nao fechou!
- returnValue = false; // Erro na topologia dos poligonos
-
- // Clear auxiliary.
- TeLine2D emptyLine;
- lAux = emptyLine;
- }
- }
- else
- {
- // Nao foi achada continuacao para a linha: nao fechou!
- returnValue = false; // Erro na topologia dos poligonos
-
- // Clear auxiliary.
- TeLine2D emptyLine;
- lAux = emptyLine;
- }
- }
-
- }
-
- if(lAux.isRing())
- {
- // Add polygon
- rings.push_back(TeLinearRing(lAux));
-
- // Clear auxiliary.
- TeLine2D emptyLine;
- lAux = emptyLine;
- }
- }
-
- if(lAux.size() > 0)
- returnValue = false; // Erro, alguma linha nao fechou!!!
-
- return returnValue;
-}
-
-// For each linear ring, see it's orientation and classify in outer or inner ring
-bool TeOVERLAY::TeClassifyRings(vector<TeLinearRing>& rings, TePolygonSet& polsOut, vector<TeLinearRing>& holes)
-{
- bool returnValue = true;
-
- for(unsigned int z = 0; z < rings.size(); ++z)
- {
- short ori = TeOrientation(rings[z]);
-
- if(ori == TeCOUNTERCLOCKWISE) // It is a hole
- {
- holes.push_back(rings[z]); // add to holes list
- }
- else if(ori == TeCLOCKWISE) // else if island
- { // create a polygon
- TePolygon p;
- p.add(rings[z]);
- polsOut.add(p);
- }
- else
- {
- returnValue = false; // Objeto sem area? Isso e um erro!
- }
- }
-
- return returnValue;
-}
-
-// Seleciona os fragmentos quando existem dois conjuntos distintos: vermelho e azul
-void TeOVERLAY::TeRtreeGetFragments(const TePolygonSet& bluePolygons, TeINTERSECTOR2::TeSegmentRTree& blueTree, TeLineSet& redFragments, const short& locationFragments, short& mask, TeLineIndex& redFragmentsIndex, vector<TeLinearRing>& rings)
-{
- //unsigned int lastId = redFragmentsIndex.size();
-
- unsigned int redFragmentsSize = redFragments.size();
-
- TeBox b = blueTree.getBox();
-
- for(unsigned int i = 0; i < redFragmentsSize; ++i)
- {
-// Para cada fragmento vermelho escolhe um ponto para determinar a localizacao do fragmento
- TeCoord2D middle;
-
- unsigned int fragSize = redFragments[i].size();
-
- TeCoord2D& cfrom = redFragments[i][0];
- TeCoord2D& cto = redFragments[i][1];
-
- if(fragSize == 2) // If the fragment has two points I need to check the middle point of this fragment.
- TeOverlayMiddle(redFragments[i][0], redFragments[i][1], middle);
- else // If the fragment has more than two points so I check one point between the end points.
- middle = redFragments[i][(unsigned int)((double(redFragments[i].size()) / 2.0 + 0.6)) - 1];
-
-// Monta um raio horizontal que vai ate o extremo de todos os poligonos, partindo do ponto medio (middle)
- TeCoord2D c2 = middle;
- c2.x_ = b.x2();
-
- TeBox searchBox(middle, c2);
-
- vector<TeINTERSECTOR2::TeSegIdInPolygonSet> segs;
-
- blueTree.search(searchBox, segs);
-
- unsigned int nSegsInter = segs.size();
-
-// se nao achou nenhum segmento cruzando o raio, significa que o fragmento esta todo fora
- if(nSegsInter > 0)
- {
-// ordena os segmentos azuis para permitir realizar o teste de ponto em poligono
- sort(segs.begin(), segs.end(), segOrder());
-
- bool inside_flag = false;
-
- unsigned int currentPolId = segs[0].polId_;
-
- double tx = middle.x();
- double ty = middle.y();
-
- int yflag0, yflag1;
-
- for(unsigned int j = 0; j < nSegsInter; ++j)
- {
-// Se passamos aos segmentos de outro poligono, temos que zerar o numero de cruzamentos
- if(currentPolId != segs[j].polId_)
- {
- if(inside_flag)
- break;
-
- currentPolId = segs[j].polId_;
- }
-
- const TeCoord2D& vtx0 = bluePolygons[segs[j].polId_][segs[j].lineId_][segs[j].segId_];
- const TeCoord2D& vtx1 = bluePolygons[segs[j].polId_][segs[j].lineId_][segs[j].segId_ + 1];
-
- if((fragSize == 2) && (TeIsOnSegment(middle, vtx0, vtx1)))
- {
-
- if((TeEquals(vtx0, cfrom) || TeEquals(vtx0, cto)) && (TeEquals(vtx1, cfrom) || TeEquals(vtx1, cto)))
- {
- if(locationFragments & TeINSIDE)
- inside_flag = false;
- else
- inside_flag = true;
-
- break;
- }
- }
-
- yflag0 = (vtx0.y() >= ty);
- yflag1 = (vtx1.y() >= ty);
-
- if(yflag0 != yflag1)
- {
- if(((vtx1.y() - ty) * (vtx0.x() - vtx1.x()) >=
- (vtx1.x() - tx) * (vtx0.y() - vtx1.y())) == yflag1)
- {
- inside_flag = !inside_flag ;
- }
- }
- }
-
-// ao sair do laco acima, se inside_flag for verdadeiro, entao o fragmento esta dentro, caso contrario, ele esta fora
- if(inside_flag && (locationFragments & TeINSIDE))
- {
- if(redFragments[i].isRing())
- rings.push_back(redFragments[i]);
- else
- redFragmentsIndex.insert(TeLineIndex::value_type(redFragments[i][0], pair<unsigned int, TeLine2D>(i, redFragments[i])));
-
- mask |= TeINSIDE;
- }
- else if(!inside_flag && (locationFragments & TeOUTSIDE))
- {
- if(redFragments[i].isRing())
- rings.push_back(redFragments[i]);
- else
- redFragmentsIndex.insert(TeLineIndex::value_type(redFragments[i][0], pair<unsigned int, TeLine2D>(i, redFragments[i])));
-
- mask |= TeOUTSIDE;
- }
- }
- else // fragmento esta fora
- {
-// Se a localizacao do fragmento for compativel, pegamos ele.
- if(locationFragments & TeOUTSIDE)
- {
- if(redFragments[i].isRing())
- rings.push_back(redFragments[i]);
- else
- redFragmentsIndex.insert(TeLineIndex::value_type(redFragments[i][0], pair<unsigned int, TeLine2D>(i, redFragments[i])));
- }
-
- mask |= TeOUTSIDE;
- }
- }
-}
-
-// Operacao especial que descobre a localizacao do fragmento dentro do proprio conjunto: usado na operacao de uniao otimizada
-void TeOVERLAY::TeRtreeGetFragments(const TePolygonSet& polygons, TeINTERSECTOR2::TeSegmentRTree& tree, TeLineSet& fragments, vector<pair<unsigned int, unsigned int> >& fragmentsIds, const short& locationFragments, short& mask, TeLineIndex& fragmentsIndex, vector<TeLinearRing>& rings)
-{
- unsigned int fragmentsSize = fragments.size();
-
- TeBox b = tree.getBox();
-
- for(unsigned int i = 0; i < fragmentsSize; ++i)
- {
-// Para cada fragmento escolhe um ponto para determinar a localizacao do fragmento
- TeCoord2D middle;
-
- unsigned int fragSize = fragments[i].size();
-
- TeCoord2D& cfrom = fragments[i][0];
- TeCoord2D& cto = fragments[i][1];
-
- if(fragSize == 2) // If the fragment has two points I need to check the middle point of this fragment.
- TeOverlayMiddle(fragments[i][0], fragments[i][1], middle);
- else // If the fragment has more than two points so I check one point between the end points.
- middle = fragments[i][(unsigned int)((double(fragments[i].size()) / 2.0 + 0.6)) - 1];
-
-// Monta um raio horizontal que vai ate o extremo de todos os poligonos, partindo do ponto medio (middle)
- TeCoord2D c2 = middle;
- c2.x_ = b.x2();
-
- TeBox searchBox(middle, c2);
-
- vector<TeINTERSECTOR2::TeSegIdInPolygonSet> segs;
-
- tree.search(searchBox, segs);
-
- unsigned int nSegsInter = segs.size();
-
-// se nao achou nenhum segmento cruzando o raio, significa que o fragmento esta todo fora
- if(nSegsInter > 0)
- {
-// ordena os segmentos para permitir realizar o teste de ponto em poligono
- sort(segs.begin(), segs.end(), segOrder());
-
- bool inside_flag = false;
-
- unsigned int currentPolId = segs[0].polId_;
-
- double tx = middle.x();
- double ty = middle.y();
-
- int yflag0, yflag1;
-
- for(unsigned int j = 0; j < nSegsInter; ++j)
- {
-// Se passamos aos segmentos de outro poligono, temos que zerar o numero de cruzamentos
- if(currentPolId != segs[j].polId_)
- {
- if(inside_flag)
- break;
-
- currentPolId = segs[j].polId_;
- }
-
-// Se os segmentos que estamos tratando sao do fratgmento, entao pulamos
- if(segs[j].polId_ == fragmentsIds[i].first)
- continue;
-
- const TeCoord2D& vtx0 = polygons[segs[j].polId_][segs[j].lineId_][segs[j].segId_];
- const TeCoord2D& vtx1 = polygons[segs[j].polId_][segs[j].lineId_][segs[j].segId_ + 1];
-
- if((fragSize == 2) && (TeIsOnSegment(middle, vtx0, vtx1)))
- {
-
- if((TeEquals(vtx0, cfrom) || TeEquals(vtx0, cto)) && (TeEquals(vtx1, cfrom) || TeEquals(vtx1, cto)))
- {
- if(locationFragments & TeINSIDE)
- inside_flag = false;
- else
- inside_flag = true;
-
- break;
- }
- }
-
- yflag0 = (vtx0.y() >= ty);
- yflag1 = (vtx1.y() >= ty);
-
- if(yflag0 != yflag1)
- {
- if(((vtx1.y() - ty) * (vtx0.x() - vtx1.x()) >=
- (vtx1.x() - tx) * (vtx0.y() - vtx1.y())) == yflag1)
- {
- inside_flag = !inside_flag ;
- }
- }
- }
-
-// ao sair do laco acima, se inside_flag for verdadeiro, entao o fragmento esta dentro, caso contrario, ele esta fora
- if(inside_flag && (locationFragments & TeINSIDE))
- {
- if(fragments[i].isRing())
- rings.push_back(fragments[i]);
- else
- fragmentsIndex.insert(TeLineIndex::value_type(fragments[i][0], pair<unsigned int, TeLine2D>(i, fragments[i])));
- }
- else if(!inside_flag && (locationFragments & TeOUTSIDE))
- {
- if(fragments[i].isRing())
- rings.push_back(fragments[i]);
- else
- fragmentsIndex.insert(TeLineIndex::value_type(fragments[i][0], pair<unsigned int, TeLine2D>(i, fragments[i])));
- }
-
- }
- else // fragmento esta fora
- {
-// Se a localizacao do fragmento for compativel, pegamos ele.
- if(locationFragments & TeOUTSIDE)
- {
- if(fragments[i].isRing())
- rings.push_back(fragments[i]);
- else
- fragmentsIndex.insert(TeLineIndex::value_type(fragments[i][0], pair<unsigned int, TeLine2D>(i, fragments[i])));
- }
-
- mask |= TeOUTSIDE;
- }
- }
-}
-
-// Operacao especial que descobre a localizacao do fragmento dentro do proprio conjunto: usado na operacao de uniao otimizada
-void TeOVERLAY::TeRtreeRemoveFragments(const TePolygonSet& polygons, TeINTERSECTOR2::TeSegmentRTree& tree,
- TeLineIndex &lineIndex, vector<pair<unsigned int, unsigned int> >& fragmentsIds,
- const short& locationFragments, short& mask, vector<TeLinearRing>& /* rings */)
-{
- TeBox b = tree.getBox();
-
- TeLineIndex::iterator indexIterator = lineIndex.begin();
-
- while(indexIterator != lineIndex.end())
- {
- TeCoord2D middle;
- TeOverlayMiddle(indexIterator->second.second[0], indexIterator->second.second[1], middle);
-
- // Monta um raio horizontal que vai ate o extremo de todos os poligonos, partindo do ponto medio (middle)
- TeCoord2D c2 = middle;
- c2.x_ = b.x2();
-
- TeBox searchBox(middle, c2);
-
- vector<TeINTERSECTOR2::TeSegIdInPolygonSet> segs;
-
- tree.search(searchBox, segs);
-
- unsigned int nSegsInter = segs.size();
-
- // se nao achou nenhum segmento cruzando o raio, significa que o fragmento esta todo fora
- if(nSegsInter > 0)
- {
-// ordena os segmentos para permitir realizar o teste de ponto em poligono
- sort(segs.begin(), segs.end(), segOrder());
-
- bool inside_flag = false;
-
- unsigned int currentPolId = segs[0].polId_;
-
- double tx = middle.x();
- double ty = middle.y();
-
- int yflag0, yflag1;
-
- for(unsigned int j = 0; j < nSegsInter; ++j)
- {
-// Se passamos aos segmentos de outro poligono, temos que zerar o numero de cruzamentos
- if(currentPolId != segs[j].polId_)
- {
- if(inside_flag)
- break;
-
- currentPolId = segs[j].polId_;
- }
-
-// Se os segmentos que estamos tratando sao do fragmento, entao pulamos
- if(segs[j].polId_ == fragmentsIds[indexIterator->second.first].first)
- continue;
-
- const TeCoord2D& vtx0 = polygons[segs[j].polId_][segs[j].lineId_][segs[j].segId_];
- const TeCoord2D& vtx1 = polygons[segs[j].polId_][segs[j].lineId_][segs[j].segId_ + 1];
-
- // o ponto esta no segmeto de vertices vtx0 e vtx1?
- // se sim setar inside_flag como false e avancar o j ate mudar de poligino e pula pro inicio dessa secao (continue)
- if(TeIsOnSegment(middle, vtx0, vtx1))
- {
- inside_flag = false;
-
- while((j < nSegsInter) && currentPolId == segs[j].polId_)
- ++j;
-
- if(j >= nSegsInter)
- break;
-
- --j;
-
- continue;
- }
-
- yflag0 = (vtx0.y() >= ty);
- yflag1 = (vtx1.y() >= ty);
-
- if(yflag0 != yflag1)
- {
- if(((vtx1.y() - ty) * (vtx0.x() - vtx1.x()) >=
- (vtx1.x() - tx) * (vtx0.y() - vtx1.y())) == yflag1)
- {
- inside_flag = !inside_flag ;
- }
- }
- }
-
-// ao sair do laco acima, se inside_flag for verdadeiro, entao o fragmento esta dentro, caso contrario, ele esta fora
- if(inside_flag && (locationFragments & TeINSIDE))
- {
- TeLineIndex::iterator it_aux = indexIterator;
- ++(indexIterator);
- lineIndex.erase(it_aux);
- }
- else if(!inside_flag && (locationFragments & TeOUTSIDE))
- {
- TeLineIndex::iterator it_aux = indexIterator;
- ++(indexIterator);
- lineIndex.erase(it_aux);
- }
- else
- {
- ++(indexIterator);
- }
-
- }
- else // fragmento esta fora
- {
-// Se a localizacao do fragmento for compat�vel, pegamos ele.
- if(locationFragments & TeOUTSIDE)
- {
- TeLineIndex::iterator it_aux = indexIterator;
- ++(indexIterator);
- lineIndex.erase(it_aux);
- }
- else
- {
- ++(indexIterator);
- }
-
- mask |= TeOUTSIDE;
- }
- }
-}
-
-// estrutura auxiliar utilizada no codigo do split
-struct TeSplitCoordSort
-{
- bool operator()(pair<unsigned int, TeCoord2D> p1, pair<unsigned int, TeCoord2D> p2) const
- {
- if(p1.second.x() < p2.second.x())
- return true;
- if(p1.second.x() > p2.second.x())
- return false;
- if(p1.second.y() < p2.second.y())
- return true;
- if(p1.second.y() > p2.second.y())
- return false;
- if(p1.first < p2.first)
- return true;
-
- return false;
- }
-};
-
-// estrutura auxiliar utilizada no codigo do split
-struct TeSIP
-{
- vector<unsigned int> indexes_;
- TeCoord2D coord_;
- bool used_;
-
- TeSIP()
- {
- }
-
- TeSIP(const TeCoord2D& coord)
- {
- indexes_.clear();
- coord_ = coord;
- used_ = false;
- }
-
- bool exists(const unsigned int index)
- {
- for(unsigned int i = 0; i < indexes_.size(); i++)
- {
- if(index == indexes_[i])
- {
- return true;
- }
- }
- return false;
- }
-
- unsigned int getFirstIndex()
- {
- unsigned int first = indexes_[0];
- for(unsigned int i = 1; i < indexes_.size(); i++)
- {
- if(indexes_[i] < first)
- {
- first = indexes_[i];
- }
- }
- return first;
- }
- unsigned int getLastIndex()
- {
- unsigned int last = indexes_[0];
- for(unsigned int i = 1; i < indexes_.size(); i++)
- {
- if(indexes_[i] > last)
- {
- last = indexes_[i];
- }
- }
- return last;
- }
-};
-
-// funcao auxiliar
-inline bool TeSEquals(const TeCoord2D& c1, const TeCoord2D& c2)
-{
- return (c1.x() == c2.x()) && (c1.y() == c2.y());
-}
-
-// estrutura auxiliar do split
-struct TeSFragment
-{
- unsigned int initialIndex_; //indice da coordenada inicial do fragmento
- TeLine2D line_;
-
- TeSFragment()
- {
- }
-
- TeSFragment(const unsigned int &initialIndex, const TeCoord2D &coord)
- {
- initialIndex_ = initialIndex;
- line_.add(coord);
- }
-};
-
-// Make rings from split fragments
-inline bool TeSMergeFragments(vector<TeSFragment> &fragments, vector<TeLinearRing>& rings)
-{
- unsigned int fragmentsSize = fragments.size();
-
- TeOVERLAY::TeLineIndex fragmentsIndex;
-
- for(unsigned int i = 0; i < fragmentsSize; ++i)
-
- fragmentsIndex.insert(TeOVERLAY::TeLineIndex::value_type(fragments[i].line_[0], pair<unsigned int, TeLine2D>(0, fragments[i].line_)));
- return TeOVERLAY::TeMergeFragments(fragmentsIndex, rings);}
-
-
-bool TeOVERLAY::TeSplitRing(TeLinearRing& ring, TeLineSet& ringsOut)
-{
- ringsOut.clear();
-
- unsigned int ringSize = ring.size();
-
- if(ringSize == 0)
- return false;
-
-//vector para armazenar os pontos da linha e sua respectiva posicao
- vector< pair<unsigned int, TeCoord2D> > vecCoords;
-
-//adiciona os segmentos num vector de pontos, contendo o indice e a coordenada
- for(unsigned int i = 0; i < ringSize; i++)
- {
- vecCoords.push_back( pair<unsigned int, TeCoord2D>(i, ring[i]));
- }
- unsigned int vecCoordsSize = vecCoords.size();
-
- sort(vecCoords.begin(), vecCoords.end(), TeSplitCoordSort());
-
- vector<TeSIP> ips;
-
- bool usou = false;
- //varre todas as coordenadas procurando por pontos de interseccao
- for(unsigned int i = 1; i < vecCoordsSize; i++)
- {
- //se o ponto corrente for igual ao anterior, entao existe interseccao
- if(TeSEquals(vecCoords[i-1].second, vecCoords[i].second))
- {
- //armazenamos o ponto de interseccao e todos os indices em que este ponto apareceu
- if(!usou)
- {
- //na primeira vez, criamos o ponto de interseccao
- TeSIP ip(vecCoords[i].second);
- ip.indexes_.push_back(vecCoords[i-1].first);
- ip.indexes_.push_back(vecCoords[i].first);
-
- ips.push_back(ip);
-
- usou = true;
- }
- else
- {
- //da segunda em diante, apenas anotamos o indice em que este ponto apareceu
- ips[ips.size() - 1].indexes_.push_back(vecCoords[i].first);
- }
- }
- else
- {
- usou = false;
- }
- }
-
- //so existe interseccao entre o inicio e o fim do pol
- if(ips.size() == 1)
- {
- ringsOut.add(ring);
- return true;
- }
-
- //Gera os fragmentos
- vector< TeSFragment > fragments;
- TeSFragment currentFragment(0, ring[0]);
-
- //vamos remontar a linha
- for(unsigned int i = 1; i < ringSize; i++)
- {
- unsigned int currentIPindex = 0;
- bool isIP = false;
- //verifica se o ponto corrente e um ponto de interseccao
- for(unsigned j = 0; j < ips.size(); j++)
- {
- if(ips[j].exists(i))
- {
- currentIPindex = j;
- isIP = true;
- break;
- }
- }
-
- ///adiciono a coordenada corrente ao fragmento corrente
- currentFragment.line_.add(ring[i]);
-
- if(isIP)
- {
- //se fechou um anel, adiciona na lista de aneis
- // e remove o ponto de interseccao corrente
- if(currentFragment.line_.isRing())
- {
- ringsOut.add(currentFragment.line_);
- }
- else
- {
- //verifica se o IP ja passamos por este IP alguma vez
- //se ja passamos, vamos formar um poligono com os fragmentos entre eles
- if(ips[currentIPindex].used_)
- {
- //se nao foi formado um anel, pegamos todos os fragmentos entre estes pontos de interseccao e
- //tentamos formar um anel
- unsigned int firstIndex = ips[currentIPindex].getFirstIndex();
- unsigned int lastIndex = ips[currentIPindex].getLastIndex();
-
- vector<unsigned int> remover;
- vector< TeSFragment > auxFragments;
- auxFragments.push_back(currentFragment);
- for(unsigned int j = 0; j<fragments.size(); j++)
- {
- if(fragments[j].initialIndex_ >= firstIndex && fragments[j].initialIndex_ < lastIndex )
- {
- remover.push_back(j);
- auxFragments.push_back(fragments[j]);
- }
- }
- vector<TeLinearRing> r;
- if(auxFragments.size() >=2 && TeSMergeFragments(auxFragments, r))
- {
- for(unsigned int t = 0; t < r.size(); t++)
- {
- ringsOut.add(r[t]);
- }
-
- for(int j = remover.size()-1; j >= 0; j--)
- {
- fragments.erase(fragments.begin() + remover[j]);
- }
- ips[currentIPindex].used_ = false;
- }
- else
- {
- fragments.push_back(currentFragment);
- }
- }
- else
- {
- fragments.push_back(currentFragment);
- ips[currentIPindex].used_ = true;
- }
- }
-
- currentFragment = TeSFragment (i, ring[i]);
- }
- }
-
- if(fragments.size() > 1)
- {
- vector<TeLinearRing> r;
- if(TeSMergeFragments(fragments, r))
- {
- for(unsigned int t = 0; t < r.size(); t++)
- {
- ringsOut.add(r[t]);
- }
- }
- else
- {
- return false;
- }
- }
- else if(fragments.size() == 1)
- {
- return false;
- }
-
- for(unsigned int i = 0; i < ringsOut.size(); i++)
- {
- ringsOut[i].objectId(ring.objectId());
- ringsOut[i].geomId(ring.geomId());
- }
-
- return true;
-}
-
-bool TeOVERLAY::TeSplitRings(vector<TeLinearRing>& rings, vector<TeLinearRing>& ringsOut)
-{
- ringsOut.clear();
-
- for(unsigned int i = 0; i < rings.size(); ++i)
- {
- TeLineSet ringsAux;
-
- if(TeOVERLAY::TeSplitRing(rings[i], ringsAux) == false)
- return false;
-
- for(unsigned int j = 0; j < ringsAux.size(); ++j)
- ringsOut.push_back(ringsAux[j]);
- }
-
- return true;
-}
-
-bool TeOVERLAY::TeCloneLine(const TeLine2D& lineIn, TeLine2D& lineOut, const unsigned int& minPts)
-{
- lineOut.clear();
-
- unsigned int lineSize = lineIn.size();
-
- if(lineSize < 2)
- return false;
-
- lineOut.add(lineIn[0]);
-
- for(unsigned int i = 1; i < lineSize; ++i)
- {
- if(!TeEquals(lineIn[i - 1], lineIn[i]))
- {
- lineOut.add(lineIn[i]);
- }
- }
-
- if(lineOut.size() < minPts)
- return false;
-
- return true;
-}
-
-
-bool TeOVERLAY::TeClonePolygon(const TePolygon& polIn, TePolygon& polOut)
-{
- polOut.clear();
-
- unsigned int polSize = polIn.size();
-
- if(polSize == 0)
- return false;
-
- for(unsigned int i = 0; i < polSize; ++i)
- {
- TeLine2D lineOut;
-
- if(!TeCloneLine(polIn[i], lineOut, 4))
- return false;
-
- TeLinearRing ringOut(lineOut);
-
- polOut.add(ringOut);
- }
-
- return true;
-}
-
-bool TeOVERLAY::TeClonePolygonSet(const TePolygonSet& polsIn, TePolygonSet& polsOut)
-{
- polsOut.clear();
-
- unsigned int polsSize = polsIn.size();
-
- if(polsSize == 0)
- return false;
-
- for(unsigned int i = 0; i < polsSize; ++i)
- {
- TePolygon pol;
-
- if(!TeClonePolygon(polsIn[i], pol))
- return false;
-
- polsOut.add(pol);
- }
-
- return true;
-}
-
diff --git a/src/terralib/kernel/TeOverlayUtils.h b/src/terralib/kernel/TeOverlayUtils.h
deleted file mode 100644
index e37ba2e..0000000
--- a/src/terralib/kernel/TeOverlayUtils.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/**
- * @file TeOverlayUtils.h
- * @brief This file contains support algorithms for set operations.
- * These data structures and algorithms MUST BE USED ONLY BY TerraLib kernel and should NOT be used by anyone.
- * THIS IS FOR INTERNAL USE ONLY.
- */
-
-/** @ingroup SetOperations
- THIS IS FOR INTERNAL USE ONLY: TerraLib set operation auxiliary functions.
- * @{
- */
-
-#ifndef __TERRALIB_INTERNAL_OVERLAYUTILS_H
-#define __TERRALIB_INTERNAL_OVERLAYUTILS_H
-
-// STL's include
-#include <map>
-#include <vector>
-#include <algorithm>
-using namespace std;
-
-#include "TeGeometry.h"
-#include "TeIntersector.h"
-
-
-namespace TeOVERLAY
-{
-
-//---------------- Auxiliary structures ----------------//
-//! Defines a functor for coordinate order during map insert and retrival: lexicograpgical order (xy)
-struct TL_DLL xyOrder
-{
- //! Default operation for 'less than' tests.
- bool operator()(const TeCoord2D& c1, const TeCoord2D& c2) const
- {
- if(c1.x_ < c2.x_)
- return true;
-
- if(c1.x_ > c2.x_)
- return false;
-
- if(c1.y_ < c2.y_)
- return true;
-
- return false;
- }
-};
-
-//! Type to index fragments end points: used during merge fase.
-typedef multimap<TeCoord2D, pair<unsigned int, TeLine2D>, xyOrder> TeLineIndex;
-
-//! Defines a functor for ordering segments during point in poly tests.
-struct TL_DLL segOrder
-{
- //! Default operation for 'less than' tests.
- bool operator()(const TeINTERSECTOR2::TeSegIdInPolygonSet& ip1, const TeINTERSECTOR2::TeSegIdInPolygonSet& ip2) const
- {
- if(ip1.polId_ < ip2.polId_)
- return true;
-
- return false;
- }
-};
-//---------------- Auxiliary operations for overlay ----------------//
-
-//! Verifies orientation for each line of polygon set, and reverse the orientation if need
-TL_DLL void TeFixOrientation(TePolygonSet& polSet, const short& outerOrientationToReverse, const short& innerOrientationToReverse);
-
-
-//! For each operation (union, intersection and difference) defines location for retrieval of fragments
-TL_DLL void TeChooseBoundaryLocation(const short& operation, short& locationRedFragments, short& locationBlueFragments);
-
-
-//! Erases from fragmentsIndex boundary fragments that are in oposite direction: each fragment must have a unique identifier in the pair first field (pair<unsigned int, TeLine2D>)
-TL_DLL void TeRemoveOpositeBoundaryFragments(TeLineIndex& fragmentsIndex);
-
-
-//! Erases from fragmentsIndex boundary fragments that are equals to another boundary fragment
-TL_DLL void TeRemoveSameBoundaryFragments(TeLineIndex& fragmentsIndex);
-
-//! Merge fragments ito first index (fragmentsIndex)
-TL_DLL void TeJoinFragments(TeLineIndex& fragmentsIndex, TeLineIndex& boundaryFragmentsIndex);
-
-//! Moves closed rings from fragmentsIndex to rins vector
-TL_DLL void TeFindAndMoveClosedRings(TeLineIndex& fragmentsIndex, vector<TeLinearRing>& rings);
-
-//! Gets a polygonset with outer rings and a vector with holes and try to find to what polygon the hole belongs to
-TL_DLL bool TeMountTopology(TePolygonSet& polysOut, vector<TeLinearRing>& holes);
-
-//! Make polygons from fragments.
-TL_DLL bool TeMergeFragments(TeLineIndex& fragmentsIndex, vector<TeLinearRing>& rings, const bool& doExaustive = false);
-
-//! For each linear ring, see it's orientation and classify in outer or inner ring
-TL_DLL bool TeClassifyRings(vector<TeLinearRing>& rings, TePolygonSet& polsOut, vector<TeLinearRing>& holes);
-
-//! Find fragments in the red set that satisfies locationFragments using blue set as reference
-TL_DLL void TeRtreeGetFragments(const TePolygonSet& bluePolygons, TeINTERSECTOR2::TeSegmentRTree& blueTree, TeLineSet& redFragments, const short& locationFragments, short& mask, TeLineIndex& redFragmentsIndex, vector<TeLinearRing>& rings);
-
-//! Find fragments in the same set that satisfies locationFragments
-TL_DLL void TeRtreeGetFragments(const TePolygonSet& polygons, TeINTERSECTOR2::TeSegmentRTree& tree, TeLineSet& fragments, vector<pair<unsigned int, unsigned int> >& fragmentsIds, const short& locationFragments, short& mask, TeLineIndex& fragmentsIndex, vector<TeLinearRing>& rings);
-
-//! Removes fragments that may overlap with others: used in special cases during union process
-TL_DLL void TeRtreeRemoveFragments(const TePolygonSet& polygons, TeINTERSECTOR2::TeSegmentRTree& tree, TeLineIndex &lineIndex, vector<pair<unsigned int, unsigned int> >& fragmentsIds, const short& locationFragments, short& mask, vector<TeLinearRing>& rings);
-
-//! Split rings if they have commom end points.
-/*
- \param ring Ring to be broken.
- \param ringsOut Resulting rings.
- \return Returns true if the operation successed otherwise returns false.
- */
-TL_DLL bool TeSplitRing(TeLinearRing& ring, TeLineSet& ringsOut);
-
-//! Split rings if they have commom end points.
-/*
- \param rings A vector of linear rings to be broken.
- \param ringsOut Resulting rings.
- \return Returns true if the operation successed otherwise returns false.
- */
-TL_DLL bool TeSplitRings(vector<TeLinearRing>& rings, vector<TeLinearRing>& ringsOut);
-
-//! Clone line point removing duplicated coordinates.
-/*
- \param lineIn Line to ble cloned.
- \param lineOut Cloned line without repeated points.
- \param minPts This is a constant to check if the cloned line has the minimum number of points.
- \return Returns true if the operation successed otherwise returns false.
- */
-TL_DLL bool TeCloneLine(const TeLine2D& lineIn, TeLine2D& lineOut, const unsigned int& minPts);
-
-//! Clone polygon lines and try to remove duplicated coordinates from lines.
-/*
- \param polIn Polygon to be cloned.
- \param polOut Cloned polygon without repeated points.
- \return Returns true if the operation successed otherwise returns false.
- */
-TL_DLL bool TeClonePolygon(const TePolygon& polIn, TePolygon& polOut);
-
-//! Clone polygons lines and try to remove duplicated coordinates from lines.
-/*
- \param polsIn Polygons to be cloned.
- \param polsOut Cloned polygons without repeated points.
- \return Returns true if the operation successed otherwise returns false.
- */
-TL_DLL bool TeClonePolygonSet(const TePolygonSet& polsIn, TePolygonSet& polsOut);
-
-} // end namespace TeOVERLAY
-
-#endif // __TERRALIB_INTERNAL_OVERLAYUTILS_H
-
-
diff --git a/src/terralib/kernel/TePieBar.h b/src/terralib/kernel/TePieBar.h
deleted file mode 100644
index 906406f..0000000
--- a/src/terralib/kernel/TePieBar.h
+++ /dev/null
@@ -1,317 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TePieBar.h
- \brief This file contains a class that represents a char (pie or bar)
-*/
-#ifndef TEPIEBAR_H
-#define TEPIEBAR_H
-
-#include "TeDefines.h"
-
-//! A class that represents a chart (pie or bar)
-class TL_DLL TePieBar
-{
-public:
- enum TePieBarInput {ALL, TABSEL, QUERYSEL, LEGEND, NOTTABSEL, NOTQUERYSEL, NOTLEGEND};
- string type_; // PIECHART or BARCHART
- int themeId_;
- double maxDiameter_;
- double minDiameter_;
- double diameter_;
- string dimensionAttr_;
- vector<string> attrVector_;
- vector<TeColor> colorVector_;
- double maxHeight_;
- double minHeight_;
- double width_;
- double maxValue_;
- double minValue_;
- bool keepDimension_;
- int inputType_;
- TeDatabase *db_;
- string keyMove_;
-
- TePieBar() {}
-
- TePieBar(int themeId, TeDatabase* db)
- {
- themeId_ = themeId;
- db_ = db;
- }
-
- TePieBar (const TePieBar& pb )
- {
- type_ = pb.type_;
- themeId_ = pb.themeId_;
- maxDiameter_ = pb.maxDiameter_;
- minDiameter_ = pb.minDiameter_;
- diameter_ = pb.diameter_;
- dimensionAttr_ = pb.dimensionAttr_;
- maxHeight_ = pb.maxHeight_;
- minHeight_ = pb.minHeight_;
- width_ = pb.width_;
- maxValue_ = pb.maxValue_;
- minValue_ = pb.minValue_;
- keepDimension_ = pb.keepDimension_;
- inputType_ = pb.inputType_;
- db_ = pb.db_;
- keyMove_ = pb.keyMove_;
-
- attrVector_.clear();
- colorVector_.clear();
- int size = pb.attrVector_.size();
- int i = 0;
- while(i < size)
- { attrVector_.push_back(pb.attrVector_[i]);
- colorVector_.push_back(pb.colorVector_[i]);
- i++;
- }
- }
-
- TePieBar& operator=(const TePieBar& pb)
- {
- type_ = pb.type_;
- themeId_ = pb.themeId_;
- maxDiameter_ = pb.maxDiameter_;
- minDiameter_ = pb.minDiameter_;
- diameter_ = pb.diameter_;
- dimensionAttr_ = pb.dimensionAttr_;
- maxHeight_ = pb.maxHeight_;
- minHeight_ = pb.minHeight_;
- width_ = pb.width_;
- maxValue_ = pb.maxValue_;
- minValue_ = pb.minValue_;
- keepDimension_ = pb.keepDimension_;
- inputType_ = pb.inputType_;
- db_ = pb.db_;
- keyMove_ = pb.keyMove_;
-
- attrVector_.clear();
- colorVector_.clear();
- int size = pb.attrVector_.size();
- int i = 0;
- while(i < size)
- { attrVector_.push_back(pb.attrVector_[i]);
- colorVector_.push_back(pb.colorVector_[i]);
- i++;
- }
- return *this;
- }
-
- ~TePieBar() {}
-
- void init(int themeId, TeDatabase* db)
- {
- themeId_ = themeId;
- db_ = db;
- }
-
- bool locate(TeCoord2D pt, double delta)
- {
- keyMove_.clear();
- string TS = "AuxTheme" + Te2String(themeId_);
- string xmin = Te2String(pt.x()-delta);
- string xmax = Te2String(pt.x()+delta);
- string ymin = Te2String(pt.y()-delta);
- string ymax = Te2String(pt.y()+delta);
-
- TeDatabasePortal* portal = db_->getPortal();
- string sel = "SELECT SELKEY FROM " + TS + " WHERE ";
- sel += "PIEBARX > " + xmin + " AND ";
- sel += "PIEBARX < " + xmax + " AND ";
- sel += "PIEBARY > " + ymin + " AND ";
- sel += "PIEBARY < " + ymax;
- if(portal->query(sel) == false)
- {
- delete portal;
- return false;
- }
-
- bool b = portal->fetchRow(0);
- if(b == true)
- keyMove_ = portal->getData(0);
- delete portal;
-
- if(keyMove_.empty() == false)
- return true;
- return false;
- }
-
- void move(TeCoord2D pt)
- {
- if(keyMove_.empty() == true)
- return;
-
- string x = Te2String(pt.x());
- string y = Te2String(pt.y());
- string TS = "AuxTheme" + Te2String(themeId_);
- string mover = "UPDATE " + TS + " SET PIEBARX = " + x + ", PIEBARY = " + y;
- mover += " WHERE SELKEY = '" + keyMove_ + "'";
- db_->execute(mover);
- }
-
- bool load()
- {
- TeDatabasePortal* portal = db_->getPortal();
- string sel = "SELECT * FROM piebars WHERE themeId = " + Te2String(themeId_);
- if(portal->query(sel))
- {
- bool b = portal->fetchRow(0);
- if(b == false)
- {
- delete portal;
- return false;
- }
- type_ = portal->getData("type");
- maxDiameter_ = portal->getDouble("maxDiameter");
- minDiameter_ = portal->getDouble("minDiameter");
- diameter_ = portal->getDouble("diameter"));
- string attr = portal->getData("dimensionAttr");
- dimensionAttr_ = attr;
- maxHeight_ = portal->getDouble("maxHeight");
- minHeight_ = portal->getDouble("minHeight");
- width_ = portal->getDouble("width"));
- maxValue_ = portal->getDouble("maxValue");
- minValue_ = atof(portal->getData("minValue");
- keepDimension_ = portal->getDouble("keepDimension");
- inputType_ = portal->getDouble("inputType");
- int i;
- for(i=0; i<10; i++)
- {
- string attr = "attr" + Te2String(i+1);
- string vattr = portal->getData(attr);
- if(vattr.empty() == true)
- break;
- attrVector_.push_back(vattr);
-
- string red = "red" + Te2String(i+1);
- string green = "green" + Te2String(i+1);
- string blue = "blue" + Te2String(i+1);
- TeColor cor;
- cor.red_ = atoi(portal->getData(red));
- cor.green_ = atoi(portal->getData(green));
- cor.blue_ = atoi(portal->getData(blue));
- colorVector_.push_back(cor);
- }
- delete portal;
- return true;
- }
- delete portal;
- return false;
- }
-
- void save()
- {
- int i;
- TeDatabasePortal* portal = db_->getPortal();
- bool b = portal->query("SELECT * FROM piebars");
- delete portal;
- if(b == false)
- {
- string criar = "CREATE TABLE piebars (themeId INTEGER,";
- criar += "type VARCHAR(16) DEFAULT NULL,";
- criar += "maxDiameter DOUBLE DEFAULT NULL,";
- criar += "minDiameter DOUBLE DEFAULT NULL,";
- criar += "diameter DOUBLE DEFAULT NULL,";
- criar += "dimensionAttr VARCHAR(64) DEFAULT NULL,";
- criar += "maxHeight DOUBLE DEFAULT NULL,";
- criar += "minHeight DOUBLE DEFAULT NULL,";
- criar += "width DOUBLE DEFAULT NULL,";
- criar += "maxValue DOUBLE DEFAULT NULL,";
- criar += "minValue DOUBLE DEFAULT NULL,";
- criar += "keepDimension INTEGER DEFAULT 0,";
- criar += "inputType INTEGER DEFAULT 0,";
- for (i=0; i<10; i++)
- {
- criar += "attr" + Te2String(i+1) + " VARCHAR(64) DEFAULT NULL,";
- criar += "red" + Te2String(i+1) + " INTEGER DEFAULT NULL,";
- criar += "green" + Te2String(i+1) + " INTEGER DEFAULT NULL,";
- criar += "blue" + Te2String(i+1) + " INTEGER DEFAULT NULL,";
- }
- criar.erase(criar.size()-1, 1);
- criar += ")";
- db_->execute(criar);
- }
-
- string del = "DELETE FROM piebars WHERE themeId = " + Te2String(themeId_);
- db_->execute(del);
-
- if(attrVector_.size() == 0)
- return;
- string up = "INSERT INTO piebars (themeId, type, maxDiameter, ";
- up += "minDiameter, diameter, dimensionAttr, maxHeight, minHeight, ";
- up += "width, maxValue, minValue, keepDimension, inputType, ";
- for (i=0; i<attrVector_.size() && i<10; i++)
- {
- up += "attr" + Te2String(i+1) + ", ";
- up += "red" + Te2String(i+1) + ", ";
- up += "green" + Te2String(i+1) + ", ";
- up += "blue" + Te2String(i+1) + ", ";
- }
- up.erase(up.size()-2, 2);
- up += ")";
-
- up += " VALUES (" + Te2String(themeId_) + ", ";
- up += "'" + type_ + "', ";
- up += Te2String(maxDiameter_) + ", ";
- up += Te2String(minDiameter_) + ", ";
- up += Te2String(diameter_) + ", ";
- up += "'" + dimensionAttr_ + "', ";
- up += Te2String(maxHeight_) + ", ";
- up += Te2String(minHeight_) + ", ";
- up += Te2String(width_) + ", ";
- up += Te2String(maxValue_) + ", ";
- up += Te2String(minValue_) + ", ";
- up += Te2String(keepDimension_) + ", ";
- up += Te2String(inputType_) + ", ";
- for (i=0; i<attrVector_.size() && i<10; i++)
- {
- up += "'" + attrVector_[i] + "', ";
- up += Te2String(colorVector_[i].red_) + ", ";
- up += Te2String(colorVector_[i].green_) + ", ";
- up += Te2String(colorVector_[i].blue_) + ", ";
- }
- up.erase(up.size()-2, 2);
- up += ")";
- db_->execute(up);
- }
-
- void remove()
- {
- TeDatabasePortal* portal = db_->getPortal();
- bool b = portal->query("SELECT * FROM piebars");
- delete portal;
- if(b == false)
- return;
-
- string del = "DELETE FROM piebars WHERE themeId = " + Te2String(themeId_);
- db_->execute(del);
- }
-};
-
-#endif
-
-
-
-
-
diff --git a/src/terralib/kernel/TePrecision.h b/src/terralib/kernel/TePrecision.h
index 0faf44d..f094d38 100644
--- a/src/terralib/kernel/TePrecision.h
+++ b/src/terralib/kernel/TePrecision.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TePrecision.h
\brief This file contains a singleton to manage precision in TerraLib.
*/
diff --git a/src/terralib/kernel/TeProgress.cpp b/src/terralib/kernel/TeProgress.cpp
deleted file mode 100644
index 2e7acbf..0000000
--- a/src/terralib/kernel/TeProgress.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeProgress.h"
-
-TeProgressBase* TeProgress::instance_ = 0;
-
-
-TeProgressBase* TeProgress::instance()
-{
- return instance_;
-}
-
-void TeProgress::setProgressInterf( TeProgressBase* interf )
-{
- instance_ = interf;
-}
diff --git a/src/terralib/kernel/TeProgress.h b/src/terralib/kernel/TeProgress.h
deleted file mode 100644
index 7bc2b0f..0000000
--- a/src/terralib/kernel/TeProgress.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeProgress.h
- \brief This file contains a singleton for progress information.
-*/
-
-#ifndef __TERRALIB_INTERNAL_PROGRESS_H
-#define __TERRALIB_INTERNAL_PROGRESS_H
-
-#include "TeProgressBase.h"
-
-//! Provides the suport to implement an instance of a progress bar interface
-/*
- This class is based on a Singleton Design Pattern (See "Design Patterns" book, page 127).
- Applications should set the Progress Interface that will be used by the TerraLib routines
- able to indicate progress in executing a task.
-*/
-class TL_DLL TeProgress
-{
-public:
-
- //! Returns the unique instance of a progress interface
- static TeProgressBase* instance();
-
- //! Sets the unique instance of a progress interface
- static void setProgressInterf( TeProgressBase* interf );
-
- //! Virtual destructor
- virtual ~TeProgress() {}
-
-protected:
-
- //! Empty constructor
- TeProgress() {}
-
-private:
-
- static TeProgressBase* instance_; //!< The unique instance of a progress interface
-
- //! No copy allowed
- TeProgress(const TeProgress&);
-
- //! No copy allowed
- TeProgress& operator=(const TeProgress&){return *this;}
-};
-#endif
-
diff --git a/src/terralib/kernel/TeProgressBase.h b/src/terralib/kernel/TeProgressBase.h
deleted file mode 100644
index 70804a6..0000000
--- a/src/terralib/kernel/TeProgressBase.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TePrecision.h
- \brief This file contains a singleton to manage precision in TerraLib.
-*/
-#ifndef __TERRALIB_INTERNAL_PROGRESSBASE_H
-#define __TERRALIB_INTERNAL_PROGRESSBASE_H
-
-#include "TeDefines.h"
-#include <string>
-using std::string;
-
-//! A generic Progress Interface.
-/*
- It defines the methods that should be implemented by concrete classes.
- Assumes that a progress interface has a Caption to indicate the task
- being monitored and a Message to be displayed along with the progress
- indication. A progress interface also know the total number of steps
- required to finish the task being monitored.
-*/
-class TL_DLL TeProgressBase
-{
-public:
-
- //! Constructor
- TeProgressBase(){}
-
- //! Destructor
- virtual ~TeProgressBase() {}
-
- //! Sets the total number of steps to n
- virtual void setTotalSteps(int n) =0;
-
- //! Sets the current amount of progress made to n
- virtual void setProgress(int n) = 0;
-
- //! Resets the progress interface
- virtual void reset() = 0;
-
- //! Resets the progress dialog
- virtual void cancel() = 0;
-
- //! Sets the label's text
- virtual void setMessage(const string& text) = 0;
-
- //!Returns the label's text
- virtual string getMessage() { return ""; }
-
- //! Returns true whether the process was cancelled
- virtual bool wasCancelled() = 0;
-
- //! Sets the caption associated to the progress interface
- virtual void setCaption(const string& cap) = 0;
-
-};
-#endif
diff --git a/src/terralib/kernel/TeProject.cpp b/src/terralib/kernel/TeProject.cpp
deleted file mode 100644
index 2c4ef8d..0000000
--- a/src/terralib/kernel/TeProject.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2006 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-#include "TeProject.h"
-#include "TeDatabase.h"
-
-TeProject::TeProject():
- id_(-1),
- name_(""),
- description_(""),
- currentViewIndex_(-1),
- db_(0)
-{}
-
-//! Constructor from a identifier
-TeProject::TeProject(int id, TeDatabase* db):
- id_(id),
- name_(""),
- description_(""),
- currentViewIndex_(-1),
- db_(db)
-{
- if (!db)
- return;
- string sql = "SELECT name, decription, current_view, view_id ";
- sql += "FROM te_project INNER JOIN te_project_view ON te_project.project_id = te_project_view.project_id";
- sql += " WHERE te_project.project_id = " + Te2String(id);
- sql += Te2String(id);
- TeDatabasePortal* portal = db->getPortal();
- if (!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return;
- }
- // use the first fetch to get basic information
- name_ = portal->getData(0);
- description_ = portal->getData(1);
- int currentview = portal->getInt(2);
- int viewid = portal->getInt(3);
- views_.push_back(portal->getInt(3));
- if (viewid == currentview)
- currentViewIndex_ = 0;
-
- // get the other views
- while (portal->fetchRow())
- {
- viewid = portal->getInt(3);
- views_.push_back(viewid);
- if (viewid == currentview)
- currentViewIndex_ = views_.size()-1;
- }
- delete portal;
-}
-
- //! Constructor from a name
-TeProject::TeProject(const string& name, TeDatabase* db):
- id_(-1),
- name_(name),
- description_(""),
- currentViewIndex_(-1),
- db_(db)
-{
- if (!db)
- return;
- string sql = "SELECT te_project.project_id, decription, current_view, view_id ";
- sql += "FROM te_project INNER JOIN te_project_view ON te_project.project_id = te_project_view.project_id";
- sql += " WHERE name = '" + name + "'";
-
- TeDatabasePortal* portal = db->getPortal();
- if (!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return;
- }
- // use the first fetch to get basic information
- id_ = portal->getInt(0);
- description_ = portal->getData(1);
- int currentview = portal->getInt(2);
- int viewid = portal->getInt(3);
- views_.push_back(portal->getInt(3));
- if (viewid == currentview)
- currentViewIndex_ = 0;
-
- // get the other views
- while (portal->fetchRow())
- {
- viewid = portal->getInt(3);
- views_.push_back(viewid);
- if (viewid == currentview)
- currentViewIndex_ = views_.size()-1;
- }
- delete portal;
-}
-
-TeProject::TeProject(const TeProject& other)
-{
- id_ = other.id_;
- name_= other.name_;
- description_= other.description_;
- views_= other.views_;
- currentViewIndex_= other.currentViewIndex_;
- db_= other.db_;
-}
-
-TeProject&
-TeProject::operator= (const TeProject& other)
-{
- if ( this != &other )
- {
- id_ = other.id_;
- name_= other.name_;
- description_= other.description_;
- views_= other.views_;
- currentViewIndex_= other.currentViewIndex_;
- db_= other.db_;
- }
- return *this;
-}
-
-//! Destructor
-TeProject::~TeProject()
-{
- views_.clear();
- db_=0;
-}
-
- //! Returns TRUE if a view is part of a project and FALSE otherwise
-bool
-TeProject::isProjectView(int viewId)
-{
- TeViewVector::iterator it = find(views_.begin(), views_.end(), viewId);
- return (it != views_.end());
-}
-
- //! Returns TRUE if a project has a current view and FALSE otherwise
-bool
-TeProject::hasCurrentView()
-{ return (currentViewIndex_>=0 && currentViewIndex_< static_cast<int>(views_.size())); }
-
-
-//! Returns the id of the current view in the project
-int
-TeProject::getCurrentViewId()
-{
- if (currentViewIndex_>=0 && currentViewIndex_< static_cast<int>(views_.size()))
- return views_[currentViewIndex_];
- else
- return -1;
-}
-
-//! Sets the id of the current view in the project
-void
-TeProject::setCurrentViewId(int viewId)
-{
- currentViewIndex_ = -1;
- for (unsigned int i=0; i<views_.size(); ++i)
- {
- if (views_[i] == viewId)
- {
- currentViewIndex_ = i;
- break;
- }
- }
-}
-
- //! Returns the id of the index-th view of the project
-int
-TeProject::getViewId(int index)
-{
- if (index >= 0 && index < static_cast<int>(views_.size()))
- return views_[index];
- else
- return -1;
-}
-
-//! Returns the names of the views in the project.
-TeViewNameVector
-TeProject::getViewNameVector()
-{
- TeViewNameVector viewNames;
- if (!db_ || views_.empty())
- return viewNames;
-
- string viewids = Te2String(views_[0]);
- for (unsigned int i=1; i<views_.size(); ++i)
- {
- viewids += ",";
- viewids += Te2String(views_[i]);
- }
- string sql = "SELECT te_view.name ";
- sql += "FROM te_view INNER JOIN te_project_view ON te_view.view_id = te_project_view.view_id ";
- sql += "WHERE te_project_view.project_id = " + Te2String(id_);
-
- TeDatabasePortal* portal = db_->getPortal();
- if (!portal)
- return viewNames;
- if (!portal->query(sql))
- {
- delete portal;
- return viewNames;
- }
- while (portal->fetchRow())
- viewNames.push_back(portal->getData(0));
- delete portal;
- return viewNames;
-}
-
-int
-TeProject::insertView(string name, TeProjection* projection)
-{
- TeProjection* proj;
- if (!db_)
- return -1;
- if (projection)
- proj = projection;
- else
- {
- TeDatum sad69 = TeDatumFactory::make("SAD69");
- proj = new TeLatLong(sad69);
- }
- TeView* view = new TeView(name);
- view->projection(proj);
- view->user(db_->user());
- if (db_->insertView(view))
- {
- return insertViewRel(view->id());
- }
- return -1;
-}
-
-int
-TeProject::insertViewRel(int viewId)
-{
- if (!db_)
- return -1;
-
- if(db_->insertProjectViewRel(id_,viewId))
- return addView(viewId);
-
- return -1;
-}
-
-int
-TeProject::addView(int viewId)
-{
- if (viewId <=0)
- return -1;
- views_.push_back(viewId);
- currentViewIndex_ = views_.size()-1;
- return viewId;
-}
-
-void
-TeProject::deleteView(int viewId)
-{
- if (!db_)
- return;
- TeViewVector::iterator pos = find(views_.begin(),views_.end(),viewId);
- if (pos != views_.end())
- views_.erase(pos);
- db_->deleteView(viewId);
-}
-
-//! Clear the project
-void
-TeProject::clearViews()
-{
- views_.clear();
- currentViewIndex_ = -1;
-}
-
-
diff --git a/src/terralib/kernel/TeProject.h b/src/terralib/kernel/TeProject.h
deleted file mode 100644
index 2d09a70..0000000
--- a/src/terralib/kernel/TeProject.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeProject.h
- \brief This file contains structures and definitions to support the concept of a project in TerraLib
-*/
-#ifndef __TERRALIB_INTERNAL_PROJECT_H
-#define __TERRALIB_INTERNAL_PROJECT_H
-
-#include "TeDefines.h"
-#include <string>
-#include <vector>
-#include <map>
-
-class TeDatabase;
-class TeProjection;
-class TeView;
-
-using std::vector;
-using std::string;
-using std::map;
-
-//! A vector of the identifiers of the maps in the project.
-typedef vector<int> TeViewVector;
-
-//! A vector of the names of the views in the project.
-typedef vector<string> TeViewNameVector;
-
-//! A vector of the identifiers of the projects.
-typedef vector<int> TeProjectIdVector;
-
-/*!
- This class represents a project concept.
- A project is a collection of views kept in a ordered list.
- A project might have the information about the current view.
-*/
-class TL_DLL TeProject
-{
-public:
-
- //! Empty constructor
- TeProject();
-
- //! Constructor from a identifier
- TeProject(int id, TeDatabase* db);
-
- //! Constructor from a name
- TeProject(const string& name, TeDatabase* db);
-
- //! Copy Constructor
- TeProject(const TeProject& other);
-
- //! Operator =
- TeProject& operator= (const TeProject& other);
-
- //! Destructor
- virtual ~TeProject();
-
- //! Sets the project name.
- virtual void setId(int id)
- {id_ = id;}
-
- //! Returns the project name.
- virtual int id()
- { return id_; }
-
- //! Sets the project name.
- virtual void setName(const string& name)
- {name_ = name;}
-
- //! Returns the project name.
- virtual string name()
- { return name_; }
-
- //! Returns the project description.
- virtual string description()
- { return description_; }
-
- //! Sets the project description
- virtual void setDescription(const string& desc)
- { description_ = desc ; }
-
- //! Sets the project database
- virtual void setDatabase(TeDatabase* db)
- { db_ = db; }
-
- //! Gets the project database
- virtual TeDatabase* getDatabase()
- { return db_; }
-
- //! Returns TRUE if a view is part of a project and FALSE otherwise
- virtual bool isProjectView(int viewId);
-
- //! Returns TRUE if a project has a current view and FALSE otherwise
- virtual bool hasCurrentView();
-
- //! Sets the id of the current view in the project
- virtual void setCurrentViewId(int viewId);
-
- //! Returns the id of the current view in the project
- virtual int getCurrentViewId();
-
- //! Sets the index in the list of the current view in the project
- virtual void setCurrentViewIndex(int index)
- { currentViewIndex_ = index; }
-
- //! Returns position of the current view in the project
- virtual int getCurrentViewIndex()
- { return currentViewIndex_; }
-
- //! Returns a reference to the project list of views
- const TeViewVector& getViewVector() const
- { return views_; }
-
- //! Returns the names of the views in the project.
- virtual TeViewNameVector getViewNameVector();
-
- //! Returns the id of the index-th view of the project
- virtual int getViewId(int index);
-
- //! Creates a new view in the project and persists it in the database
- /*
- \param name view name
- \param projection view projection. If null uses as default LatLong/SAD69
- \return the id of the new view
- */
- virtual int insertView(string name, TeProjection* projection = NULL);
-
- //! Adds a new view relation with the project and persists it in the database
- /*
- \param view The view object
- \return the id of the new view
- */
- virtual int insertViewRel(int viewId);
-
- //! Adds an view id to the views project vector
- virtual int addView(int viewId);
-
- //! Removes a view from the project (and also from the database)
- virtual void deleteView(int viewId);
-
- //! Clear the project
- virtual void clearViews();
-
-private:
- int id_;
- string name_;
- string description_;
- TeViewVector views_;
- int currentViewIndex_;
- TeDatabase* db_;
-};
-
-//! A map from a integer unique identifier to a pointer to project
-typedef map<int, TeProject*> TeProjectMap;
-
-#endif
diff --git a/src/terralib/kernel/TeProjection.cpp b/src/terralib/kernel/TeProjection.cpp
index 1fb9b8a..e83c93a 100644
--- a/src/terralib/kernel/TeProjection.cpp
+++ b/src/terralib/kernel/TeProjection.cpp
@@ -1,25 +1,12 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifdef WIN32
#pragma warning ( disable: 4786 )
diff --git a/src/terralib/kernel/TeProjection.h b/src/terralib/kernel/TeProjection.h
index e93d49d..c832cbd 100644
--- a/src/terralib/kernel/TeProjection.h
+++ b/src/terralib/kernel/TeProjection.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeProjection.h
\brief This file contains support do deal with geographical projections
*/
diff --git a/src/terralib/kernel/TeProjectiveGT.cpp b/src/terralib/kernel/TeProjectiveGT.cpp
deleted file mode 100644
index 6064ee9..0000000
--- a/src/terralib/kernel/TeProjectiveGT.cpp
+++ /dev/null
@@ -1,571 +0,0 @@
-/*
-TerraLib - a library for developing GIS applications.
-Copyright 2001, 2002, 2003 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular
-purpose. The library provided hereunder is on an "as is" basis, and the
-authors have no obligation to provide maintenance, support, updates,
-enhancements, or modifications.
-In no event shall INPE be held liable to any party
-for direct, indirect, special, incidental, or consequential damages arising
-out of the use of this library and its documentation.
-*/
-
-#include "TeProjectiveGT.h"
-#include "TeGeometry.h"
-
-#include <assert.h>
-#include <math.h>
-
-
-TeProjectiveGT::TeProjectiveGT() :
- deltaX_( 0 ), deltaY_( 0 ), deltaU_( 0 ), deltaV_( 0 )
-{
-}
-
-
-TeProjectiveGT::~TeProjectiveGT()
-{
-}
-
-
-void TeProjectiveGT::directMap( const TeGTParams& params, const TeCoord2D& pt1,
- TeCoord2D& pt2 ) const
-{
- assert( params.direct_parameters_.Ncol() == 3 );
- assert( params.direct_parameters_.Nrow() == 3 );
-
- double x = pt1.x();
- double y = pt1.y();
-
- if( ! params.useAdaptiveParams_ )
- {
- // denominador da fc projetiva
- double den = params.direct_parameters_( 2, 0 ) * x + params.direct_parameters_( 2, 1 ) * y + 1;
-
- pt2.x( ( params.direct_parameters_( 0, 0 ) * x +
- params.direct_parameters_( 0, 1 ) * y +
- params.direct_parameters_( 0, 2 ) ) / den );
- pt2.y( ( params.direct_parameters_( 1, 0 ) * x +
- params.direct_parameters_( 1, 1 ) * y +
- params.direct_parameters_( 1, 2 ) ) / den );
- }
- else // use Adaptive parameters
- {
- x -= deltaX_;
- y -= deltaY_;
-
- double den = params.direct_parameters_( 2, 0 ) * x + params.direct_parameters_( 2, 1 ) * y + 1;
-
- pt2.x( ( params.direct_parameters_( 0, 0 ) * x +
- params.direct_parameters_( 0, 1 ) * y +
- params.direct_parameters_( 0, 2 ) ) / den
- + deltaU_ );
- pt2.y( ( params.direct_parameters_( 1, 0 ) * x +
- params.direct_parameters_( 1, 1 ) * y +
- params.direct_parameters_( 1, 2 ) ) / den
- + deltaV_ );
- }
-}
-
-
-void TeProjectiveGT::inverseMap( const TeGTParams& params, const TeCoord2D& pt2,
- TeCoord2D& pt1 ) const
-{
- assert( params.inverse_parameters_.Ncol() == 3 );
- assert( params.inverse_parameters_.Nrow() == 3 );
-
- double u = pt2.x();
- double v = pt2.y();
-
- if( ! params.useAdaptiveParams_ )
- {
- // denominador da fc projetiva
- double den = params.inverse_parameters_( 2, 0 ) * u + params.inverse_parameters_( 2, 1 ) * v + 1;
-
- pt1.x( ( params.inverse_parameters_( 0, 0 ) * u +
- params.inverse_parameters_( 0, 1 ) * v +
- params.inverse_parameters_( 0, 2 ) ) / den );
- pt1.y( ( params.inverse_parameters_( 1, 0 ) * u +
- params.inverse_parameters_( 1, 1 ) * v +
- params.inverse_parameters_( 1, 2 ) ) / den );
- }
- else // use Adaptive parameters
- {
- u -= deltaU_;
- v -= deltaV_;
-
- double den = params.inverse_parameters_( 2, 0 ) * u + params.inverse_parameters_( 2, 1 ) * v + 1;
-
- pt1.x( ( params.inverse_parameters_( 0, 0 ) * u +
- params.inverse_parameters_( 0, 1 ) * v +
- params.inverse_parameters_( 0, 2 ) ) / den
- + deltaX_ );
- pt1.y( ( params.inverse_parameters_( 1, 0 ) * u +
- params.inverse_parameters_( 1, 1 ) * v +
- params.inverse_parameters_( 1, 2 ) ) / den
- + deltaY_ );
- }
-}
-
-
-unsigned int TeProjectiveGT::getMinRequiredTiePoints() const
-{
- // At least four points
- return 4;
-}
-
-
-bool TeProjectiveGT::computeParameters( TeGTParams& params )
-{
- TEAGN_DEBUG_CONDITION( ( params.tiepoints_.size() > 3 ),
- "Invalid tie-points size" )
-
- // calcula os parametros adaptativos
- // caso contrario, reinicia o estado
- if( params.useAdaptiveParams_ )
- setAdaptativeParameters( params.tiepoints_ );
- else
- deltaX_ = deltaY_ = deltaU_ = deltaV_ = 0;
-
- // a forma do calculo depende da qtd pontos
- const unsigned int tiepoints_size = params.tiepoints_.size();
-
- if( tiepoints_size > 4 )
- {
- // Solucao com sobredeterminacao -> ajustamento
- // mapeamento direto
- if( ! useAdjustment( params, true ) )
- return false;
-
- // mapeamento inverso
- return useAdjustment( params, false );
- }
- else
- {
- // Solucao deterministica
- // mapeamento direto
- if( ! useDeterministic( params, true ) )
- return false;
-
- // mapeamento inverso
- return useDeterministic( params, false );
-
- } // fim if tiepoints
-
-}
-
-bool TeProjectiveGT::useAdjustment( TeGTParams& params, bool isDirectMapping )
-{
- /*
- u = b11.x + b12.y + b13
- -------------------
- b31.x + b32.y
-
- v = b21.x + b22.y + b23
- -------------------
- b31.x + b32.y
-
- Method adapted from Albertz and Kreiling (1989).
- Reference: Albertz, J.; Kreiling, W. Photogrametriches taschenbuch.
- Karlsruhe: Wichmann, 1989.
-
- Adaptive parameters by Xavier et al. (2007).
- Reference: Xavier, E.; Fonseca, L.; d'Alge, J.; Castejon, E. Implementacao
- da transformacao projetiva na TerraLib: uma analise comparativa com a
- transformacao afim. Anais do XIII Simposio Brasileiro de Sensoriamento
- Remoto. <http://www.dsr.inpe.br/sbsr2007/>, 2007.
- */
-
- // inicializacao das variaveis
-
- // tamanho de Lb
- // Lb : vetor das observacoes brutas (originais)
- const unsigned int tiepoints_size = params.tiepoints_.size();
-
- // A: matriz do sistema de equacoes
- // inicializa com zeros
- TeMatrix A;
- if( ! A.Init( 2*tiepoints_size, 8, 0.0 ) )
- {
- return false;
- }
-
- // L: vetor das correcoes das observacoes
- TeMatrix L;
- if( ! L.Init( 2*tiepoints_size, 1 ) )
- {
- return false;
- }
-
- // At: transposta de A
- TeMatrix At;
-
- // N = At*P*A
- TeMatrix N;
-
- // N_inv : inversa de N
- TeMatrix N_inv;
-
- // U = At*P*Lb
- TeMatrix U;
-
- // Xa : vetor dos parametros ajustados
- TeMatrix Xa;
-
- // X0 : vetor dos parametros iniciais
- TeMatrix X0;
-
- // X = Xa-X0 : vetor das correcoes
- TeMatrix X;
-
- // W: matriz peso das observacoes
- bool hasWMatrix = ( ( params.WMatrix_.Nrow() ==
- (int)( tiepoints_size * 2 ) ) && ( params.WMatrix_.Ncol() ==
- (int)( tiepoints_size * 2 ) ) ) ? true : false;
-
- // V: residuos das observacoes
-
- // iterador p/ correr as observacoes
- std::vector< TeCoordPair >::const_iterator iterator;
-
- // Inicializacao de X0
- // [1 0 0 0 1 0 0 0]t
- X0.Init( 8, 1, 0.0 );
- X0(0, 0) = 1;
- X0(4, 0) = 1;
-
-
- /**************************************************************\
- Solucao com sobredeterminacao -> ajustamento
- \**************************************************************/
-
- // 0) Montando o laco while ate q o valor convirja (isTolReached)
- // ou alcance o Nr max de iteracoes (maxIters_)
-
- // contagem das iteracoes
- unsigned int iter = 0;
-
- // alcancou a tolerancia?
- bool isTolReached = false;
-
- while( iter++ < params.maxIters_ && ! isTolReached )
- {
- // inicializando o iterador dos pontos observados (u/v)
- iterator = params.tiepoints_.begin();
-
- for ( unsigned int i = 0; i < tiepoints_size; ++i )
- {
- // pontos usados em todo o laco
- // xi,yi : from
- // ui,ui : to
- double xi, yi;
- double ui, vi;
-
- if( isDirectMapping )
- {
- xi = iterator->pt1.x() - deltaX_;
- yi = iterator->pt1.y() - deltaY_;
- ui = iterator->pt2.x() - deltaU_;
- vi = iterator->pt2.y() - deltaV_;
- }
- else
- {
- xi = iterator->pt2.x() - deltaU_;
- yi = iterator->pt2.y() - deltaV_;
- ui = iterator->pt1.x() - deltaX_;
- vi = iterator->pt1.y() - deltaY_;
- }
-
- // denominador da fc projetiva
- // den = b31 * xi + b32 * yi + 1
- double den = X0( 6, 0 ) * xi + X0( 7, 0 ) * yi + 1;
-
- // funcao projetiva p/ U e V
- // U = ( b11 * xi + b12 * yi + b13 ) / den
- double funcU = ( X0( 0, 0 ) * xi + X0( 1, 0 ) * yi + X0( 2, 0 ) - xi * ui * X0( 6, 0 ) -yi * ui * X0( 7, 0 ) );
-
- // V = ( b21 * xi + b22 * yi + b23 ) / den
- double funcV = ( X0( 3, 0 ) * xi + X0( 4, 0 ) * yi + X0( 5, 0 ) - xi * vi * X0( 6, 0 ) -yi * vi * X0( 7, 0 ) );
-
- // 1) Calculo de L
- // L = L0 - Lb
- L( 2*i , 0 ) = (funcU - ui) / den;
- L( 2*i+1, 0 ) = (funcV - vi) / den;
-
- // 2) Montagem de A
- // lembrando q jah tem zero em tudo
- A( 2*i , 0 ) = xi / den;
- A( 2*i , 1 ) = yi / den;
- A( 2*i , 2 ) = 1 / den;
- A( 2*i , 6 ) = -xi*ui/den;
- A( 2*i , 7 ) = -yi*ui/den;
-
- A( 2*i+1 , 3 ) = A( 2*i, 0 );
- A( 2*i+1 , 4 ) = A( 2*i, 1 );
- A( 2*i+1 , 5 ) = A( 2*i, 2 );
- A( 2*i+1 , 6 ) = -xi*vi/den;
- A( 2*i+1 , 7 ) = -yi*vi/den;
-
- ++iterator;
- } // fim for_tiepoints
-
- // 3) Calculo de N
- A.Transpose( At );
-
- // Se W_ esta definida
- if( hasWMatrix )
- {
- N = At * params.WMatrix_;
- N = N * A;
- }
- else
- N = At * A;
-
- // 4) Calculo de U
- // Se W_ esta definida
- if( hasWMatrix )
- {
- U = At * params.WMatrix_;
- U = U * L;
- }
- else
- U = At * L;
-
- // 5) Calculo de X
- if( ! N.Inverse( N_inv ) )
- return false;
-
- X = - N_inv * U;
-
- // 6) Calculo de Xa
- Xa = X0 + X;
-
- // 7) Atualiza o X0 p/ proxima iteracao
- X0 = Xa;
-
- // 8) Checando se a tolerancia foi atingida
-
- isTolReached = true;
- for( unsigned int j = 0; j < 8; ++j )
- {
- if( fabs( X( j, 0 ) ) > params.tolerance_ )
- {
- isTolReached = false;
- break;
- }
- }
-
- } // fim while
-
- // final - montagem da resposta
-
-
- if( isDirectMapping )
- {
- if( ! params.direct_parameters_.Init( 3, 3 ) )
- return false;
-
- params.direct_parameters_(0,0) = Xa(0,0);
- params.direct_parameters_(0,1) = Xa(1,0);
- params.direct_parameters_(0,2) = Xa(2,0);
-
- params.direct_parameters_(1,0) = Xa(3,0);
- params.direct_parameters_(1,1) = Xa(4,0);
- params.direct_parameters_(1,2) = Xa(5,0);
-
- params.direct_parameters_(2,0) = Xa(6,0);
- params.direct_parameters_(2,1) = Xa(7,0);
- params.direct_parameters_(2,2) = 1;
- }
- else
- {
- if( ! params.inverse_parameters_.Init( 3, 3 ) )
- return false;
-
- params.inverse_parameters_(0,0) = Xa(0,0);
- params.inverse_parameters_(0,1) = Xa(1,0);
- params.inverse_parameters_(0,2) = Xa(2,0);
-
- params.inverse_parameters_(1,0) = Xa(3,0);
- params.inverse_parameters_(1,1) = Xa(4,0);
- params.inverse_parameters_(1,2) = Xa(5,0);
-
- params.inverse_parameters_(2,0) = Xa(6,0);
- params.inverse_parameters_(2,1) = Xa(7,0);
- params.inverse_parameters_(2,2) = 1;
- }
-
- return true;
-}
-
-
-bool TeProjectiveGT::useDeterministic( TeGTParams& params, bool isDirectMapping )
-{
-
- // Solucao deterministica, da forma:
- // X = A^-1 . L
-
- // o vetor de ptos sempre tera tamanho 4
- const unsigned int tiepoints_size = 4;
-
- // A: matriz do sistema de equacoes
- // inicializa com zeros
- TeMatrix A;
- if( ! A.Init( 2*tiepoints_size, 8, 0.0 ) )
- {
- return false;
- }
-
- // L: vetor das observacoes
- TeMatrix L;
- if( ! L.Init( 2*tiepoints_size, 1 ) )
- {
- return false;
- }
-
- // inversa de A
- TeMatrix A_inv;
-
- // resultado
- TeMatrix X;
-
- // iterador p/ correr as observacoes
- std::vector< TeCoordPair >::const_iterator iterator = params.tiepoints_.begin();;
-
- // montagem de A e L
- for ( unsigned int i = 0; i < tiepoints_size; ++i ) {
-
- // pontos usados em todo o laco
- // xi,yi : from
- // ui,ui : to
- double xi, yi;
- double ui, vi;
-
- if( isDirectMapping )
- {
- xi = iterator->pt1.x();
- yi = iterator->pt1.y();
- ui = iterator->pt2.x();
- vi = iterator->pt2.y();
- }
- else
- {
- xi = iterator->pt2.x();
- yi = iterator->pt2.y();
- ui = iterator->pt1.x();
- vi = iterator->pt1.y();
- }
-
- // 1) Calculo de L
- L( 2*i , 0 ) = ui;
- L( 2*i+1, 0 ) = vi;
-
- // 2) Montagem de A
- // lembrando q jah tem zero em tudo
- A( 2*i , 0 ) = xi;
- A( 2*i , 1 ) = yi;
- A( 2*i , 2 ) = 1;
- A( 2*i , 6 ) = - xi * ui;
- A( 2*i , 7 ) = - yi * ui;
-
- A( 2*i+1 , 3 ) = xi;
- A( 2*i+1 , 4 ) = yi;
- A( 2*i+1 , 5 ) = 1;
- A( 2*i+1 , 6 ) = - xi * vi;
- A( 2*i+1 , 7 ) = - yi * vi;
-
- ++iterator;
-
- } // fim for_tiepoints
-
- // 3) Calculo de A_inv
- A.Inverse( A_inv );
-
- // 4) Calculo de X
- X = A_inv * L;
-
- // final - montagem da resposta
-
- if( isDirectMapping )
- {
- if( ! params.direct_parameters_.Init( 3, 3 ) )
- return false;
-
- params.direct_parameters_(0,0) = X(0,0);
- params.direct_parameters_(0,1) = X(1,0);
- params.direct_parameters_(0,2) = X(2,0);
-
- params.direct_parameters_(1,0) = X(3,0);
- params.direct_parameters_(1,1) = X(4,0);
- params.direct_parameters_(1,2) = X(5,0);
-
- params.direct_parameters_(2,0) = X(6,0);
- params.direct_parameters_(2,1) = X(7,0);
- params.direct_parameters_(2,2) = 1;
- }
- else
- {
- if( ! params.inverse_parameters_.Init( 3, 3 ) )
- return false;
-
- params.inverse_parameters_(0,0) = X(0,0);
- params.inverse_parameters_(0,1) = X(1,0);
- params.inverse_parameters_(0,2) = X(2,0);
-
- params.inverse_parameters_(1,0) = X(3,0);
- params.inverse_parameters_(1,1) = X(4,0);
- params.inverse_parameters_(1,2) = X(5,0);
-
- params.inverse_parameters_(2,0) = X(6,0);
- params.inverse_parameters_(2,1) = X(7,0);
- params.inverse_parameters_(2,2) = 1;
- }
-
- return true;
-}
-
-void TeProjectiveGT::setAdaptativeParameters( const std::vector< TeCoordPair >& tiepoints )
-{
- deltaX_ = TeMAXFLOAT;
- deltaY_ = TeMAXFLOAT;
- deltaU_ = TeMAXFLOAT;
- deltaV_ = TeMAXFLOAT;
-
- const unsigned int tiepoints_size = tiepoints.size();
-
- // iterador p/ correr as observacoes
- std::vector< TeCoordPair >::const_iterator iterator = tiepoints.begin();
-
- for ( unsigned int i = 0; i < tiepoints_size; ++i )
- {
- double xi, yi;
- double ui, vi;
-
- // obtem os valores
- xi = iterator->pt1.x();
- yi = iterator->pt1.y();
- ui = iterator->pt2.x();
- vi = iterator->pt2.y();
-
- // checa se eh o menor - cada um
- if( xi < deltaX_ ) deltaX_ = xi;
- if( yi < deltaY_ ) deltaY_ = yi;
- if( ui < deltaU_ ) deltaU_ = ui;
- if( vi < deltaV_ ) deltaV_ = vi;
-
- }
-
-}
-
diff --git a/src/terralib/kernel/TeProjectiveGT.h b/src/terralib/kernel/TeProjectiveGT.h
deleted file mode 100644
index f425df1..0000000
--- a/src/terralib/kernel/TeProjectiveGT.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-TerraLib - a library for developing GIS applications.
-Copyright 2001, 2002, 2003 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular
-purpose. The library provided hereunder is on an "as is" basis, and the
-authors have no obligation to provide maintenance, support, updates,
-enhancements, or modifications.
-In no event shall INPE be held liable to any party
-for direct, indirect, special, incidental, or consequential damages arising
-out of the use of this library and its documentation.
-*/
-
-#ifndef TEPROJECTIVEGT_H
-#define TEPROJECTIVEGT_H
-
-#include <TeGeometricTransformation.h>
-
-/**
-* @brief This is the class to deal projective geometric trasformation.
-* @author Emerson M.A. Xavier <emerson at dpi.inpe.br>
-* @author Emiliano F. Castejon <castejon at dpi.inpe.br>
-* @ingroup Utils
-*/
-class TL_DLL TeProjectiveGT : public TeGeometricTransformation {
-public :
-
- /**
- * Default Constructor.
- */
- TeProjectiveGT();
-
- /**
- * Default Destructor
- */
- ~TeProjectiveGT();
-
- /**
- * Returns the minimum number of required tie-points for the current
- * transformation.
- *
- * @return The minimum number of required tie-points for the current
- * transformation.
- */
- unsigned int getMinRequiredTiePoints() const;
-
-protected :
-
- /**
- * @brief Direct mapping ( from pt1 space into pt2 space ).
- *
- * @param params Transformation parameters.
- * @param pt1 pt1 coordinate.
- * @param pt2 pt2 coordinate.
- */
- void directMap( const TeGTParams& params, const TeCoord2D& pt1,
- TeCoord2D& pt2 ) const;
-
- /**
- * @brief Inverse mapping ( from pt2 space into pt1 space ).
- *
- * @param params Transformation parameters.
- * @param pt2 pt2 coordinate.
- * @param pt1 pt1 coordinate.
- */
- void inverseMap( const TeGTParams& params, const TeCoord2D& pt2,
- TeCoord2D& pt1 ) const;
-
- /**
- * @brief Calculate the transformation parameters following the
- * new supplied tie-points.
- *
- * @param params Transformation parameters.
- * @return true if OK, false on errors.
- */
- bool computeParameters( TeGTParams& params );
-
-
-private:
-
- /**
- * @brief When using more than four tiepoints, use adjustment.
- */
- bool useAdjustment( TeGTParams& params, bool isDirectMapping );
-
- /**
- * @brief When using exactly four tiepoints, use deterministic solution.
- */
- bool useDeterministic( TeGTParams& params, bool isDirectMapping );
-
- /**
- * @brief Set adaptative parameters
- *
- * @note This method is called whether the flag "useAdaptiveParameters" is on.
- */
- void setAdaptativeParameters( const std::vector< TeCoordPair >& tiepoints );
-
-
- double deltaX_; //!< Adaptive parameters: Delta X.
- double deltaY_; //!< Adaptive parameters: Delta Y.
- double deltaU_; //!< Adaptive parameters: Delta U.
- double deltaV_; //!< Adaptive parameters: Delta V.
-
-};
-
-#endif // TEPROJECTIVEGT_H
-
diff --git a/src/terralib/kernel/TeProjectiveGTFactory.cpp b/src/terralib/kernel/TeProjectiveGTFactory.cpp
deleted file mode 100644
index df223cb..0000000
--- a/src/terralib/kernel/TeProjectiveGTFactory.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-TerraLib - a library for developing GIS applications.
-Copyright 2001, 2002, 2003 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular
-purpose. The library provided hereunder is on an "as is" basis, and the
-authors have no obligation to provide maintenance, support, updates,
-enhancements, or modifications.
-In no event shall INPE be held liable to any party
-for direct, indirect, special, incidental, or consequential damages arising
-out of the use of this library and its documentation.
-*/
-
-#include "TeProjectiveGTFactory.h"
-#include <TeProjectiveGT.h>
-#include <TeException.h>
-
-TeProjectiveGTFactory::TeProjectiveGTFactory()
-: TeGTFactory( std::string( "projective" ) )
-{
-};
-
-TeProjectiveGTFactory::~TeProjectiveGTFactory()
-{
-};
-
-
-TeGeometricTransformation* TeProjectiveGTFactory::build (
- const TeGTParams& )
-{
- TeGeometricTransformation* instance_ptr = new TeProjectiveGT();
-
- if( ! instance_ptr ) {
- throw TeException( FACTORY_PRODUCT_INSTATIATION_ERROR );
- }
-
- return instance_ptr;
-}
diff --git a/src/terralib/kernel/TeProjectiveGTFactory.h b/src/terralib/kernel/TeProjectiveGTFactory.h
deleted file mode 100644
index e40deb1..0000000
--- a/src/terralib/kernel/TeProjectiveGTFactory.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-TerraLib - a library for developing GIS applications.
-Copyright 2001, 2002, 2003 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular
-purpose. The library provided hereunder is on an "as is" basis, and the
-authors have no obligation to provide maintenance, support, updates,
-enhancements, or modifications.
-In no event shall INPE be held liable to any party
-for direct, indirect, special, incidental, or consequential damages arising
-out of the use of this library and its documentation.
-*/
-
-#ifndef TEPROJECTIVEGTFACTORY_H
- #define TEPROJECTIVEGTFACTORY_H
-
- #include <TeGTFactory.h>
-
- /**
- * @brief This is the projective geometric trasformation factory.
- * @author Emerson M.A. Xavier <emerson at dpi.inpe.br>
- * @ingroup Utils
- */
- class TL_DLL TeProjectiveGTFactory : public TeGTFactory
- {
- public :
-
- /**
- * Default constructor
- */
- TeProjectiveGTFactory();
-
- /**
- * Default Destructor
- */
- ~TeProjectiveGTFactory();
-
- protected :
-
- /**
- * Implementation for the abstract TeFactory::build.
- *
- * @param arg A const reference to the used parameters.
- * @return A pointer to the new generated instance.
- */
- TeGeometricTransformation* build( const TeGTParams& arg );
-
- };
-
- namespace
- {
- static TeProjectiveGTFactory TeProjectiveGTFactory_instance;
- };
-
-#endif
-
diff --git a/src/terralib/kernel/TePrototype.h b/src/terralib/kernel/TePrototype.h
deleted file mode 100644
index f13b809..0000000
--- a/src/terralib/kernel/TePrototype.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TePrototype.h
- \brief This file contains a template for the "TePrototype" pattern.
-*/
-#ifndef TePrototype_H
-#define TePrototype_H
-//! Implements a template for the "Prototype" pattern.
-/*
- See the book "Design Patterns - Elements of Reusable Object-Oriented Software", by Gamma et. al.
- for further documentation.
-*/
-
-#include "TeDefines.h"
-
-template <class T>
-class TePrototype
-{
-public:
-
- //! Export pointer to the structure
- typedef TePrototype<T>* TePrototypePtr;
-
-// -- Normal Constructor
-
- //! Constructor
- TePrototype ();
-
- //! Destructor
- virtual ~TePrototype() {}
-
- //! Virtual Constructor
- static T* clone ();
-
- //! Builds a new type (should be implemented by descendants)
- virtual T* build () = 0;
-
-private:
- static TePrototypePtr instance_;
-};
-
-// Initialisation of static variable
-template <class T>
-typename TePrototype<T>::TePrototypePtr TePrototype<T>::instance_;
-
-// Constructor
-template <class T>
-TePrototype<T>::TePrototype()
-{
- // Put the object in the factory dictionary
- instance_ = this;
-}
-
-// Virtual Constructor
-template <class T>
-T*
-TePrototype<T>::clone ()
-{
- return instance_->build();
-}
-
-#endif
-
diff --git a/src/terralib/kernel/TeProxMatrixConstructionStrategy.cpp b/src/terralib/kernel/TeProxMatrixConstructionStrategy.cpp
deleted file mode 100644
index dfaa875..0000000
--- a/src/terralib/kernel/TeProxMatrixConstructionStrategy.cpp
+++ /dev/null
@@ -1,922 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-
-#include "TeProxMatrixConstructionStrategy.h"
-#include "TeProgress.h"
-#include "TeSTEvent.h"
-#include "TeSTInstance.h"
-
-//////////////////////////////////////////////////////////////////////
-// Auxiliary Functions for construction strategies
-//////////////////////////////////////////////////////////////////////
-
-bool
-TeFindObjectCentroid (TeMultiGeometry& mGeom, TeGeomRep rep, TeCoord2D& p)
-{
- if(rep == TePOLYGONS)
- {
- TePolygonSet pols;
- if(mGeom.getGeometry(pols))
- p = TeFindCentroid (pols);
- else
- return false;
- }
- else if (rep == TeLINES)
- {
- TeLineSet lines;
- if(mGeom.getGeometry (lines))
- p = TeFindCentroid (lines);
- else
- return false;
- }
- else if (rep == TePOINTS)
- {
- TePointSet points;
- if(mGeom.getGeometry (points))
- p = TeFindCentroid (points);
- else
- return false;
- }
- else if (rep == TeCELLS)
- {
- TeCellSet cells;
- if(mGeom.getGeometry (cells))
- p = TeFindCentroid (cells);
- else
- return false;
- }
- else if (rep == TeTEXT)
- {
- TeTextSet texts;
- if(mGeom.getGeometry (texts))
- p = TeFindCentroid (texts);
- else
- return false;
- }
- return true;
-}
-
-bool
-TeFindObjectsCentroid (TeSTElementSet* objects, const string& object_id, TeGeomRep rep, TeCoord2D& p)
-{
- if(rep==TePOLYGONS)
- {
- TePolygonSet polygons;
- if(objects->getGeometry (object_id, polygons))
- p = TeFindCentroid (polygons);
- }
- else if (rep==TeLINES)
- {
- TeLineSet lines;
- if(objects->getGeometry (object_id, lines))
- p = TeFindCentroid (lines);
- }
- else if (rep==TePOINTS)
- {
- TePointSet points;
- if(objects->getGeometry (object_id, points))
- p = TeFindCentroid (points);
- }
- else if (rep==TeCELLS)
- {
- TeCellSet cells;
- if(objects->getGeometry(object_id, cells))
- p = TeFindCentroid (cells);
- }
- return true;
-}
-
-
-bool TeSelectEntryPoints (TeNodeSet entry_set, map<string, string> entry_geom_map, TeGraphNetwork* net,
- double max_dist, TeSTElementSet* objects, TeGeomRep rep, TeProxMatrixImplementation* imp)
-{
-
- // Compute minimum path for all the new nodes/geometries near the network
- // and connect the ones close enough
- TeNodeSet::iterator it_node1 = entry_set.begin();
- while ( it_node1 != entry_set.end())
- {
- vector<double> minimum_path;
- if (net->minimumPath ((*it_node1), entry_set, minimum_path))
- {
- int j = 0;
- // Check maximum connection distance and connect selected objects
- TeNodeSet::iterator it_node2 = entry_set.begin();
- while ( it_node2 != entry_set.end())
- {
- // Get ids to simplify the code
- string node1_id = (*it_node1).objectId(); // Created Node id, nearest point to Geom1
- string node2_id = (*it_node2).objectId(); // Created Node id, nearest point to Geom1
- string object1_id = entry_geom_map[node1_id]; // Input Geom1 id
- string object2_id = entry_geom_map[node2_id]; // Input Geom2 id
-
- // Check identity and maximum allowed distance through the network
- if ((object1_id != object2_id) && (minimum_path[j] <= max_dist))
- {
- // Compute attributes and connect objects
- TeProxMatrixAttributes attr;
-
- TeCoord2D p1, p2;
- if (!TeFindObjectsCentroid (objects, object1_id, rep, p1))
- return false;
-
- if (!TeFindObjectsCentroid (objects, object2_id, rep, p2))
- return false;
-
- // Local istance between input geometries
- attr.CentroidDistance (TeDistance (p1, p2));
-
- // Total distance from input geometries centroids to network
- attr.NetworkObjectsDistance (TeDistance (p1, (*it_node1).location()) +
- TeDistance (p2, (*it_node2).location()));
-
- // Minimum path from the nodes relatives to the two geometries
- attr.NetworkMinimumPath (minimum_path[j]);
-
- imp->connectObjects (object1_id, object2_id, attr); // for networks, only one direction is connected
- }
- it_node2++;
- j++;
- }
- }
- it_node1++;
- }
- return true;
-}
-
-
-bool TeSelectEntryPoints2 (TeNodeSet entry_set1,
- TeNodeSet entry_set2,
- map<string, string> entry_geom_map,
- TeGraphNetwork* net,
- double max_dist,
- TeSTElementSet* objects1,
- TeGeomRep rep1,
- TeSTElementSet* objects2,
- TeGeomRep rep2,
- TeProxMatrixImplementation* imp)
-{
-
- // Compute minimum path for all the new nodes/geometries near the network
- // and connect the ones close enough
- TeNodeSet::iterator it_node1 = entry_set1.begin();
- while ( it_node1 != entry_set1.end())
- {
- vector<double> minimum_path;
- net->minimumPath ((*it_node1), entry_set2, minimum_path);
- if (minimum_path.size() > 0)
- {
- int j = 0;
- // Check maximum connection distance and connect selected objects
- TeNodeSet::iterator it_node2 = entry_set2.begin();
- while ( it_node2 != entry_set2.end())
- {
- // Get ids to simplify the code
- string node1_id = (*it_node1).objectId(); // Created Node id, nearest point to Geom1
- string node2_id = (*it_node2).objectId(); // Created Node id, nearest point to Geom1
- string object1_id = entry_geom_map[node1_id]; // Input Geom1 id
- string object2_id = entry_geom_map[node2_id]; // Input Geom2 id
-
-
- // Check identity and maximum allowed distance through the network
- if ((object1_id != object2_id) && (minimum_path[j] <= max_dist))
- {
-
- // Compute attributes and connect objects
- TeProxMatrixAttributes attr;
-
- TeCoord2D p1, p2;
- if (!TeFindObjectsCentroid (objects1, object1_id, rep1, p1))
- return false;
-
- if (!TeFindObjectsCentroid (objects2, object2_id, rep2, p2))
- return false;
-
- // Local distance
- attr.CentroidDistance (TeDistance (p1, p2));
-
- // Total distance from input geometries centroids to network
- attr.NetworkObjectsDistance (TeDistance (p1, (*it_node1).location()) +
- TeDistance (p2, (*it_node2).location()));
-
- // Minimum path from the nodes relatives to the two geometries
- attr.NetworkMinimumPath (minimum_path[j]);
-
- imp->connectObjects (object1_id, object2_id, attr); // for networks, only one direction is connected
- }
- it_node2++;
- j++;
- }
- }
- it_node1++;
- }
- return true;
-}
-
-
-//////////////////////////////////////////////////////////////////////
-// TeProxMatrixLocalAdjacencyStrategy
-//////////////////////////////////////////////////////////////////////
-
-TeProxMatrixLocalAdjacencyStrategy::TeProxMatrixLocalAdjacencyStrategy () :
- TeProxMatrixConstructionStrategy<TeSTElementSet> (0, TeGEOMETRYNONE, TeAdjacencyStrategy)
- { }
-
-
-TeProxMatrixLocalAdjacencyStrategy::TeProxMatrixLocalAdjacencyStrategy (TeSTElementSet* objects, TeGeomRep geomRep, bool calcDistance):
- TeProxMatrixConstructionStrategy<TeSTElementSet> (objects, geomRep, TeAdjacencyStrategy)
- {
- params_.calculate_distance_=calcDistance;
- }
-
-
-TeProxMatrixLocalAdjacencyStrategy::TeProxMatrixLocalAdjacencyStrategy (TeProxMatrixLocalAdjacencyStrategy& st):
- TeProxMatrixConstructionStrategy<TeSTElementSet> (st)
- { }
-
-bool
-TeProxMatrixLocalAdjacencyStrategy::Construct (TeProxMatrixImplementation* imp)
-{
- if (imp == 0)
- return false;
-
- // Iterate over all selected objects, selecting their neighbours
- TeSTElementSet::iterator itobj1 = objects_->begin();
-
- // ----- progress bar
- int step = 0;
- if(TeProgress::instance())
- TeProgress::instance()->setTotalSteps(objects_->numSTInstance());
- // -----
-
- TeProjection* proj = 0;
- if(objects_->theme())
- proj = objects_->theme()->layer()->projection();
- else if(objects_->getLayer())
- proj = objects_->getLayer()->projection();
- TePrecision::instance().setPrecision(TeGetPrecision(proj));
-
- while ( itobj1 != objects_->end())
- {
- // Gets the possible adjacent objects from RTree in the element set
- vector<TeSTInstance*> result;
- objects_->search((*itobj1).getGeometries().getBox(), result);
- string object_id1 = (*itobj1).getObjectId();
-
- TePolygonSet polSet1;
- TeCellSet cellSet1;
- itobj1->getGeometry(polSet1);
- itobj1->getGeometry(cellSet1);
-
- for(unsigned int i=0; i<result.size(); ++i)
- {
- string object_id2 = result[i]->getObjectId();
-
- if(object_id1==object_id2)
- continue;
-
- bool touch = false;
- if(params_.geom_rep1_==TePOLYGONS)
- {
- TePolygonSet polSet2;
- result[i]->getGeometry(polSet2);
- for(unsigned int index=0; index<polSet1.size(); ++index)
- {
- for(unsigned int index2=0; index2<polSet2.size(); ++index2)
- {
- bool curTouches = TeTouches(polSet1[index], polSet2[index2]);
- if(touch && !curTouches)
- {
- //verifies if the current polygons are disjunt
- if(!TeDisjoint(polSet1[index], polSet2[index2]))
- {
- touch = false;
- index = polSet1.size();
- break;
- }
- }
- touch = curTouches;
- }
- }
- }
- else if(params_.geom_rep1_==TeCELLS)
- {
- TeCellSet cellSet2;
- result[i]->getGeometry(cellSet2);
- for(unsigned int index=0; index<cellSet1.size(); ++index)
- {
- for(unsigned int index2=0; index2<cellSet2.size(); ++index2)
- {
- bool curTouches = TeTouches(cellSet1[index], cellSet2[index2]);
- if(touch && !curTouches)
- {
- //verifies if the current polygons are disjoint
- if(!TeDisjoint(cellSet1[index], cellSet2[index2]))
- {
- touch = false;
- index = cellSet1.size();
- break;
- }
- }
- touch = curTouches;
- }
- }
- }
-
- if(touch)
- {
- if (!imp->isConnected (object_id1,object_id2))
- {
- TeProxMatrixAttributes attr;
-
- if(params_.calculate_distance_)
- {
- TeCoord2D p1 = (*itobj1).getCentroid();
- TeCoord2D p2 = result[i]->getCentroid();
- attr.CentroidDistance (TeDistance (p1, p2));
- }
- imp->connectObjects (object_id2, object_id1, attr);
- imp->connectObjects (object_id1, object_id2, attr);
- }
- }
- }
-
- if(TeProgress::instance())
- {
- if (TeProgress::instance()->wasCancelled())
- {
- TeProgress::instance()->reset();
- return false;
- }
- else
- TeProgress::instance()->setProgress(step);
- }
- ++step;
- ++itobj1;
- }
-
- if (TeProgress::instance())
- TeProgress::instance()->reset();
- return true;
-}
-
-
-TeProxMatrixLocalAdjacencyStrategy&
-TeProxMatrixLocalAdjacencyStrategy::operator= (const TeProxMatrixLocalAdjacencyStrategy& rhs)
-{
- if ( this != &rhs )
- {
- objects_ = rhs.objects_;
- params_ = rhs.params_;
- }
- return *this;
-}
-
-bool
-TeProxMatrixLocalAdjacencyStrategy::operator== (const TeProxMatrixLocalAdjacencyStrategy& rhs) const
-{
- return (TeProxMatrixConstructionStrategy<TeSTElementSet>::IsEqual(rhs));
-}
-
-
-
-
-//////////////////////////////////////////////////////////////////////
-// TeProxMatrixNearestNeighbourStrategy
-//////////////////////////////////////////////////////////////////////
-TeProxMatrixNearestNeighbourStrategy::TeProxMatrixNearestNeighbourStrategy ():
- TeProxMatrixConstructionStrategy<TeSTEventSet> ()
- { }
-
-TeProxMatrixNearestNeighbourStrategy::TeProxMatrixNearestNeighbourStrategy (TeSTEventSet* objects, int num_neighbours):
- TeProxMatrixConstructionStrategy<TeSTEventSet> (objects, TePOINTS, TeNearestNeighboursStrategy)
- {
- params_.num_neighbours_=num_neighbours;
- }
-
-TeProxMatrixNearestNeighbourStrategy::TeProxMatrixNearestNeighbourStrategy (const TeProxMatrixNearestNeighbourStrategy& st):
- TeProxMatrixConstructionStrategy<TeSTEventSet>(st)
- {}
-
-bool
-TeProxMatrixNearestNeighbourStrategy::Construct (TeProxMatrixImplementation* imp)
-{
- if (imp == 0)
- return false;
-
- // ----- progress bar
- int step = 0;
- if(TeProgress::instance())
- TeProgress::instance()->setTotalSteps(objects_->numSTInstance());
- // -----
-
- TePrecision::instance().setPrecision(TeGetPrecision(objects_->getTheme()->layer()->projection()));
- TeSTEventSet::iterator it = objects_->begin();
- while(it!=objects_->end())
- {
- TePoint p = (*it).getGeometries();
- string object_id1=(*it).getObjectId();
-
- vector<TeSTEvent*> result;
- vector<double> dists;
-
- if(!objects_->nearestNeighbourSearch(p.location(), result, dists, (params_.num_neighbours_+1)))
- {
- ++it;
- continue;
- }
-
- for(unsigned int j=0; j<result.size(); ++j)
- {
- if(dists[j]==TeMAXFLOAT)
- continue;
-
- string object_id2 = result[j]->getObjectId();
-
- if ((object_id1 != object_id2) && (!imp->isConnected (object_id1,object_id2)))
- {
- TeProxMatrixAttributes attr;
- attr.CentroidDistance (dists[j]);
-
- imp->connectObjects (object_id1, object_id2, attr);
- }
- }
-
-
- //------ progress bar
- if(TeProgress::instance())
- {
- if (TeProgress::instance()->wasCancelled())
- {
- TeProgress::instance()->reset();
- return false;
- }
- else
- TeProgress::instance()->setProgress(step);
- }
- ++step;
-
- ++it;
- }
-
- if (TeProgress::instance())
- TeProgress::instance()->reset();
- return true;
-}
-
-bool
-TeProxMatrixNearestNeighbourStrategy::operator== (const TeProxMatrixNearestNeighbourStrategy& s) const
-{
- return (TeProxMatrixConstructionStrategy<TeSTEventSet>::IsEqual(s));
-}
-
-TeProxMatrixNearestNeighbourStrategy&
-TeProxMatrixNearestNeighbourStrategy::operator= (const TeProxMatrixNearestNeighbourStrategy& rhs)
-{
- if ( this != &rhs )
- {
- objects_ = rhs.objects_;
- params_ = rhs.params_;
- }
- return *this;
-}
-
-//////////////////////////////////////////////////////////////////////
-// TeProxMatrixClosedNetworkStrategy
-//////////////////////////////////////////////////////////////////////
-
-TeProxMatrixClosedNetworkStrategy::TeProxMatrixClosedNetworkStrategy (TeSTElementSet* objects,
- TeGeomRep rep, double max_local_distance,
- double max_net_distance, double max_connection_distance,
- TeGraphNetwork* input_net) :
- TeProxMatrixConstructionStrategy<TeSTElementSet>(objects, rep, TeClosedNetworkStrategy),
- net_ (input_net)
- {
- params_.max_distance_= max_local_distance;
- params_.max_net_distance_ = max_net_distance;
- params_.max_connection_distance_= max_connection_distance;
- }
-
-
-
-TeProxMatrixClosedNetworkStrategy::TeProxMatrixClosedNetworkStrategy (const TeProxMatrixClosedNetworkStrategy& rhs) :
- TeProxMatrixConstructionStrategy<TeSTElementSet>(rhs)
-{
- TeGraphNetwork* n = new TeGraphNetwork();
- *n = *rhs.net_;
- net_ = n;
-}
-
-
-bool
-TeProxMatrixClosedNetworkStrategy::Construct (TeProxMatrixImplementation* imp)
-{
- if (imp == 0) return false;
-
- // Connect local neighbours, based on the Local Distance Strategy
-
- TeProxMatrixLocalDistanceStrategy<TeSTElementSet> local(objects_, params_.geom_rep1_, params_.max_distance_);
- local.Construct (imp);
-
- // Connect neighbours through the network. The process is the following:
- // 1. The nearest node (entry points) in the network for all the input geometries
- // are computed;
- // 2. If the distance from the geometry centroid to the entry point is smaller than the maximum allowed,
- // create a new node in the network corresponding to this entry point.
- // 3. Compute the minimum path among all these new nodes (entry points).
- // 4. For each pair of entry points, if the minimum path distance is smaller than the
- // maximum allowed, the corresponding geometries will be connected.
-
- if (net_ == 0) return false;
-
- map<string, string> entry_geom_map; // maps input geometries to network entry points
- TeNodeSet entry_set; // entry points
-
- // ----- progress bar
- int step = 0;
- if(TeProgress::instance())
- TeProgress::instance()->setTotalSteps(objects_->numSTInstance());
- // -----
-
- // Iterate over all objects and select the ones that are close enough to the network
- TeSTElementSet::iterator itobj1 = objects_->begin();
- while ( itobj1 != objects_->end())
- {
- // Get object1 id and representation
- string object_id1 = (*itobj1).getObjectId();
- TeCoord2D p1, p2;
-
-
- int i = 0;
- double min_distance = 0.;
-
- net_->nearestNodePoint (p1, i, p2, min_distance);
-
- TeNode node;
- if ((min_distance <= params_.max_net_distance_) && net_->getNode(i, node))
- {
- entry_geom_map[node.objectId()] = object_id1; // Associates geometry with closest net nodes
- entry_set.add (node); // This set will be used as initial points in the shortest path algorithm
- }
-
- if(TeProgress::instance())
- {
- if (TeProgress::instance()->wasCancelled())
- {
- TeProgress::instance()->reset();
- return false;
- }
- else
- TeProgress::instance()->setProgress(step);
- }
- ++step;
- ++itobj1;
- }
-
- TeSelectEntryPoints (entry_set, entry_geom_map, net_, params_.max_connection_distance_, objects_, params_.geom_rep1_, imp);
- if (TeProgress::instance())
- TeProgress::instance()->reset();
-
- return true;
-}
-
-
-bool
-TeProxMatrixClosedNetworkStrategy::IsEqual (const TeProxMatrixConstructionStrategy<TeSTElementSet>& other) const
-{
- return (*this == (TeProxMatrixClosedNetworkStrategy&) other);
-}
-
-TeProxMatrixClosedNetworkStrategy&
-TeProxMatrixClosedNetworkStrategy::operator= (const TeProxMatrixClosedNetworkStrategy& rhs)
-{
- if (!(this==&rhs))
- {
- objects_ = rhs.objects_;
- params_ = rhs.params_;
-
- TeGraphNetwork* n = new TeGraphNetwork();
- *n = *rhs.net_;
- net_ = n;
- }
- return (*this);
-}
-
-
-bool
-TeProxMatrixClosedNetworkStrategy::operator== (const TeProxMatrixClosedNetworkStrategy& other) const
-{
- return (TeProxMatrixConstructionStrategy<TeSTElementSet>::IsEqual(other));
-}
-
-//////////////////////////////////////////////////////////////////////
-// TeProxMatrixOpenNetworkStrategy
-//////////////////////////////////////////////////////////////////////
-
-TeProxMatrixOpenNetworkStrategy::TeProxMatrixOpenNetworkStrategy (TeSTElementSet* objects, TeGeomRep rep,
- double max_local_distance,
- double max_net_distance, double max_connetion_distance,
- TeGraphNetwork* input_net) :
- TeProxMatrixConstructionStrategy<TeSTElementSet>(objects, rep, TeOpenNetworkStrategy),
- net_ (input_net)
- {
- params_.max_distance_= max_local_distance;
- params_.max_net_distance_ = max_net_distance;
- params_.max_connection_distance_= max_connetion_distance;
- }
-
-
-TeProxMatrixOpenNetworkStrategy::TeProxMatrixOpenNetworkStrategy (const TeProxMatrixOpenNetworkStrategy& rhs):
- TeProxMatrixConstructionStrategy<TeSTElementSet>(rhs)
-{
- TeGraphNetwork* n = new TeGraphNetwork();
- *n = *rhs.net_;
- net_ = n;
-}
-
-bool
-TeProxMatrixOpenNetworkStrategy::Construct (TeProxMatrixImplementation* imp)
-{
- if (imp == 0)
- return false;
-
- // Connect local neighbours, based on the Local Distance Strategy
- if (params_.max_distance_ > 0)
- {
- TeProxMatrixLocalDistanceStrategy<TeSTElementSet> local(objects_, params_.geom_rep1_, params_.max_distance_);
- local.Construct (imp);
- }
-
- // Connect neighbours through the network. The process is the following:
- // 1. The nearest point (entry points) in the network for all the input geometries
- // are computed;
- // 2. If the distance from the geometry centroid to the entry point is smaller than the maximum allowed,
- // create a new node in the network corresponding to this entry point.
- // 3. Compute the minimum path among all these new nodes (entry points).
- // 4. For each pair of entry points, if the minimum path distance is smaller than the
- // maximum allowed, the corresponding geometries will be connected.
- if (net_ == 0)
- return false;
-
- map<string, string> entry_geom_map; // maps input geometries to network entry points
- TeNodeSet entry_set; // entry points
-
- // Iterate over all objects and select the ones that are close enough to the network
- TeSTElementSet::iterator itobj1 = objects_->begin();
- int id = 0; // Nodes to be created will have sequential object_ids.
- // The existing network nodes have object_id equal to their position
- while ( itobj1 != objects_->end())
-
- {
- // Get object1 id and representation
- string object_id1 = (*itobj1).getObjectId();
- std::cout << object_id1 << "id " << id << endl;
-
- TeCoord2D p1;
- if (!TeFindObjectCentroid (itobj1->getGeometries(), params_.geom_rep1_, p1))
- return false;
-
-
- int line_index;
- TeCoord2D pinter;
- double min_dist;
-
- if (net_->nearestNetworkPoint (p1, line_index, pinter, min_dist))
- {
- if (min_dist < params_.max_net_distance_)
- {
- TeNode new_node;
- new_node.add (pinter);
- new_node.objectId (Te2String (id));
- id++;
-
- net_->breakLineSet (new_node, line_index);
- entry_geom_map[new_node.objectId()] = object_id1; // Associates geometry with closest net nodes
- entry_set.add (new_node); // This set will be used as initial points in the shortest path algorithm
- }
- }
- ++itobj1;
- }
-
- TeLineSet lineSet = net_->getLineSet();
- map<string, double> lineCosts = net_->getLineCosts();
- TeGraphNetwork net(lineSet, lineCosts);
- TeSelectEntryPoints (entry_set, entry_geom_map, &net, params_.max_connection_distance_, objects_, params_.geom_rep1_, imp);
- if (TeProgress::instance())
- TeProgress::instance()->reset();
- return true;
-}
-
-
-bool
-TeProxMatrixOpenNetworkStrategy::IsEqual (const TeProxMatrixConstructionStrategy<TeSTElementSet>& other) const
-{
- return ((*this)==(TeProxMatrixOpenNetworkStrategy&)other);
-}
-
-bool
-TeProxMatrixOpenNetworkStrategy::operator== (const TeProxMatrixOpenNetworkStrategy& other) const
-{
- return (TeProxMatrixConstructionStrategy<TeSTElementSet>::IsEqual(other));
-}
-
-
-TeProxMatrixOpenNetworkStrategy&
-TeProxMatrixOpenNetworkStrategy::operator= (const TeProxMatrixOpenNetworkStrategy& rhs)
-{
- if (!(this==&rhs))
- {
- params_ = rhs.params_;
- objects_ = rhs.objects_;
-
- TeGraphNetwork* n = new TeGraphNetwork();
- *n = *rhs.net_;
- net_ = n;
- }
- return (*this);
-}
-
-
-/////////////////////////////////////////////////////////////////////
-// TeProxMatrixOpenNetworkStrategy2
-//////////////////////////////////////////////////////////////////////
-
-TeProxMatrixOpenNetworkStrategy2::TeProxMatrixOpenNetworkStrategy2 (TeSTElementSet* objects1,
- TeGeomRep rep1,
- TeSTElementSet* objects2, TeGeomRep rep2,
- double max_local_distance,
- double max_net_distance, double max_connetion_distance,
- TeGraphNetwork* input_net) :
- TeProxMatrixConstructionStrategy<TeSTElementSet>(objects1, rep1, TeOpenNetworkStrategy2),
- objects2_ (objects2),
- net_ (input_net)
- {
- if(objects2_->theme())
- params_.theme_id2_=objects2_->theme()->id();
- params_.geom_rep2_=rep2;
- params_.max_distance_= max_local_distance;
- params_.max_net_distance_ = max_net_distance;
- params_.max_connection_distance_= max_connetion_distance;
- }
-
-TeProxMatrixOpenNetworkStrategy2::TeProxMatrixOpenNetworkStrategy2 (const TeProxMatrixOpenNetworkStrategy2& rhs)
- : TeProxMatrixConstructionStrategy<TeSTElementSet>(rhs)
-{
- objects2_ = rhs.objects2_;
- params_ = rhs.params_;
-
- TeGraphNetwork* n = new TeGraphNetwork();
- *n = *rhs.net_;
- net_ = n;
-}
-
-
-bool
-TeProxMatrixOpenNetworkStrategy2:: Construct (TeProxMatrixImplementation* imp)
- {
- if (imp == 0)
- return false;
-
-
- // Connect neighbours through the network. The process is the following:
- // 1. The nearest point (entry points) in the network for all the input geometries
- // are computed;
- // 2. If the distance from the geometry centroid to the entry point is smaller than the maximum allowed,
- // create a new node in the network corresponding to this entry point.
- // 3. Compute the minimum path among all these new nodes (entry points).
- // 4. For each pair of entry points, if the minimum path distance is smaller than the
- // maximum allowed, the corresponding geometries will be connected.
- if (net_ == 0)
- return false;
-
- map<string, string> entry_geom_map; // maps input geometries to network entry points
-
-
- int id = 0; // Nodes to be created will have sequential object_ids.
- // The existing network nodes have object_id equal to their position
- // Iterate over all objects and select the ones that are close enough to the network
-
- TeNodeSet entry_set1; // entry points
- TeSTElementSet::iterator itobj1 = objects_->begin();
- while ( itobj1 != objects_->end())
- {
- // Get object1 id and representation
- string object_id1 = (*itobj1).getObjectId();
- std::cout << "object1 " << object_id1 << "id" << id << endl;
-
- TeCoord2D p1;
- if (!TeFindObjectCentroid (itobj1->getGeometries(), params_.geom_rep1_, p1))
- return false;
-
-
- int line_index;
- TeCoord2D pinter;
- double min_dist;
-
- if (net_->nearestNetworkPoint (p1, line_index, pinter, min_dist))
- {
- if (min_dist < params_.max_net_distance_)
- {
- TeNode new_node;
- new_node.add (pinter);
- new_node.objectId (Te2String (id));
- id++;
-
- net_->breakLineSet (new_node, line_index);
- entry_geom_map[new_node.objectId()] = object_id1; // Associates geometry with closest net nodes
- entry_set1.add (new_node); // This set will be used as initial points in the shortest path algorithm
- }
- }
- ++itobj1;
- }
-
-
- // Iterate over all objects of interst (objects2)
- TeNodeSet entry_set2; // entry points
- TeSTElementSet::iterator itobj2 = objects2_->begin();
- while ( itobj2 != objects2_->end())
- {
- // Get object1 id and representation
- string object_id2 = (*itobj2).getObjectId();
- std::cout << "object2 " << object_id2 << "id" << id << endl;
-
- TeCoord2D p2;
- if (!TeFindObjectCentroid (itobj1->getGeometries(), params_.geom_rep2_, p2))
- return false;
-
- int line_index;
- TeCoord2D pinter;
- double min_dist;
-
- if (net_->nearestNetworkPoint (p2, line_index, pinter, min_dist))
- {
- TeNode new_node;
- new_node.add (pinter);
- new_node.objectId (Te2String (id));
- id++;
-
- net_->breakLineSet (new_node, line_index);
- entry_geom_map[new_node.objectId()] = object_id2; // Associates geometry with closest net nodes
- entry_set2.add (new_node); // This set will be used as initial points in the shortest path algorithm
- }
- ++itobj2;
- }
-
- TeLineSet lineSet = net_->getLineSet();
- map<string, double> lineCosts = net_->getLineCosts();
- TeGraphNetwork net(lineSet, lineCosts);
- TeSelectEntryPoints2 (entry_set1, entry_set2, entry_geom_map, &net, params_.max_connection_distance_,
- objects_, params_.geom_rep1_, objects2_, params_.geom_rep2_, imp);
- return true;
- }
-
-bool
-TeProxMatrixOpenNetworkStrategy2::IsEqual (const TeProxMatrixConstructionStrategy<TeSTElementSet>& other) const
-{
- return ((*this)==(TeProxMatrixOpenNetworkStrategy2&)other);
-}
-
-bool
-TeProxMatrixOpenNetworkStrategy2:: operator== (const TeProxMatrixOpenNetworkStrategy2& other) const
-{
- return (TeProxMatrixConstructionStrategy<TeSTElementSet>::IsEqual(other));
-}
-
-TeProxMatrixOpenNetworkStrategy2&
-TeProxMatrixOpenNetworkStrategy2:: operator= (const TeProxMatrixOpenNetworkStrategy2& rhs)
-{
- if (!(this==&rhs))
- {
- params_ = rhs.params_;
- objects_ = rhs.objects_;
- objects2_ = rhs.objects2_;
-
- TeGraphNetwork* n = new TeGraphNetwork();
- *n = *rhs.net_;
- net_ = n;
- }
- return (*this);
-}
-
-
diff --git a/src/terralib/kernel/TeProxMatrixConstructionStrategy.h b/src/terralib/kernel/TeProxMatrixConstructionStrategy.h
deleted file mode 100644
index d24cc47..0000000
--- a/src/terralib/kernel/TeProxMatrixConstructionStrategy.h
+++ /dev/null
@@ -1,491 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeProxMatrixConstructionStrategy.h
- \brief This file contains structures and definitions about construction strategies of proximity matrix
-*/
-
-#ifndef TeProxMatrixConstructionStrategy_H
-#define TeProxMatrixConstructionStrategy_H
-
-#include "TeProxMatrixImplementation.h"
-#include "TeSTElementSet.h"
-#include "TeNetwork.h"
-#include "TeDatabase.h"
-#include "TeMultiGeometry.h"
-
-
-class TeSTEventSet;
-
-TL_DLL bool TeFindObjectCentroid (TeMultiGeometry& mGeom, TeGeomRep rep, TeCoord2D& p);
-
-struct TL_DLL TeProxMatrixConstructionParams
-{
-public:
-
- //construction parameters
- int theme_id1_;
- TeGeomRep geom_rep1_;
- int theme_id2_;
- TeGeomRep geom_rep2_;
- TeGPMConstructionStrategy strategy_;
- double max_distance_;
- int num_neighbours_;
- double max_net_distance_;
- double max_connection_distance_;
- bool calculate_distance_;
-
- //! Empty contructor
- TeProxMatrixConstructionParams():
- theme_id1_(-1),
- geom_rep1_(TeGEOMETRYNONE),
- theme_id2_(-1),
- geom_rep2_(TeGEOMETRYNONE),
- strategy_(TeAdjacencyStrategy),
- max_distance_(0.),
- num_neighbours_(0),
- max_net_distance_(0.),
- max_connection_distance_(0.),
- calculate_distance_(false)
- { }
-
- //! Constructor
- TeProxMatrixConstructionParams(const int& theme1, const TeGeomRep& geomRep1, const TeGPMConstructionStrategy& strType):
- theme_id1_(theme1),
- geom_rep1_(geomRep1),
- theme_id2_(-1),
- geom_rep2_(TeGEOMETRYNONE),
- strategy_(strType),
- max_distance_(0.),
- num_neighbours_(0),
- max_net_distance_(0.),
- max_connection_distance_(0.),
- calculate_distance_(false)
- { }
-
- //! Operator ==
- bool operator==(const TeProxMatrixConstructionParams& other) const
- {
- return( (theme_id1_==other.theme_id1_) && (geom_rep1_==other.geom_rep1_) &&
- (theme_id2_==other.theme_id2_) && (geom_rep2_==other.geom_rep2_) &&
- (strategy_==other.strategy_) && (max_distance_==other.max_distance_) &&
- (num_neighbours_==other.num_neighbours_) && (max_net_distance_==other.max_net_distance_) &&
- (max_connection_distance_==other.max_connection_distance_) &&
- (calculate_distance_==other.calculate_distance_));
- }
-};
-
-//! A templated class to representate construction strategies of proximity matrix
-template<typename T>
-class TeProxMatrixConstructionStrategy
-{
-protected:
- //! Set of objetcs used to construct the matrix
- T* objects_;
-
- //! Construction paramas
- TeProxMatrixConstructionParams params_;
-
- //! Construct
- TeProxMatrixConstructionStrategy();
-
- //! Construct
- TeProxMatrixConstructionStrategy(T* objects, TeGeomRep geomRep, const TeGPMConstructionStrategy& type=TeAdjacencyStrategy);
-
- //! Copy construct
- TeProxMatrixConstructionStrategy(const TeProxMatrixConstructionStrategy& st);
-
-public:
- //! Construct the proximity matrix
- virtual bool Construct(TeProxMatrixImplementation*)=0;
-
- //! Destructor
- virtual ~TeProxMatrixConstructionStrategy()
- {}
-
- //! Set the set of objects and its geometry representation
- void setSTObjects (T* objects, TeGeomRep geomRep);
-
- //! Get the objects used to construct the matrix
- T* objects() { return objects_; }
-
- //! Returns the construction params
- TeProxMatrixConstructionParams& constructionParams() { return params_; }
-
- //! Verify if the type of the strategy, the object set and its geometry representation are equal
- virtual bool IsEqual (const TeProxMatrixConstructionStrategy<T>& other) const;
-};
-
-template<typename T>
-TeProxMatrixConstructionStrategy<T>::TeProxMatrixConstructionStrategy() :
- objects_(0),
- params_(-1, TeGEOMETRYNONE, TeAdjacencyStrategy)
- { }
-
-template<typename T>
-TeProxMatrixConstructionStrategy<T>::TeProxMatrixConstructionStrategy(T* objects, TeGeomRep geomRep, const TeGPMConstructionStrategy& type) :
- objects_(objects)
- {
- if(objects->theme())
- params_.theme_id1_ = objects->theme()->id();
- params_.geom_rep1_ = geomRep;
- params_.strategy_ = type;
- }
-
-template<typename T>
-TeProxMatrixConstructionStrategy<T>::TeProxMatrixConstructionStrategy (const TeProxMatrixConstructionStrategy& st)
-{
- objects_ = st.objects_;
- params_ = st.params_;
-}
-
-template<typename T> void
-TeProxMatrixConstructionStrategy<T>::setSTObjects (T* objects, TeGeomRep geomRep)
-{
- objects_ = objects;
- if(objects->theme())
- params_.theme_id1_ = objects->theme()->id();
- params_.geom_rep1_ = geomRep;
-}
-
-template<typename T> bool
-TeProxMatrixConstructionStrategy<T>::IsEqual (const TeProxMatrixConstructionStrategy<T>& other) const
-{
- return ((params_==other.params_) &&
- ((&objects_)==(&other.objects_)));
-}
-
-
-//! A class to implement the local adjacency strategy of proximity matrix
-class TL_DLL TeProxMatrixLocalAdjacencyStrategy : public TeProxMatrixConstructionStrategy<TeSTElementSet>
-{
-public:
-
- //! Constructor
- TeProxMatrixLocalAdjacencyStrategy ();
-
- //! Constructor
- TeProxMatrixLocalAdjacencyStrategy (TeSTElementSet* objects, TeGeomRep geomRep, bool calcDistance=false);
-
- //! Copy constructor
- TeProxMatrixLocalAdjacencyStrategy (TeProxMatrixLocalAdjacencyStrategy& st);
-
- //! Destructor
- virtual ~TeProxMatrixLocalAdjacencyStrategy() {}
-
- //! Construct the proximity matrix through local adjacency strategy
- virtual bool Construct (TeProxMatrixImplementation* imp);
-
- //! Equal operator
- bool operator== (const TeProxMatrixLocalAdjacencyStrategy& rhs) const;
-
- //! Assignment operator
- TeProxMatrixLocalAdjacencyStrategy& operator= (const TeProxMatrixLocalAdjacencyStrategy& rhs);
-
-};
-
-
-//! A class to implement the local distance strategy of proximity matrix
-template<typename Set>
-class TeProxMatrixLocalDistanceStrategy : public TeProxMatrixConstructionStrategy<Set>
-{
-public:
-
- //! Constructor
- TeProxMatrixLocalDistanceStrategy ();
-
- //! Constructor
- TeProxMatrixLocalDistanceStrategy (Set* objects, TeGeomRep geomRep, double max_distance);
-
- //! Copy constructor
- TeProxMatrixLocalDistanceStrategy (const TeProxMatrixLocalDistanceStrategy<Set>& st);
-
- //! Destructor
- virtual ~TeProxMatrixLocalDistanceStrategy(){}
-
- //! Construct the proximity matrix through local distance strategy
- virtual bool Construct (TeProxMatrixImplementation* imp);
-
- //! Equal operator
- bool operator== (const TeProxMatrixLocalDistanceStrategy<Set>& s) const;
-
- //! Assignment operator
- TeProxMatrixLocalDistanceStrategy<Set>& operator= (const TeProxMatrixLocalDistanceStrategy<Set>& rhs);
-
-};
-
-
-//! A class to implement the nearest neighbour strategy of proximity matrix
-class TL_DLL TeProxMatrixNearestNeighbourStrategy : public TeProxMatrixConstructionStrategy<TeSTEventSet>
-{
-public:
- //! Empty constructor
- TeProxMatrixNearestNeighbourStrategy ();
-
- //! Constructor
- // The STEventSet must be created with geometries, using kdTree and ordered by object_id
- TeProxMatrixNearestNeighbourStrategy (TeSTEventSet* objects, int num_neighbours);
-
- //! Copy constructor
- TeProxMatrixNearestNeighbourStrategy (const TeProxMatrixNearestNeighbourStrategy& st);
-
- //! Destructor
- virtual ~TeProxMatrixNearestNeighbourStrategy(){}
-
- //! Construct the proximity matrix through local distance strategy
- virtual bool Construct (TeProxMatrixImplementation* imp);
-
- //! Equal operator
- bool operator== (const TeProxMatrixNearestNeighbourStrategy& s) const;
-
- //! Assignment operator
- TeProxMatrixNearestNeighbourStrategy& operator= (const TeProxMatrixNearestNeighbourStrategy& rhs);
-
-};
-
-
-//! A class to implement the closed network strategy of proximity matrix
-class TL_DLL TeProxMatrixClosedNetworkStrategy : public TeProxMatrixConstructionStrategy<TeSTElementSet>
-{
-private:
- TeGraphNetwork* net_;
-
-public:
- //! Constructor
- TeProxMatrixClosedNetworkStrategy ( TeSTElementSet* objects, TeGeomRep rep, double max_local_distance,
- double max_net_distance, double max_connection_distance,
- TeGraphNetwork* input_net);
-
- //! Copy constructor
- TeProxMatrixClosedNetworkStrategy (const TeProxMatrixClosedNetworkStrategy& rhs);
-
- //! Destructor
- virtual ~TeProxMatrixClosedNetworkStrategy()
- {
- if(net_)
- delete (net_);
- }
-
- //! Construct the proximity matrix through closed network strategy
- virtual bool Construct (TeProxMatrixImplementation* imp);
-
- //! Verify if is equal
- virtual bool IsEqual (const TeProxMatrixConstructionStrategy<TeSTElementSet>& other) const;
-
- //! Assignment operator
- TeProxMatrixClosedNetworkStrategy& operator= (const TeProxMatrixClosedNetworkStrategy& rhs);
-
- //! Equal operator
- bool operator== (const TeProxMatrixClosedNetworkStrategy& other) const;
-
- //! Get the objects used to construct the matrix
- TeSTElementSet* objects() { return objects_; }
-};
-
-//! A class to implement the open network strategy of proximity matrix (among a set of objetcs)
-class TL_DLL TeProxMatrixOpenNetworkStrategy : public TeProxMatrixConstructionStrategy<TeSTElementSet>
-{
-private:
- TeGraphNetwork* net_;
-
-public:
-
- //! Constructor
- TeProxMatrixOpenNetworkStrategy ( TeSTElementSet* objects, TeGeomRep rep, double max_local_distance,
- double max_net_distance, double max_connetion_distance,
- TeGraphNetwork* input_net);
- //! Copy constructor
- TeProxMatrixOpenNetworkStrategy (const TeProxMatrixOpenNetworkStrategy& rhs);
-
- //! Destructor
- virtual ~TeProxMatrixOpenNetworkStrategy()
- {
- if(net_)
- delete (net_);
- }
-
- //! Construct the proximity matrix through open network strategy
- virtual bool Construct (TeProxMatrixImplementation* imp);
-
- //! Verify if is equal
- virtual bool IsEqual (const TeProxMatrixConstructionStrategy<TeSTElementSet>& other) const;
-
- //! Equal operator
- bool operator== (const TeProxMatrixOpenNetworkStrategy& other) const;
-
- //! Assignment operator
- TeProxMatrixOpenNetworkStrategy& operator= (const TeProxMatrixOpenNetworkStrategy& rhs);
-};
-
-
-//! A class to implement the open network strategy of proximity matrix (relationships among objetc of two differnt sets)
-class TL_DLL TeProxMatrixOpenNetworkStrategy2 : public TeProxMatrixConstructionStrategy<TeSTElementSet>
-{
-private:
- TeSTElementSet* objects2_;
- TeGraphNetwork* net_;
-public:
-
- //! Constructor
- TeProxMatrixOpenNetworkStrategy2 ( TeSTElementSet* objects1, TeGeomRep rep1,
- TeSTElementSet* objects2, TeGeomRep rep2,
- double max_local_distance,
- double max_net_distance, double max_connetion_distance,
- TeGraphNetwork* input_net);
- //! Copy constructor
- TeProxMatrixOpenNetworkStrategy2 (const TeProxMatrixOpenNetworkStrategy2& rhs);
-
- //! Destructor
- virtual ~TeProxMatrixOpenNetworkStrategy2 ()
- {
- if(net_)
- delete (net_);
- }
-
- //! Construct the proximity matrix through open network strategy
- virtual bool Construct (TeProxMatrixImplementation* imp);
-
- //! Verify if is equal
- virtual bool IsEqual (const TeProxMatrixConstructionStrategy<TeSTElementSet>& other) const;
-
- //! Equal operator
- bool operator== (const TeProxMatrixOpenNetworkStrategy2& other) const;
-
- //! Assignment operator
- TeProxMatrixOpenNetworkStrategy2& operator= (const TeProxMatrixOpenNetworkStrategy2& rhs);
-
-};
-
-//////////////////////////////////////////////////////////////////////
-// TeProxMatrixLocalDistanceStrategy
-//////////////////////////////////////////////////////////////////////
-template<typename Set>
-TeProxMatrixLocalDistanceStrategy<Set>::TeProxMatrixLocalDistanceStrategy ():
- TeProxMatrixConstructionStrategy<Set> (0, TeGEOMETRYNONE, TeDistanceStrategy)
- {}
-
-
-template<typename Set>
-TeProxMatrixLocalDistanceStrategy<Set>::TeProxMatrixLocalDistanceStrategy (Set* objects, TeGeomRep geomRep, double max_distance):
- TeProxMatrixConstructionStrategy<Set>(objects, geomRep, TeDistanceStrategy)
- {
- TeProxMatrixConstructionStrategy<Set>::params_.max_distance_ = max_distance;
- }
-
-
-template<typename Set>
-TeProxMatrixLocalDistanceStrategy<Set>::TeProxMatrixLocalDistanceStrategy (const TeProxMatrixLocalDistanceStrategy<Set>& st):
- TeProxMatrixConstructionStrategy<Set>(st)
- {}
-
-template<typename Set> bool
-TeProxMatrixLocalDistanceStrategy<Set>::Construct(TeProxMatrixImplementation* imp)
-{
- if (imp == 0)
- return false;
-
- // Iterate over all selected objects, selecting their neighbours
- TeSTElementSet::iterator itobj1 = TeProxMatrixConstructionStrategy<Set>::objects_->begin();
-
- // ----- progress bar
- int step = 0;
- if(TeProgress::instance())
- TeProgress::instance()->setTotalSteps(TeProxMatrixConstructionStrategy<Set>::objects_->numSTInstance());
- // -----
-
- TeProjection* proj = 0;
- if(TeProxMatrixConstructionStrategy<Set>::objects_->theme())
- proj = TeProxMatrixConstructionStrategy<Set>::objects_->theme()->layer()->projection();
- else if(TeProxMatrixConstructionStrategy<Set>::objects_->getLayer())
- proj = TeProxMatrixConstructionStrategy<Set>::objects_->getLayer()->projection();
-
- TePrecision::instance().setPrecision(TeGetPrecision(proj));
- double max_d = TeProxMatrixConstructionStrategy<Set>::params_.max_distance_;
-
- while ( itobj1 != TeProxMatrixConstructionStrategy<Set>::objects_->end())
- {
- // Gets the possible objects from RTree in the element set
- vector<TeSTInstance*> result;
- TeBox b = (*itobj1).getGeometries().getBox();
- TeBox bAux(b.x1()-max_d, b.y1()-max_d, b.x2()+max_d, b.y2()+max_d);
-
- TeProxMatrixConstructionStrategy<Set>::objects_->search(bAux, result);
-
- string object_id1 = (*itobj1).getObjectId();
- TeCoord2D coord1 = itobj1->getCentroid();
- for(unsigned int index =0; index<result.size(); ++index)
- {
- string object_id2 = result[index]->getObjectId();
- if(object_id1==object_id2)
- continue;
-
- TeCoord2D coord2 = result[index]->getCentroid();
- double dist = TeDistance(coord1, coord2);
- if(dist <= max_d)
- {
- if(!imp->isConnected (object_id1,object_id2))
- {
- TeProxMatrixAttributes attr;
- attr.CentroidDistance (dist);
- imp->connectObjects (object_id1, object_id2, attr);
- imp->connectObjects (object_id2, object_id1, attr);
- }
- }
- }
-
- if(TeProgress::instance())
- {
- if (TeProgress::instance()->wasCancelled())
- {
- TeProgress::instance()->reset();
- return false;
- }
- else
- TeProgress::instance()->setProgress(step);
- }
- ++step;
- ++itobj1;
- }
-
- if (TeProgress::instance())
- TeProgress::instance()->reset();
- return true;
-}
-
-template<typename Set> bool
-TeProxMatrixLocalDistanceStrategy<Set>::operator== (const TeProxMatrixLocalDistanceStrategy<Set>& s) const
-{
- return ( TeProxMatrixConstructionStrategy<Set>::IsEqual(s));
-}
-
-template<typename Set> TeProxMatrixLocalDistanceStrategy<Set>&
-TeProxMatrixLocalDistanceStrategy<Set>::operator= (const TeProxMatrixLocalDistanceStrategy<Set>& rhs)
-{
- if ( this != &rhs )
- {
- TeProxMatrixConstructionStrategy<Set>::objects_ = rhs.objects_;
- TeProxMatrixConstructionStrategy<Set>::params_ = rhs.params_;
- }
- return *this;
-}
-
-#endif
diff --git a/src/terralib/kernel/TeProxMatrixImplementation.cpp b/src/terralib/kernel/TeProxMatrixImplementation.cpp
deleted file mode 100644
index 4966950..0000000
--- a/src/terralib/kernel/TeProxMatrixImplementation.cpp
+++ /dev/null
@@ -1,498 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001, 2002, 2003 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeProxMatrixImplementation.h"
-
-#include <stdio.h>
-
-TeProxMatrixGraphBreymann:: TeProxMatrixGraphBreymann () :
- TeProxMatrixImplementation(TeGraphBreymann), graph_(true)
-{ }
-
-TeProxMatrixGraphBreymann:: TeProxMatrixGraphBreymann (TeProxMatrixGraphBreymann& other) :
- TeProxMatrixImplementation(TeGraphBreymann), graph_(true)
-{
-// graph_ = other.graph_;
- map_ = other.map_;
-}
-
-
-TeProxMatrixGraphBreymann&
-TeProxMatrixGraphBreymann:: operator= (TeProxMatrixGraphBreymann& other)
-{
- type_ = other.type_;
-// graph_ = other.graph_;
- map_ = other.map_;
- return (*this);
-}
-
-
-void
-TeProxMatrixGraphBreymann::connectObjects (const string& object_id1, const string& object_id2, const TeProxMatrixAttributes& attr)
-{
- int pos1 = graph_.insert (object_id1);
- int pos2 = graph_.insert (object_id2);
-
- graph_.connectVertices (pos1, pos2, attr);
-
- map_[object_id1] = pos1;
- map_[object_id2] = pos2;
-}
-
-
-bool
-TeProxMatrixGraphBreymann::setConnectionAttributes (const string& object_id1, const string& object_id2, const TeProxMatrixAttributes& attr)
-{
- return(graph_.setEdgeValue (object_id1, object_id2, attr));
-}
-
-bool
-TeProxMatrixGraphBreymann::getConnectionAttributes (const string& object_id1, const string&object_id2, TeProxMatrixAttributes& attr)
-{
- map_iterator pos1, pos2;
-
- if ((pos1 = map_.find(object_id1)) == map_.end())
- return false; // object_id1 not in the graph
-
- if ((pos2 = map_.find(object_id2)) == map_.end())
- return false; // object_id2 not in the graph
-
- // Object_id1 neighbours iterator
- br_stl::Graph<string, TeProxMatrixAttributes>::Successor::iterator
- start = graph_[(*pos1).second].second.begin(),
- end = graph_[(*pos1).second].second.end();
-
- while (start != end)
- {
- if ((*start).first == (*pos2).second) {
- attr = (*start).second;
- return true;
- }
- ++start;
- }
- return false;
-}
-
-bool
-TeProxMatrixGraphBreymann::getNeighboursNeighbours (const string& object_id, TeNeighbours& neigh, int max_order )
-{
- bool ret_value = getNeighboursNeighbours (object_id, neigh, max_order, 1);
- neigh.Remove (object_id);
- return ret_value;
-}
-
-bool
-TeProxMatrixGraphBreymann::getNeighboursNeighbours (const string& object_id, TeNeighbours& neigh, int max_order, int current_order)
-{
-
- map_iterator pos;
-
- if ((pos = map_.find(object_id)) == map_.end())
- return false; // object_id not in the graph
-
- // Object_id1 neighbours iterator
- br_stl::Graph<string, TeProxMatrixAttributes>::Successor::iterator
- start = graph_[(*pos).second].second.begin(),
- end = graph_[(*pos).second].second.end();
-
- // Insert all neighbours
- while (start != end)
- {
- TeProxMatrixAttributes attr = (*start).second;
- attr.Order (current_order); //Update attr attribute for that specific object
- if (neigh.Insert (graph_[(*start).first].first, attr))
- {
- // Get neighbours of neighbours that were not inserted before
- for (int recursive_loop = max_order - 1; recursive_loop > 0; --recursive_loop)
- getNeighboursNeighbours (graph_[(*start).first].first, neigh, recursive_loop, ++current_order);
-
- }
- ++start;
- }
- return true;
-
-}
-
-
-bool
-TeProxMatrixGraphBreymann::getNeighbours (const string& object_id, TeNeighbours& neigh)
-{
- map_iterator pos;
-
- if ((pos = map_.find(object_id)) == map_.end())
- return false; // object_id not in the graph
-
- br_stl::Graph<string, TeProxMatrixAttributes>::Successor::iterator
- start = graph_[(*pos).second].second.begin(),
- end = graph_[(*pos).second].second.end();
-
- while (start != end)
- {
- neigh.Insert (graph_[(*start).first].first, (*start).second);
- ++start;
- }
-
- return true;
-
-}
-
-bool
-TeProxMatrixGraphBreymann::getNeighbours (int i, string& object_id, TeNeighbours& neigh)
-{
-
- if (i > (int) graph_.size())
- return false;
-
- // find object_id
- map_iterator pos = map_.begin();
- while (pos != map_.end())
- {
- if ((*pos).second == i)
- {
- object_id = (*pos).first;
- pos = map_.end();
- }
- else pos++;
- }
-
- br_stl::Graph<string, TeProxMatrixAttributes>::Successor::iterator
- start = graph_[i].second.begin(),
- end = graph_[i].second.end();
-
-
- while (start != end)
- {
- neigh.Insert (graph_[(*start).first].first, (*start).second);
- start++;
- }
-
- return true;
-
-}
-
-
-
-TeProxMatrixImplementation*
-TeProxMatrixGraphBreymann::createCopy ()
-{
- TeProxMatrixGraphBreymann* imp = new TeProxMatrixGraphBreymann (*this);
- return imp;
-
-}
-
-
-bool
-TeProxMatrixGraphBreymann::saveTextFile (const string& name, map<string, string>* ids)
-{
- string complete_name = name + ".txt";
-
- FILE* fp = fopen(complete_name.c_str(),"w");
- if (fp)
- {
- fprintf (fp, "%lu\n", ids->size()); //number of objects
-
- map<string, string>::iterator it;
- for (unsigned int i = 0; i < graph_.size(); i++)
- {
-
- string objId1, objId2;
- objId1 = graph_[i].first;
- if(ids)
- {
- it=ids->find(graph_[i].first);
- if(it!=ids->end())
- objId1 = it->second;
- }
-
- fprintf (fp, " %s ", objId1.c_str());
-
- br_stl::Graph<string, TeProxMatrixAttributes>::Successor::iterator
- start = graph_[i].second.begin(),
- end = graph_[i].second.end();
- //double sum = 0.0;
- while (start != end)
- {
- objId2 = graph_[(*start).first].first;
- if(ids)
- {
- it=ids->find(objId2);
- if(it!=ids->end())
- objId2 = it->second;
- }
-
- fprintf (fp, " %s ", objId2.c_str());
- //sum += (*start).second.Weight();
- start++;
- }
-
- //fprintf (fp, "Weights sum: %3.7f\n", sum);
- fprintf (fp, "\n");
- }
- fclose (fp);
- return true;
- }
- else
- return false;
-}
-
-
-bool
-TeProxMatrixGraphBreymann::saveGALFile (const string& name, map<string, string>* ids)
-{
-
- string complete_name = name + ".GAL";
- FILE* fp = fopen(complete_name.c_str(),"w");
- if (fp)
- {
- fprintf (fp, "%lu\n", ids->size() ); // first line: number of elements in matrix
- map<string, string>::iterator it;
- for (unsigned int i = 0; i < graph_.size(); i++)
- {
- string objId1, objId2;
- objId1 = graph_[i].first;
- if(ids)
- {
- it = ids->find(objId1);
- if(it!=ids->end())
- objId1 = it->second;
- }
-
- fprintf (fp, "%s %lu\n", objId1.c_str(), graph_[i].second.size());
- br_stl::Graph<string, TeProxMatrixAttributes>::Successor::iterator
- start = graph_[i].second.begin(),
- end = graph_[i].second.end();
- while (start != end)
- {
- //fprintf (fp, "%s %3.7f\n", graph_[(*start).first].first.c_str(), (*start).second.Weight() );
- objId2 = graph_[(*start).first].first;
- if(ids)
- {
- it=ids->find(objId2);
- if(it!=ids->end())
- objId2 = it->second;
- }
-
- fprintf (fp, "%s ", objId2.c_str());
- start++;
- }
- fprintf (fp, "\n");
- }
- fclose (fp);
- return true;
- }
- else return false;
-
-}
-
-
-bool
-TeProxMatrixGraphBreymann::saveGWTFile (const string& name, map<string, string>* ids)
-{
-
- string complete_name = name + ".GWT";
- FILE* fp = fopen(complete_name.c_str(),"w");
- if (fp)
- {
- fprintf (fp, "%lu\n", ids->size() ); // first line: number of elements in matrix
- map<string, string>::iterator it;
- for (unsigned int i = 0; i < graph_.size(); i++)
- {
- br_stl::Graph<string, TeProxMatrixAttributes>::Successor::iterator
- start = graph_[i].second.begin(),
- end = graph_[i].second.end();
- while (start != end)
- {
- string objId1, objId2;
- objId1 = graph_[i].first;
- objId2 = graph_[(*start).first].first;
- if(ids)
- {
- it=ids->find(graph_[i].first);
- if(it!=ids->end())
- objId1 = it->second;
- it=ids->find(graph_[(*start).first].first);
- if(it!=ids->end())
- objId2 = it->second;
- }
- fprintf (fp, "%s %s %3.7f\n", objId1.c_str(), objId2.c_str(), (*start).second.CentroidDistance());
- start++;
- }
- }
- fclose (fp);
- return true;
- }
- else
- return false;
-
-}
-
-// -------- save from vector
-
-bool
-TeProxMatrixGraphBreymann::saveTextFile (const string& name, vector<string>* ids)
-{
- string complete_name = name + ".txt";
-
- FILE* fp = fopen(complete_name.c_str(),"w");
- if (fp)
- {
- fprintf (fp, "%lu\n", ids->size()); //number of objects
-
- vector<string>::iterator it = ids->begin();
- int Id=1;
- while(it!=ids->end())
- {
- string objId1, objId2;
- objId1 = Te2String(Id);
-
- fprintf (fp, " %s ", objId1.c_str());
-
- TeNeighbours neigs;
- this->getNeighbours((*it), neigs);
-
- for(int j=0; j<neigs.size(); ++j)
- {
- string objId2aux = neigs[j];
- objId2 ="";
- for(unsigned int n=0; n<ids->size(); ++n)
- {
- if(objId2aux==ids->operator [](n))
- {
- objId2 = Te2String(n+1);
- break;
- }
- }
- fprintf (fp, " %s ", objId2.c_str());
- }
-
- fprintf (fp, "\n");
-
- ++it;
- ++Id;
- }
-
- fclose (fp);
- return true;
- }
- else
- return false;
-}
-
-
-bool
-TeProxMatrixGraphBreymann::saveGALFile (const string& name, vector<string>* ids)
-{
-
- string complete_name = name + ".GAL";
- FILE* fp = fopen(complete_name.c_str(),"w");
- if (fp)
- {
- fprintf (fp, "%lu\n", ids->size() ); // first line: number of elements in matrix
-
- vector<string>::iterator it = ids->begin();
- int Id=1;
- while(it!=ids->end())
- {
- string objId1, objId2;
- objId1 = Te2String(Id);
-
- TeNeighbours neigs;
- this->getNeighbours((*it), neigs);
-
- fprintf (fp, "%s %d\n", objId1.c_str(), neigs.size());
-
- for(int j=0; j<neigs.size(); ++j)
- {
- string objId2aux = neigs[j];
- objId2 ="";
- for(unsigned int n=0; n<ids->size(); ++n)
- {
- if(objId2aux==ids->operator[](n))
- {
- objId2 = Te2String(n+1);
- break;
- }
- }
- fprintf (fp, "%s ", objId2.c_str());
- }
-
- fprintf (fp, "\n");
-
- ++it;
- ++Id;
- }
-
- fclose (fp);
- return true;
- }
- else
- return false;
-
-}
-
-
-bool
-TeProxMatrixGraphBreymann::saveGWTFile (const string& name, vector<string>* ids)
-{
-
- string complete_name = name + ".GWT";
- FILE* fp = fopen(complete_name.c_str(),"w");
- if (fp)
- {
- fprintf (fp, "%lu\n", ids->size() ); // first line: number of elements in matrix
- vector<string>::iterator it = ids->begin();
- int Id=1;
- while(it!=ids->end())
- {
- string objId1, objId2;
- objId1 = Te2String(Id);
-
- TeNeighbours neigs;
- this->getNeighbours((*it), neigs);
-
- for(int j=0; j<neigs.size(); ++j)
- {
- string objId2aux = neigs[j];
- double dist = (neigs.Attributes(j)).CentroidDistance();
- objId2 ="";
- for(unsigned int n=0; n<ids->size(); ++n)
- {
- if(objId2aux==ids->operator[](n))
- {
- objId2 = Te2String(n+1);
- break;
- }
- }
- fprintf (fp, "%s %s %3.7f\n", objId1.c_str(), objId2.c_str(), dist);
- }
- ++it;
- ++Id;
- }
-
- fclose (fp);
- return true;
- }
- else
- return false;
-
-}
diff --git a/src/terralib/kernel/TeProxMatrixImplementation.h b/src/terralib/kernel/TeProxMatrixImplementation.h
deleted file mode 100644
index a93c4fa..0000000
--- a/src/terralib/kernel/TeProxMatrixImplementation.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeProxMatrixImplementation.h
- \brief This file contains structures and definitions about different representations of proximity matrix
-*/
-
-#ifndef TeProxMatrixImplementation_H
-#define TeProxMatrixImplementation_H
-
-#include "TeNeighbours.h"
-#include "graph.h"
-
-//! An abstract class to represent proximity matrix
-class TL_DLL TeProxMatrixImplementation
-{
-protected:
- //! Type of the representation
- TeGPMImplementation type_;
-
- //! Empty constructor
- TeProxMatrixImplementation(const TeGPMImplementation& type): type_(type)
- {}
-
-public:
- //! Verify if two objects are neighbour or connected
- bool isConnected (const string& object_id1, const string& object_id2)
- {
- TeProxMatrixAttributes attr;
- return getConnectionAttributes (object_id1, object_id2, attr);
- }
-
- //! Connect two objects
- virtual void connectObjects (const string& , const string& , const TeProxMatrixAttributes& ) = 0;
-
- //! Disconnect two objects
- virtual bool disconnectObjects (const string& , const string& ) { return false; }
-
- //! Remove an object
- virtual bool removeObject (const string& ) { return false; }
-
- //! Get connection attributes
- virtual bool getConnectionAttributes (const string&, const string&, TeProxMatrixAttributes& )= 0;
-
- //! Set connection attributes
- virtual bool setConnectionAttributes (const string&, const string&, const TeProxMatrixAttributes&) =0;
-
- //! Get the neighbours of an object
- virtual bool getNeighbours (const string& , TeNeighbours& )=0;
-
- //! Get the obj-th neighbour of an object
- virtual bool getNeighbours (int, string& , TeNeighbours& )=0;
-
- //! Get the neighbours of an object
- virtual bool getNeighboursNeighbours (const string&, TeNeighbours&, int /* max_order */ = 2)=0;
-
- //! Return the number of objects
- virtual int numberOfObjects()=0;
-
- //! Return the type of the representation
- TeGPMImplementation type() {return type_;}
-
- //! Create a copy
- virtual TeProxMatrixImplementation* createCopy ()=0;
-
- //! Verify if is equal
- virtual bool isEqual (TeProxMatrixImplementation& other)
- {
- if (type_ == other.type_)
- return true;
- return false;
- }
-
- //! Equal operator
- virtual bool operator== (const TeProxMatrixImplementation& ) const { return false; }
-
- //! Save the proximity matrix in a text file
- virtual bool saveTextFile (const string&, map<string, string>*)=0;
-
- //! Save the proximity matrix in a GAL format text file
- virtual bool saveGALFile (const string&, map<string, string>*)=0;
-
- //! Save the proximity matrix in a GWT format text file
- virtual bool saveGWTFile (const string&, map<string, string>*)=0;
-
- //! Save the proximity matrix in a text file
- virtual bool saveTextFile (const string&, vector<string>*)=0;
-
- //! Save the proximity matrix in a GAL format text file
- virtual bool saveGALFile (const string&, vector<string>*)=0;
-
- //! Save the proximity matrix in a GWT format text file
- virtual bool saveGWTFile (const string&, vector<string>*)=0;
-
- //! Destructor
- virtual ~TeProxMatrixImplementation(){}
-};
-
-
-//! A class to represent proximity matrix utilising the Breymann graph
-class TL_DLL TeProxMatrixGraphBreymann : public TeProxMatrixImplementation
-{
-private:
- br_stl::Graph<string, TeProxMatrixAttributes> graph_;
-
- typedef map<string, int> Object_id_map_type;
- Object_id_map_type map_;
-
- typedef Object_id_map_type::iterator map_iterator;
- typedef Object_id_map_type::const_iterator map_const_iterator;
-
- bool getNeighboursNeighbours (const string& object_id, TeNeighbours& neigh, int max_order = 2, int current_order = 1);
-
-public:
- //! Empty constructor - graph must be directed then the graph constructor receive true
- TeProxMatrixGraphBreymann ();
-
- //! Copy constructor
- TeProxMatrixGraphBreymann(TeProxMatrixGraphBreymann& imp);
-
- //! Connect two objects
- virtual void connectObjects (const string& object_id1, const string& object_id2, const TeProxMatrixAttributes& attr);
-
- //! Get connection attributes
- virtual bool getConnectionAttributes (const string& object_id1, const string& object_id2, TeProxMatrixAttributes& attr);
-
- //! Set connection attributes
- virtual bool setConnectionAttributes (const string& object_id1, const string& object_id2, const TeProxMatrixAttributes& attr);
-
- //! Get the neighbours of an object
- virtual bool getNeighbours (const string& object_id, TeNeighbours& neigh);
-
- //! Get the obj-th neighbour of an object
- virtual bool getNeighbours (int obj, string& object_id, TeNeighbours& neigh);
-
- //! Get the neighbours of an object
- virtual bool getNeighboursNeighbours (const string& object_id, TeNeighbours& neigh, int max_order = 2);
-
- //! Return the number of the objects
- virtual int numberOfObjects () {return graph_.size();}
-
- //! Create a copy
- virtual TeProxMatrixImplementation* createCopy ();
-
- //! Verify if is equal
- virtual bool isEqual (TeProxMatrixImplementation& other)
- {
- if (type_ == other.type())
- return (*this == (TeProxMatrixGraphBreymann&)other);
- return false;
- }
-
- //! Assignment operator
- TeProxMatrixGraphBreymann& operator= (TeProxMatrixGraphBreymann& imp);
-
- //! Destructor
- virtual ~TeProxMatrixGraphBreymann() {}
-
- //! Save the proximity matrix in a text file
- virtual bool saveTextFile (const string& name, map<string, string>* ids=0);
-
- //! Save the proximity matrix in a GAL text file
- virtual bool saveGALFile (const string& name, map<string, string>* ids=0);
-
- //! Save the proximity matrix in a GWT text file
- virtual bool saveGWTFile (const string& name, map<string, string>* ids=0);
-
- //! Save the proximity matrix in a text file
- virtual bool saveTextFile (const string& name, vector<string>* ids);
-
- //! Save the proximity matrix in a GAL format text file
- virtual bool saveGALFile (const string& name, vector<string>* ids);
-
- //! Save the proximity matrix in a GWT format text file
- virtual bool saveGWTFile (const string& name, vector<string>* ids);
-};
-
-
-//! An abstract factory of proximity matrix representations
-class TL_DLL TeProxMatrixAbstractFactory
-{
-public:
- static TeProxMatrixImplementation* MakeConcreteImplementation (const TeGPMImplementation& impl_type = TeGraphBreymann)
- {
- if (impl_type == TeGraphBreymann)
- return new TeProxMatrixGraphBreymann();
-
- return new TeProxMatrixGraphBreymann();
- }
-
-};
-
-/*! \example createProximityMatrix.cpp
- This is an example of how to how to create a proximity matrix from a Spatial Temporal Element Set (STElementSet)
- */
-#endif
diff --git a/src/terralib/kernel/TeProxMatrixSlicingStrategy.h b/src/terralib/kernel/TeProxMatrixSlicingStrategy.h
deleted file mode 100644
index ad975d2..0000000
--- a/src/terralib/kernel/TeProxMatrixSlicingStrategy.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeProxMatrixSlicingStrategy.h
- \brief This file contains structures and definitions about slicing strategies of proximity matrix
-*/
-
-
-#ifndef TeProxMatrixSlicingStrategy_H
-#define TeProxMatrixSlicingStrategy_H
-
-#include "TeProxMatrixImplementation.h"
-
-struct TL_DLL TeProxMatrixSlicingParams
-{
-public:
- TeGPMSlicingStrategy strategy_;
- double zone_dist_;
- bool zone_local_;
-
- TeProxMatrixSlicingParams(const TeGPMSlicingStrategy& type=TeNoSlicingStrategy):
- strategy_(type), zone_dist_(0.), zone_local_(false)
- {}
-
- bool operator==(const TeProxMatrixSlicingParams& other) const
- {
- return ((strategy_==other.strategy_) && (zone_dist_==other.zone_dist_) &&
- (zone_local_==other.zone_local_));
- }
-};
-
-
-//! An abstract class to representate slicing strategies of proximity matrix
-class TL_DLL TeProxMatrixSlicingStrategy
-{
-protected:
- //! Slicing type
- TeProxMatrixSlicingParams params_;
-
- //! Empty constructor
- TeProxMatrixSlicingStrategy(const TeGPMSlicingStrategy& type): params_(type) {}
-
-public:
- //! Destructor
- virtual ~TeProxMatrixSlicingStrategy() {}
-
- //! Slice the proximity matrix
- virtual bool Slice(TeProxMatrixImplementation* )=0;
-
- //! Equal operator
- virtual bool operator== (const TeProxMatrixSlicingStrategy& s) const {return (params_==s.params_);}
-
- //! Returns the slicing params
- TeProxMatrixSlicingParams& slicingParams() { return params_; }
-
-};
-
-
-//! A class to implement the no slicing strategy of proximity matrix (i.e., all neighbour are considered to be in the first slice).
-class TL_DLL TeProxMatrixNoSlicingStrategy : public TeProxMatrixSlicingStrategy
-{
-public:
- //! Empty constructor
- TeProxMatrixNoSlicingStrategy (): TeProxMatrixSlicingStrategy(TeNoSlicingStrategy)
- {}
-
- //! No slice the proximity matrix
- virtual bool Slice(TeProxMatrixImplementation* ) {return true;}
-
- //! Destructor
- ~TeProxMatrixNoSlicingStrategy() {}
-};
-
-
-//! A class to implement the zone slicing strategy of proximity matrix (by local or newtork connection distance);
-class TL_DLL TeProxMatrixZonesSlicingStrategy : public TeProxMatrixSlicingStrategy
-{
-public:
- //! Constructor
- TeProxMatrixZonesSlicingStrategy (double dist, bool local = true):
- TeProxMatrixSlicingStrategy(TeZonesSlicingStrategy)
- {
- params_.zone_dist_=dist;
- params_.zone_local_=local;
- }
-
- //! Slice the proximity matrix through zone strategy
- virtual bool Slice(TeProxMatrixImplementation* imp);
-
- //! Destructor
- ~TeProxMatrixZonesSlicingStrategy() {}
-};
-
-#endif
diff --git a/src/terralib/kernel/TeProxMatrixStrategies.cpp b/src/terralib/kernel/TeProxMatrixStrategies.cpp
deleted file mode 100644
index 7198417..0000000
--- a/src/terralib/kernel/TeProxMatrixStrategies.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001, 2002, 2003 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeProxMatrixSlicingStrategy.h"
-#include "TeProxMatrixWeightsStrategy.h"
-
-
-// zone slicing strategy
-bool TeProxMatrixZonesSlicingStrategy::Slice (TeProxMatrixImplementation* imp)
-{
- if (imp == 0) return false;
-
- for (int obj = 0; obj < imp->numberOfObjects(); obj++)
- {
- TeNeighbours neigh;
- string object_id;
- TeProxMatrixAttributes attr;
- if (imp->getNeighbours (obj, object_id, neigh))
- {
- for (int i = 0; i < neigh.size(); i++)
- {
- attr = neigh.Attributes(i);
-
- double distance, d_centr, d_net, d_conn;
-
- if (attr.WasCentroidDistanceComputed())
- d_centr = attr.CentroidDistance();
- else
- d_centr = 0;
-
-
- if (attr.WasNetworkObjectsDistanceComputed())
- d_net = attr.NetworkObjectsDistance();
- else
- d_net = 0;
-
-
- if (attr.WasNetworkMinimumPathComputed())
- d_conn = attr.NetworkMinimumPath();
- else
- d_conn = 0;
-
-
- if (params_.zone_local_)
- distance = d_centr;
- else
- distance = d_net + d_conn;
-
- int zone = (int) (distance/params_.zone_dist_);
- attr.Slice (zone);
- imp->setConnectionAttributes (object_id, neigh[i], attr);
-
- }
-
- }
- }
- return true;
-}
-
-
-// inverse distance weight strategy
-bool TeProxMatrixInverseDistanceStrategy::
-ComputeWeigths (TeProxMatrixImplementation* imp)
-{
- if (imp == 0) return false;
-
- for (int obj = 0; obj < imp->numberOfObjects(); obj++)
- {
- TeNeighbours neigh;
- string object_id;
- TeProxMatrixAttributes attr;
- if (imp->getNeighbours (obj, object_id, neigh))
- {
- double tot = 0.0;
- vector<double> w_vec;
-
- for (int i = 0; i < neigh.size(); i++)
- {
- TeProxMatrixAttributes attr = neigh.Attributes(i);
- double w = 1;
- double d_centr, d_net, d_conn;
- if (attr.WasCentroidDistanceComputed())
- if ((d_centr = attr.CentroidDistance()) != 0.0)
- w += (params_.a_)*1/d_centr;
-
- if (attr.WasNetworkObjectsDistanceComputed())
- if ((d_net = attr.NetworkObjectsDistance()) != 0.0)
- w += (params_.b_)*1/d_net;
-
- if (attr.WasNetworkMinimumPathComputed())
- if ((d_conn = attr.NetworkMinimumPath()) != 0.0)
- w += (params_.c_)*1/d_conn;
-
- if (w != 1) w -= 1;
-
- w_vec.push_back (w*params_.factor_);
- tot += w;
- }
-
-
- for (int j = 0; j < neigh.size(); j++)
- {
- TeProxMatrixAttributes attr = neigh.Attributes(j);
- double w = w_vec[j];
- if (params_.norm_)
- if (tot != 0) w = w/tot;
- attr.Weight (w);
- imp->setConnectionAttributes (object_id, neigh[j], attr);
- }
- }
- }
- return true;
-}
-
-
-
-// inverse distance weight strategy
-bool TeProxMatrixSquaredInverseDistanceStrategy::
-ComputeWeigths (TeProxMatrixImplementation* imp)
-{
- if (imp == 0) return false;
-
- for (int obj = 0; obj < imp->numberOfObjects(); obj++)
- {
- TeNeighbours neigh;
- string object_id;
- TeProxMatrixAttributes attr;
- if (imp->getNeighbours (obj, object_id, neigh))
- {
- double tot = 0.0;
- vector<double> w_vec;
-
- for (int i = 0; i < neigh.size(); i++)
- {
- TeProxMatrixAttributes attr = neigh.Attributes(i);
- double w = 1;
- double d_centr, d_net, d_conn;
- if (attr.WasCentroidDistanceComputed())
- if ((d_centr = attr.CentroidDistance()) != 0.0)
- w += (params_.a_)*1/(d_centr*d_centr);
-
- if (attr.WasNetworkObjectsDistanceComputed())
- if ((d_net = attr.NetworkObjectsDistance()) != 0.0)
- w += (params_.b_)*1/(d_net*d_net);
-
- if (attr.WasNetworkMinimumPathComputed())
- if ((d_conn = attr.NetworkMinimumPath()) != 0.0)
- w += (params_.c_)*1/(d_conn*d_conn);
-
- if (w != 1) w -= 1;
-
- w_vec.push_back (w*params_.factor_);
- tot += w;
- }
-
-
- for (int j = 0; j < neigh.size(); j++)
- {
- TeProxMatrixAttributes attr = neigh.Attributes(j);
- double w = w_vec[j];
- if (params_.norm_)
- if (tot != 0) w = w/tot;
- attr.Weight (w);
- imp->setConnectionAttributes (object_id, neigh[j], attr);
- }
- }
- }
- return true;
-}
-
-// inverse distance weight strategy
-bool TeProxMatrixConnectionStrenghtStrategy::
-ComputeWeigths (TeProxMatrixImplementation* imp)
-{
- if (imp == 0) return false;
-
- for (int obj = 0; obj < imp->numberOfObjects(); obj++)
- {
- TeNeighbours neigh;
- string object_id;
- TeProxMatrixAttributes attr;
- if (imp->getNeighbours (obj, object_id, neigh))
- {
- double tot = 0.0;
- vector<double> w_vec;
-
- for (int i = 0; i < neigh.size(); i++)
- {
- TeProxMatrixAttributes attr = neigh.Attributes(i);
- double w = 1;
- double d_centr = TeMAXFLOAT;
- double d_net = TeMAXFLOAT;
- double d_conn = TeMAXFLOAT;
-
- if (attr.WasCentroidDistanceComputed())
- d_centr = attr.CentroidDistance();
-
-
- if (d_centr == 0.0)
- {
- w = 1;
- }
- else
- {
- if (d_centr <= params_.max_local_dist_)
- {
- w = 1/d_centr;
- }
- else
- {
-
- if (attr.WasNetworkObjectsDistanceComputed())
- d_net = attr.NetworkObjectsDistance();
-
- if (attr.WasNetworkMinimumPathComputed())
- d_conn = attr.NetworkMinimumPath();
-
- //double distance = (dist_ratio_*d_net + d_conn)/1000; Anap - Jul04
- double distance = (params_.dist_ratio_*d_net + d_conn);
- if (distance != 0.0)
- w = 1/distance;
- }
- }
- //if (w > 1.0) w = 1.0; n�o precisa: o objeto pode ser mais pr�ximo que 1 metro? jul04
- w_vec.push_back (w*params_.factor_);
- tot += w;
- }
-
- for (int j = 0; j < neigh.size(); j++)
- {
-
- TeProxMatrixAttributes attr = neigh.Attributes(j);
- double w = w_vec[j];
- if (params_.norm_)
- if (tot != 0) w = w/tot;
- attr.Weight (w);
- imp->setConnectionAttributes (object_id, neigh[j], attr);
-
- }
- }
- }
- return true;
-}
-
-
-
-bool TeProxMatrixNoWeightsStrategy::
-ComputeWeigths (TeProxMatrixImplementation* imp)
-{
- if (imp == 0) return false;
- // Normalize
- if (params_.norm_)
- {
- for (int obj = 0; obj < imp->numberOfObjects(); obj++)
- {
- TeNeighbours neigh;
- string object_id;
- TeProxMatrixAttributes attr;
- if (imp->getNeighbours (obj, object_id, neigh))
- {
-
- for (int j = 0; j < neigh.size(); j++)
- {
- double size = (double) neigh.size();
- double w = 1.0/size;
- TeProxMatrixAttributes attr = neigh.Attributes(j);
-
- attr.Weight (w);
- imp->setConnectionAttributes(object_id, neigh[j], attr);
- }
- }
- }
- }
- return true;
-}
-
diff --git a/src/terralib/kernel/TeProxMatrixWeightsStrategy.h b/src/terralib/kernel/TeProxMatrixWeightsStrategy.h
deleted file mode 100644
index 7fce569..0000000
--- a/src/terralib/kernel/TeProxMatrixWeightsStrategy.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeProxMatrixWeightsStrategy.h
- \brief This file contains structures and definitions about weight strategies of proximity matrix
-*/
-
-
-#ifndef TeProxMatrixWeightsStrategy_H
-#define TeProxMatrixWeightsStrategy_H
-
-#include "TeProxMatrixImplementation.h"
-#include <vector>
-
-
-struct TL_DLL TeProxMatrixWeightsParams
-{
-public:
- TeGPMWeightsStrategy strategy_;
- bool norm_;
- double a_;
- double b_;
- double c_;
- double factor_;
- double dist_ratio_;
- double max_local_dist_;
-
- TeProxMatrixWeightsParams():
- strategy_(TeNoWeightsStrategy), norm_(false), a_(1.),
- b_(1.), c_(1.), factor_(1.), dist_ratio_(0.), max_local_dist_(0.)
- {}
-
- TeProxMatrixWeightsParams(bool norm, const TeGPMWeightsStrategy& type):
- strategy_(type), norm_(norm), a_(1.), b_(1.), c_(1.),
- factor_(1.), dist_ratio_(0.), max_local_dist_(0.)
- {}
-
- bool operator== (const TeProxMatrixWeightsParams& other) const
- {
- return ((strategy_==other.strategy_) && (norm_==other.norm_) &&
- (a_==other.a_) && (b_==other.b_) && (c_==other.c_) &&
- (factor_==other.factor_) && (dist_ratio_==other.dist_ratio_) &&
- (max_local_dist_==other.max_local_dist_));
- }
-};
-
-
-//! An abstract class to representate weight strategies of proximity matrix
-class TL_DLL TeProxMatrixWeightsStrategy
-{
-protected:
- TeProxMatrixWeightsParams params_;
-
- //! Constructor
- TeProxMatrixWeightsStrategy(bool norm = false, const TeGPMWeightsStrategy& type=TeNoWeightsStrategy ):
- params_(norm, type)
- { }
-
-public:
- //! Compute weigths
- virtual bool ComputeWeigths (TeProxMatrixImplementation* ) =0;
-
- //! Destructor
- virtual ~TeProxMatrixWeightsStrategy() {}
-
- //! Equal operator
- virtual bool operator== (const TeProxMatrixWeightsStrategy& w) const {return (params_==w.params_);}
-
- //! Returns the strategy to weigt the matrix
- TeProxMatrixWeightsParams& weightsParams() { return params_; }
-};
-
-//! A class to implement the no weight strategy of proximity matrix (i.e., all weights are 1, only indicating that a connection exists).
-class TL_DLL TeProxMatrixNoWeightsStrategy : public TeProxMatrixWeightsStrategy
-{
-public:
- //! Constructor
- TeProxMatrixNoWeightsStrategy (bool norm = true) : TeProxMatrixWeightsStrategy(norm, TeNoWeightsStrategy)
- { }
-
- //! Compute weigths
- virtual bool ComputeWeigths (TeProxMatrixImplementation* imp);
-
- //! Destructor
- ~TeProxMatrixNoWeightsStrategy() {}
-};
-
-
-//! A class to implement the inverse distance weight strategy of proximity matrix; if network distances were computed, they can be also considered.
-//! Formula: w = (a*1/dist_centroids + b*1/dist_to_net + c*1/dist_net_connection)*factor
-//! These values can be normalized or not.
-class TL_DLL TeProxMatrixInverseDistanceStrategy : public TeProxMatrixWeightsStrategy
-{
-public:
- //! Constructor
- TeProxMatrixInverseDistanceStrategy (double a = 1.0, double b = 1.0, double c = 1.0, double factor = 1.0, bool norm = true) :
- TeProxMatrixWeightsStrategy (norm, TeInverseDistanceStrategy)
- { params_.a_ = a; params_.b_ = b; params_.c_ = c; params_.factor_ = factor;}
-
- //! Compute weights
- virtual bool ComputeWeigths (TeProxMatrixImplementation* imp);
-
- //! Destructor
- ~TeProxMatrixInverseDistanceStrategy() {}
-};
-
-
-//! A class to implement the inverse distance weight strategy of proximity matrix; if network distances were computed, they can be also considered.
-//! Formula: w = (a*1/(dist_centroids)2 + b*1/(dist_to_net)2 + c*1/(dist_net_connection)2)*factor
-//! These values can be normalized or not.
-class TL_DLL TeProxMatrixSquaredInverseDistanceStrategy : public TeProxMatrixWeightsStrategy
-{
-public:
- //! Constructor
- TeProxMatrixSquaredInverseDistanceStrategy (double a = 1.0, double b = 1.0, double c = 1.0, double factor = 1.0, bool norm = true) :
- TeProxMatrixWeightsStrategy (norm, TeSquaredInverseDistStrategy)
- { params_.a_ = a; params_.b_ = b; params_.c_ = c; params_.factor_ = factor;}
-
- //! Compute weights
- virtual bool ComputeWeigths (TeProxMatrixImplementation* imp);
-
- //! Destructor
- ~TeProxMatrixSquaredInverseDistanceStrategy() {}
-};
-
-
-//! A class to implement the connection strenght weight strategy of proximity matrix
-//! If centroids distance is smaller them max_local_distance, w will be only the local distance inverse (multiplied by factor).
-//! otherwise, it will be w = 1/(dist_ratio*dist_to_net + dist_net_connection)*factor.
-class TL_DLL TeProxMatrixConnectionStrenghtStrategy : public TeProxMatrixWeightsStrategy
-{
-public:
- //! Constructor
- TeProxMatrixConnectionStrenghtStrategy (double dist_ratio = 1.0, double max_local_distance = 0.0, double factor = 1.0, bool norm = true)
- : TeProxMatrixWeightsStrategy (norm, TeConnectionStrenghtStrategy )
- {
- params_.dist_ratio_ = dist_ratio;
- params_.max_local_dist_ = max_local_distance;
- params_.factor_ = factor;
- }
-
- //! Compute weights
- virtual bool ComputeWeigths (TeProxMatrixImplementation* imp);
-
- //! Destructor
- ~TeProxMatrixConnectionStrenghtStrategy() {}
-};
-
-#endif
diff --git a/src/terralib/kernel/TeQuerier.cpp b/src/terralib/kernel/TeQuerier.cpp
deleted file mode 100644
index 5c4fcd6..0000000
--- a/src/terralib/kernel/TeQuerier.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeQuerier.h"
-#include "TeQuerierImpl.h"
-
-
-TeQuerier::TeQuerier(TeQuerierParams& params)
-{
- Impl_ = TeQuerierImplFactory::make(params);
-}
-
-TeQuerier::TeQuerier(const TeQuerier& other)
-{
- if(Impl_)
- delete Impl_;
-
- Impl_ = 0;
- if(other.Impl_ && other.Impl_->params())
- {
- Impl_ = TeQuerierImplFactory::make(*(other.Impl_->params()));
- }
-}
-
-TeQuerier&
-TeQuerier::operator=(const TeQuerier& other)
-{
- if ( this != &other )
- {
- if(Impl_)
- delete Impl_;
-
- Impl_ = 0;
- if(other.Impl_ && other.Impl_->params())
- {
- Impl_ = TeQuerierImplFactory::make(*(other.Impl_->params()));
- }
- }
- return *this;
-}
-
-TeQuerier::~TeQuerier()
-{
- if(Impl_)
- delete (Impl_);
-}
-
-bool
-TeQuerier::loadInstances(int frame)
-{
- if(!Impl_)
- return false;
-
- return(Impl_->loadTimeFrameInstances(frame));
-}
-
-
-bool
-TeQuerier::fetchInstance(TeSTInstance& sto)
-{
- if(!Impl_)
- return false;
-
- return(Impl_->fetchInstance(sto));
-}
-
-
-int
-TeQuerier::getNumTimeFrames()
-{
- if(!Impl_)
- return false;
-
- return (Impl_->getNumTimeFrames());
-}
-
-bool
-TeQuerier::getTSEntry(TeTSEntry& tsEntry, int frame)
-{
- if(!Impl_)
- return false;
-
- return(Impl_->getTSEntry(tsEntry, frame));
-}
-
-
-bool
-TeQuerier::getTS(TeTemporalSeries& ts)
-{
- if(!Impl_)
- return false;
-
- return (Impl_->getTS(ts));
-}
-
-TeTheme*
-TeQuerier::theme()
-{
- if(!Impl_)
- return 0;
-
- return(Impl_->theme());
-}
-
-
-int
-TeQuerier::numElemInstances()
-{
- if(!Impl_)
- return 0;
-
- return (Impl_->numElemInstances());
-}
-
-TeQuerierParams&
-TeQuerier::params()
-{
- return (*(Impl_->params()));
-}
-
-TeTSParams&
-TeQuerier::getTSParams()
-{
- return (Impl_->getTSParams());
-}
-
-void
-TeQuerier::clear()
-{
- if(!Impl_)
- return;
-
- Impl_->clear();
-}
-
-TeAttributeList
-TeQuerier::getAttrList()
-{
- TeAttributeList temp;
- if(!Impl_)
- return temp;
-
- return (Impl_->getAttrList());
-}
-
-TeBox
-TeQuerier::getBox()
-{
- TeBox b;
- if(!Impl_)
- return b;
-
- return (Impl_->params()->box());
-}
-
-void
-TeQuerier::refresh(TeQuerierParams& params)
-{
- if(Impl_)
- delete (Impl_);
-
- Impl_ = TeQuerierImplFactory::make(params);
-}
-
-bool
-TeQuerier::loadGeometries(TeMultiGeometry& geometries, unsigned int& index)
-{
- if(!Impl_)
- return false;
-
- return (Impl_->loadGeometries(geometries, index));
-}
-
-
-bool
-TeQuerier::loadGeometries(TeMultiGeometry& geometries)
-{
- if(!Impl_)
- return false;
-
- return (Impl_->loadGeometries(geometries));
-}
-
-
diff --git a/src/terralib/kernel/TeQuerier.h b/src/terralib/kernel/TeQuerier.h
deleted file mode 100644
index 7a5e65d..0000000
--- a/src/terralib/kernel/TeQuerier.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeQuerier.h
- \brief This file contains a mechanism named "Querier" that is responsible for loading spatio-temporal instances from different sources.
-*/
-
-#ifndef __TERRALIB_INTERNAL_QUERIER_H
-#define __TERRALIB_INTERNAL_QUERIER_H
-
-#include "TeSTInstance.h"
-#include "TeTemporalSeries.h"
-
-#include "TeQuerierDBStr1.h"
-#include "TeQuerierDBStr2.h"
-#include "TeQuerierDBStr3.h"
-
-class TeQuerierParams;
-class TeQuerierImpl;
-
-/*! \class TeQuerier
- \brief A class responsible for loading spatial temporal instances from different sources.
-
- This class implements a mechanism that is responsible for loading
- spatio-temporal instances (ST instances) from different sources. This mechanism can
- load ST instances from a layer or theme stored in a
- TerraLib database or in a shape file. The Querier is initialized for a set of
- parameters that defines its behavior.
-
- \sa
- TeSTInstance TeQuerierParams
-*/
-class TL_DLL TeQuerier
-{
-protected:
- TeQuerierImpl* Impl_; //!< querier implementation (handle/bory pattern)
-
-public:
- //! Empty constructor
- TeQuerier():
- Impl_(0)
- {}
-
- //! Constructor from a set of parameters
- TeQuerier(TeQuerierParams& params);
-
- //! Copy constructor
- TeQuerier(const TeQuerier& other);
-
- //! Operator =
- TeQuerier& operator= (const TeQuerier& other);
-
- //! Destructor
- ~TeQuerier();
-
- //! Returns the base theme
- TeTheme* theme();
-
- //! Loads the ST instances. If frame > -1, loads only the instances of the frame-th time frame
- bool loadInstances(int frame=-1);
-
- //! Gets the current ST instance and moves to the next one. Returns if there is a next instance.
- bool fetchInstance(TeSTInstance& sto);
-
- //! Returns the number of time frames generated by a specific chronon
- int getNumTimeFrames();
-
- //! Gets a temporal serie entry associated to a time frame
- bool getTSEntry(TeTSEntry& tsEntry, int frame);
-
- //! Gets the temporal series
- bool getTS(TeTemporalSeries& ts);
-
- //! Returns the temporal series parameters
- TeTSParams& getTSParams();
-
- //! Gets the attribute list of the instances
- TeAttributeList getAttrList();
-
- //! Gets the minimal bounding box
- TeBox getBox();
-
- //! Returns the number of instances loaded by the method "loadInstances"
- int numElemInstances();
-
- //! Returns the querier parameters
- TeQuerierParams& params();
-
- //! Clear querier structures
- void clear();
-
- //! Refreshes the querier based on a new querier parameters
- void refresh(TeQuerierParams& params);
-
- //! Loads all geometries of the index-th geometry representation
- bool loadGeometries(TeMultiGeometry& geometries, unsigned int& index);
-
- //! Loads all geometries
- bool loadGeometries(TeMultiGeometry& geometries);
-};
-
- /** \example querierFromLayer.cpp
- Shows how to use a querier from layer
- */
-
- /** \example querierFromTheme.cpp
- Shows how to use a querier from theme
- */
-
- /** \example querierGroupChronon.cpp
- Shows how to querier from theme, grouping spatiotemporal instances by a chronon
- */
-
- /** \example querierGroupElement.cpp
- Shows how to use a querier from theme, grouping spatiotemporal instances by a element
- */
-
- /** \example querierGroupSpatialRest.cpp
- Shows how to use a querier from theme, grouping all
- spatiotemporal instances that satisfy a spatial restriction
- */
-
- /** \example querierWithSpatialRestBox.cpp
- Shows how to use a querier from theme, using a spatial restriction
- defined by a rectangle (TeBOX)
- */
-
- /** \example querierWithSpatialRestGeometry.cpp
- Shows how to use a querier from theme, using a spatial restriction
- defined by a geometry (polygons, lines, cells and points) from another theme
- */
-#endif
-
-
-
diff --git a/src/terralib/kernel/TeQuerierDB.cpp b/src/terralib/kernel/TeQuerierDB.cpp
deleted file mode 100644
index 8b75191..0000000
--- a/src/terralib/kernel/TeQuerierDB.cpp
+++ /dev/null
@@ -1,536 +0,0 @@
-
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeQuerierDB.h"
-#include "TeDatabase.h"
-#include "TeSTInstance.h"
-#include "TeTemporalSeries.h"
-
-// Add geometries from portal to STO
-bool
-addGeometry(TeDatabasePortal* portal, TeGeomRep geomRep, TeSTInstance& sto, const int& linkIndex, const int& geomIdIndex)
-{
- bool flag=true;
- map<int, int> geomIds;
-
- //verify if the portal has geometry (multi geometries)
- string geomId = string(portal->getData(geomIdIndex));
- string objId = string(portal->getData(linkIndex));
- int gId = atoi(geomId.c_str());
-
- //There are no geometries in the portal. This happens when
- //the objects have multi geometries (ex.: obj 1 is line and obj 2 is ponit).
- //The portal must point to the next object.
- if(geomId.empty())
- {
- do
- {
- flag = portal->fetchRow();
- } while(flag && (string(portal->getData(linkIndex)) == sto.objectId()));
-
- return flag;
- }
-
- //The portal points to other object. This happens when
- //the objects have more than one geometrical representation and, at the same time,
- //the theme has an external table.
- if(objId!=sto.objectId())
- {
- do
- {
- flag = portal->fetchRow();
- objId = string(portal->getData(linkIndex));
- } while(flag && ( objId != sto.objectId()));
-
- gId = atoi(portal->getData(geomIdIndex));
- }
-
- //There are geometries
- while( flag && (objId == sto.objectId()) &&
- (geomIds.find(gId) == geomIds.end()))
- {
- geomIds[gId] = gId;
- if(geomRep == TePOLYGONS)
- {
- TePolygon pol;
- flag = portal->fetchGeometry(pol, geomIdIndex);
- sto.addGeometry(pol);
- }
- else if (geomRep==TeLINES)
- {
- TeLine2D lin;
- flag = portal->fetchGeometry(lin, geomIdIndex);
- sto.addGeometry(lin);
- }
- else if (geomRep == TePOINTS)
- {
- TePoint point;
- flag = portal->fetchGeometry(point, geomIdIndex);
- sto.addGeometry(point);
- }
- else if (geomRep == TeCELLS)
- {
- TeCell cell;
- flag = portal->fetchGeometry(cell, geomIdIndex);
- sto.addGeometry(cell);
- }
- else if (geomRep == TeTEXT)
- {
- TeText text;
- flag = portal->fetchGeometry(text, geomIdIndex);
- sto.addGeometry(text);
- }
- else
- flag = portal->fetchRow();
-
- if(flag)
- {
- gId = atoi(portal->getData(geomIdIndex));
- objId = string(portal->getData(linkIndex));
- }
- }
-
- return flag;
-}
-
-// Add geometries from portal to STO considering the time value
-bool
-addGeometry(TeDatabasePortal* portal, TeGeomRep geomRep, TeSTInstance& sto, const int& linkIndex,
- const int& geomIdIndex, TeTimeInterval time, const int& initTimeIndex, const int& finalTimeIndex)
-{
- bool flag=true;
- map<int, int> geomIds;
- TeTime t1 = time.getT1();
- TeTime t2 = time.getT2();
-
- //verify if the portal has geometry (multi geometries)
-
- string geomId = string(portal->getData(geomIdIndex));
- string objId = string(portal->getData(linkIndex));
- int gId = atoi(geomId.c_str());
-
- //There are no geometries in the portal. This happens when
- //the objects have multi geometries (ex.: obj 1 is line and obj 2 is ponit).
- //The portal must point to the next object.
- if(geomId.empty())
- {
- do
- {
- flag = portal->fetchRow();
- objId = string(portal->getData(linkIndex));
- } while ( flag &&
- (objId == sto.objectId()) &&
- (portal->getDate(initTimeIndex) == t1) &&
- (portal->getDate(finalTimeIndex) == t2) );
-
- return flag;
- }
-
- //The portal points to other object. This happens when
- //the objects have more than one geometrical representation and, at the same time,
- //the theme has an external table.
- if(objId!=sto.objectId())
- {
- do
- {
- flag = portal->fetchRow();
- objId = string(portal->getData(linkIndex));
- } while(flag && (objId != sto.objectId()));
-
- gId = atoi(portal->getData(geomIdIndex));
- }
-
-
- //There are geometries
- while( flag && (objId == sto.objectId()) &&
- (geomIds.find(gId) == geomIds.end()) &&
- (portal->getDate(initTimeIndex) == t1) &&
- (portal->getDate(finalTimeIndex) == t2) )
- {
- geomIds[gId] = gId;
- if(geomRep == TePOLYGONS)
- {
- TePolygon pol;
- flag = portal->fetchGeometry(pol, geomIdIndex);
- sto.addGeometry(pol);
- }
- else if (geomRep==TeLINES)
- {
- TeLine2D lin;
- flag = portal->fetchGeometry(lin, geomIdIndex);
- sto.addGeometry(lin);
- }
- else if (geomRep == TePOINTS)
- {
- TePoint point;
- flag = portal->fetchGeometry(point, geomIdIndex);
- sto.addGeometry(point);
- }
- else if (geomRep == TeCELLS)
- {
- TeCell cell;
- flag = portal->fetchGeometry(cell, geomIdIndex);
- sto.addGeometry(cell);
- }
- else if (geomRep == TeTEXT)
- {
- TeText text;
- flag = portal->fetchGeometry(text, geomIdIndex);
- sto.addGeometry(text);
- }
- else
- flag = portal->fetchRow();
-
- if(flag)
- {
- gId = atoi(portal->getData(geomIdIndex));
- objId = string(portal->getData(linkIndex));
- }
- }
-
- return flag;
-}
-
-bool
-addGeometry(TeDatabasePortal* portal, TeGeomRep geomRep, TeMultiGeometry& geometries)
-{
- bool flag = true;
- //There are geometries
- do
- {
- if(geomRep == TePOLYGONS)
- {
- TePolygon pol;
- flag = portal->fetchGeometry(pol);
- geometries.getPolygons().add(pol);
- }
- else if (geomRep==TeLINES)
- {
- TeLine2D lin;
- flag = portal->fetchGeometry(lin);
- geometries.getLines().add(lin);
- }
- else if (geomRep == TePOINTS)
- {
- TePoint point;
- flag = portal->fetchGeometry(point);
- geometries.getPoints().add(point);
- }
- else if (geomRep == TeCELLS)
- {
- TeCell cell;
- flag = portal->fetchGeometry(cell);
- geometries.getCells().add(cell);
- }
- else if (geomRep == TeTEXT)
- {
- TeText text;
- flag = portal->fetchGeometry(text);
- geometries.getTexts().add(text);
- }
- else
- flag = portal->fetchRow();
- }while(flag);
- return flag;
-}
-
-TeQuerierDB::~TeQuerierDB()
-{
- for(unsigned int i=0; i<portals_.size(); ++i)
- delete (portals_[i]);
-
- portals_.clear();
- geomRepr_.clear();
-}
-
-
-void
-TeQuerierDB::clearVectors()
-{
- vector<TeDatabasePortal*>::iterator itPortal = portals_.begin();
- while(itPortal!=portals_.end())
- {
- TeDatabasePortal* portal = *itPortal;
- delete portal;
- ++itPortal;
- }
-
- portals_.clear();
- geomRepr_.clear();
- flagPortal_ = false;
-}
-
-void
-TeQuerierDB::clear()
-{
- clearVectors();
-}
-
-TeGeomRep
-TeQuerierDB::geometryRep()
-{ return TeGeomRep(params_->theme()->layer()->geomRep()); }
-
-string
-TeQuerierDB::sqlWhereRestrictions(TeRepresentation* rep)
-{
- TeKeys objs;
- string whereClause= " 1 = 1 ";
- TeDatabase* db = params_->theme()->layer()->database();
- if(!db)
- return "";
-
- // load the first representation
- if(!rep)
- rep = (params_->theme()->layer()->vectRepres())[0];
-
- // spatial restriction with other geometry representation
- if (params_->hasSpatialRes() && rep)
- {
- if(params_->boxRest().isValid())
- {
- TeBox b = params_->boxRest();
- TeGeomRep gRep = rep->geomRep_;
- whereClause += " AND "+ db->getSQLBoxWhere(b, gRep);
- }
- else if(params_->geomRest())
- {
- string geomTableRest = params_->theme()->layer()->tableName(params_->geomRepRest());
- TePrecision::instance().setPrecision(TeGetPrecision(params_->theme()->layer()->projection()));
-
- if((db->spatialRelation(geomTableRest, params_->geomRepRest(), params_->geomRest(),
- objs, params_->spatialRelation())) && (!objs.empty()))
- {
- string obs;
- for(unsigned int i=0; i<objs.size(); i++)
- {
- if(i!=0)
- obs += ",";
- obs += "'"+ objs[i] +"'";
- }
-
- whereClause += " AND "+ rep->tableName_ +".object_id IN ("+ obs +")";
- }
- else
- whereClause += " AND 1 <> 1 "; // no geometry was found
-
- }
- }
-
- //selected objects
- switch (params_->selectedObjs())
- {
- case TeAll:
- break;
-
- case TeSelectedByPointing:
- whereClause += " AND (grid_status = 1 OR grid_status = 3";
- whereClause += " OR (grid_status IS NULL AND (c_object_status = 1 OR c_object_status = 3)))";
- break;
-
- case TeNotSelectedByPointing:
- whereClause += " AND (grid_status = 0 OR grid_status = 2";
- whereClause += " OR (grid_status is null AND (c_object_status = 0 OR c_object_status = 2)))";
- break;
-
- case TeSelectedByQuery:
- whereClause += " AND (grid_status = 2 OR grid_status = 3";
- whereClause += " OR (grid_status is null AND (c_object_status = 2 OR c_object_status = 3)))";
- break;
-
- case TeNotSelectedByQuery:
- whereClause += " AND (grid_status = 0 OR grid_status = 1";
- whereClause += " OR (grid_status is null AND (c_object_status = 0 OR c_object_status = 1)))";
- break;
-
- case TeGrouped:
- whereClause += " AND c_legend_id <> 0";
- break;
-
- case TeNotGrouped:
- whereClause += " AND c_legend_id = 0";
- break;
-
- case TeSelectedByPointingAndQuery:
- whereClause += " AND grid_status = 3";
- whereClause += " OR (grid_status is null AND c_object_status = 3)";
- break;
-
- case TeSelectedByPointingOrQuery:
- whereClause += " AND (grid_status = 1 OR grid_status = 2 OR grid_status = 3)";
- whereClause += " OR (grid_status is null AND (c_object_status = 3 OR c_object_status = 1 OR c_object_status = 2))";
- break;
- }
-
- return whereClause;
-}
-
-
-string
-TeQuerierDB::sqlFrom(string geomTable)
-{
- string fromPar = "";
- string fromClause = "";
-
- //get collection tables
- string collAuxTable = params_->theme()->collectionAuxTable();
- string collTable = params_->theme()->collectionTable();
-
- if(collAuxTable.empty() || collTable.empty())
- return attrTable_.name();
-
- if(attrTable_.name().empty())
- return "";
-
- string uniqueIdName = attrTable_.name() +"."+ attrTable_.uniqueName();
- string objectIdName = attrTable_.name() +"."+ attrTable_.linkName();
- string linkName;
- if(attrTable_.tableType() != TeAttrExternal)
- linkName = attrTable_.name() +"."+ attrTable_.linkName();
- else
- linkName = collTable +".c_object_id ";
-
- //load geometry table if there is spatial restriction
- if(geomTable.empty() && params_->hasSpatialRes())
- {
- TeRepresentation* rep = (theme()->layer()->vectRepres())[0];
- geomTable = theme()->layer()->tableName(rep->geomRep_);
- }
-
- //get the extern table position
- int posExtern = -1;
- TeAttrTableVector attr = params_->theme()->attrTables();
- for(unsigned int i=0; i<attr.size(); ++i)
- {
- if(attr[i].tableType() == TeAttrExternal)
- ++posExtern;
- }
-
- //if the table is temporal
- if((attrTable_.tableType()==TeAttrEvent) || (attrTable_.tableType()==TeFixedGeomDynAttr))
- {
- fromPar += "((";
- fromClause = attrTable_.name()+" RIGHT JOIN "+ collAuxTable;
-
- if(attrTable_.tableType()==TeFixedGeomDynAttr)
- {
- fromClause += " ON "+ uniqueIdName +" = ";
- fromClause += collAuxTable +".aux0";
- fromClause += ")";
- }
- else
- {
- fromClause += " ON "+ objectIdName +" = ";
- fromClause += collAuxTable +".object_id"+ ")";
- }
-
- fromClause += " LEFT JOIN "+ collTable;
- fromClause += " ON "+ collAuxTable +".object_id = "+ collTable +".c_object_id )";
-
- if(!geomTable.empty())
- {
- fromPar += "(";
- fromClause += " LEFT JOIN "+ geomTable +" ON ";
- fromClause += collAuxTable +".object_id = "+ geomTable +".object_id )";
- }
-
- if(params_->selectedObjs() != TeAll) //! join with collection table
- {
- fromPar += "(";
- fromClause += " LEFT JOIN "+ collTable +" ON ";
- fromClause += collAuxTable +".object_id = "+ collTable +".c_object_id )";
- }
- }
-
- else if (attrTable_.tableType()==TeAttrStatic)
- {
- fromPar += "(";
- fromClause = attrTable_.name()+" RIGHT JOIN "+ collTable;
- fromClause += " ON "+ linkName +" = "+ collTable +".c_object_id)";
-
- if(!geomTable.empty()) //! join with geometry table
- {
- fromPar += "(";
- fromClause += " LEFT JOIN "+ geomTable +" ON ";
- fromClause += collTable +".c_object_id = "+ geomTable +".object_id )";
- }
-
- if(params_->selectedObjs() != TeAll) //! join with collection table
- {
- fromPar += "(";
- fromClause += " LEFT JOIN "+ collAuxTable +" ON ";
- fromClause += collTable +".c_object_id = "+ collAuxTable +".object_id )";
- }
- }
- else if (attrTable_.tableType()==TeAttrExternal)
- {
- fromPar += "((";
- fromClause = collAuxTable +" RIGHT JOIN "+ collTable;
- fromClause += " ON "+ collAuxTable +".object_id = "+ collTable +".c_object_id )";
- fromClause += " LEFT JOIN "+ attrTable_.name() +" ON ";
- fromClause += collAuxTable +".aux"+ Te2String(posExtern) +" = ";
- fromClause += uniqueIdName +" )";
-
- if(!geomTable.empty()) //! join with geometry table
- {
- fromPar += "(";
- fromClause += " LEFT JOIN "+ geomTable +" ON ";
- fromClause += collTable +".c_object_id = "+ geomTable +".object_id )";
- }
- }
-
- return (fromPar+fromClause);
-}
-
-bool
-TeQuerierDB::loadGeometries(TeMultiGeometry& geometries, unsigned int& index)
-{
- if((portals_.size()<(index+1)) || (geomRepr_.size()<(index+1)))
- return false;
-
- TeDatabasePortal* portal = portals_[index];
- TeRepresentation rep = geomRepr_[index];
- if(!portal)
- return false;
-
- bool flag = addGeometry(portal, rep.geomRep_, geometries);
-
- return flag;
-}
-
-bool
-TeQuerierDB::loadGeometries(TeMultiGeometry& geometries)
-{
- bool flag = false;
-
- if(!params_->loadGeom())
- return flag;
-
- for(unsigned int i=0; i<portals_.size(); ++i)
- flag = loadGeometries(geometries, i);
-
- return flag;
-}
-
-
-
diff --git a/src/terralib/kernel/TeQuerierDB.h b/src/terralib/kernel/TeQuerierDB.h
deleted file mode 100644
index 3770f5e..0000000
--- a/src/terralib/kernel/TeQuerierDB.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeQuerierDB.h
- \brief This file deals with strategies to retrieve spatio-temporal elements from a TerraLib database
-*/
-#ifndef __TERRALIB_INTERNAL_QUERIER_DB_H
-#define __TERRALIB_INTERNAL_QUERIER_DB_H
-
-#include "TeQuerierImpl.h"
-#include "TeRepresentation.h"
-
-class TeDatabasePortal;
-class TeTimeInterval;
-class TeTSEntry;
-
-//! auxiliary functions to add geometries in the TeSTInstance or TeMultiGeometry
-TL_DLL bool addGeometry(TeDatabasePortal* portal, TeGeomRep geomRep, TeSTInstance& sto, const int& linkIndex, const int& gIdIndex);
-TL_DLL bool addGeometry(TeDatabasePortal* portal, TeGeomRep geomRep, TeSTInstance& sto, const int& linkIndex,
- const int& geomIdIndex, TeTimeInterval time, const int& initTimeIndex, const int& finalTimeIndex);
-TL_DLL bool addGeometry(TeDatabasePortal* portal, TeGeomRep geomRep, TeMultiGeometry& geometries);
-
-
-//! An abstract class to build STOs (Spatial Temporal Objects) from a TerraLib database
-class TL_DLL TeQuerierDB : public TeQuerierImpl
-{
-protected:
- //! a portal to each geometry representation
- vector<TeDatabasePortal*> portals_;
- //! keep the geometry representation of each portal
- vector<TeRepresentation> geomRepr_;
- //! internal information used to fill the stos
- TeTable attrTable_;
- //! flag to control the portal
- bool flagPortal_;
-
- //! map FROM each portal in the vector "portals_" TO the indexes of the unique attributes
- map<int, vector<int> > uniqueIndex_;
-
- //! index of the link attributes in each portal in the vector "portals_"
- vector<int> linkIndex_;
-
- //! index in the first portal of the first attribute
- int attrIndex1_;
- //! index in the first portal of the last attribute
- int attrIndex2_;
- //! index in the first portal of the group, if there is collection table
- int groupIndex_;
- //! index where the geometry information begin in each portal in the vector "portals_"
- vector<int> geomIndex1_;
- //! index where the geometry information finish in each portal in the vector "portals_"
- vector<int> geomIndex2_;
- //! index of the initial time in each portal in the vector "portals_"
- vector<int> timeIndex1_;
- //! index of the final time in each portal in the vector "portals_"
- vector<int> timeIndex2_;
-
- //! map from legend identifier to group number
- map<int, int> legendIdGroup_;
-
- //! clear internal vectors
- void clearVectors();
-
- //! Return a where clause in SQL that represent the querier restrictions
- virtual string sqlWhereRestrictions(TeRepresentation* rep=0);
-
- //! Build the sql from clause
- string sqlFrom(string geomTable="");
-
-public:
- //! Constructor
- TeQuerierDB(TeQuerierParams* params): TeQuerierImpl(params), flagPortal_(false)
- {}
-
- //! Destructor
- virtual ~TeQuerierDB();
-
- //! Returns the pointer to the theme
- TeTheme* theme() { return params_->theme(); }
-
- //! Returns the pointer to the layer
- TeLayer* layer() { return params_->theme()->layer(); }
-
- //! Returns the geometry representation of the theme
- TeGeomRep geometryRep();
-
- //! Loads the STOs from database
- virtual bool loadInstances(TeTSEntry* ent=0) = 0;
-
- //! Returns each loaded STO
- virtual bool fetchInstance(TeSTInstance& stoi) = 0;
-
- //! Loads all geometries of the index-th geometry representation
- virtual bool loadGeometries(TeMultiGeometry& geometries, unsigned int& index);
-
- //! Loads all geometries
- virtual bool loadGeometries(TeMultiGeometry& geometries);
-
- //! Empties querier instances
- void clear();
-};
-
-#endif
diff --git a/src/terralib/kernel/TeQuerierDBStr1.cpp b/src/terralib/kernel/TeQuerierDBStr1.cpp
deleted file mode 100644
index e0f8249..0000000
--- a/src/terralib/kernel/TeQuerierDBStr1.cpp
+++ /dev/null
@@ -1,1174 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeQuerierDBStr1.h"
-#include "TeDatabase.h"
-#include "TeTemporalSeries.h"
-#include "TeSTInstance.h"
-
-bool
-TeQuerierDBStr1::initPortal(TeRepresentation& rep, TeTSEntry* ent)
-{
- string selectClause, fromClause, whereClause, orderByClause, groupByClause, parClause;
-
- //Init portal indexes
- isGroup_ = false;
- uniqueIndex_.clear();
- vector<int> indexesAux;
- linkIndex_.clear();
- linkIndex_.push_back(-1);
- attrIndex1_=-1;
- attrIndex2_=-1;
- groupIndex_=-1;
-
- geomIndex1_.clear();
- geomIndex1_.push_back(-1);
- geomIndex2_.clear();
- geomIndex2_.push_back(-1);
- timeIndex1_.clear();
- timeIndex1_.push_back(-1);
- timeIndex2_.clear();
- timeIndex2_.push_back(-1);
-
- //all vectors contains attributes with the table name and in upper case
- vector<string> attrs_select; //contains the attributes that will be used to fill the TeSTInstance
- vector<string> geoms_select; //contains the geometry attributes
- vector<string> times_select; //contains the date time attributes, when they are not in the attrs_select
- vector<string> unique_select; //contains the unique attributes, when they are not in the attrs_select
-
- //------------------------------------------- begin get information
- //get database
- TeDatabase* db = params_->theme()->layer()->database();
-
- //get attribute tables
- TeAttrTableVector atts;
- params_->theme()->getAttTables(atts);
-
- //verify if will be group the objects
- TeGroupingAttr groups = params_->groupAttr();
- bool groupAttr = !(groups.empty());
-
- //verify if the theme has collection table
- bool hasCollTable = false;
- legendIdGroup_.clear();
- legendIdGroup_[0]=0;
- if(db->tableExist(params_->theme()->collectionAuxTable()))
- {
- TeLegendEntryVector& legVec = params_->theme()->legend();
- for(unsigned int l=0; l<legVec.size(); ++l)
- legendIdGroup_[legVec[l].id()]=legVec[l].group();
- hasCollTable = true;
- }
-
- clearVectors();
- params_->setLoadAttrs(params_->loadSetedAttrs()); //the original data
-
- //get the link name - the first attribute table or geometry table
- linkName_ = rep.tableName_ +".object_id";
- if(atts.size() > 0)
- linkName_ = atts[0].name() +"."+ atts[0].linkName();
-
- if(params_->loadGeom())
- geomRepr_.push_back(rep);
-
- //------------------------------------------- end get information
-
- //------------------------------------------- begin information to mount SQL
- // -------- from
- bool fromNeedGeomTable = false;
- bool fromNeedCollTable = false;
-
- if(params_->loadGeom() || params_->hasSpatialRes() || atts.empty())
- fromNeedGeomTable = true;
- if(hasCollTable)
- fromNeedCollTable = true;
-
- // -------- group and order by
- bool useGroupByClause = false; //group by object_id
- bool useOrderByClause = false; //order by object_id, geom_id
- //Use group by clause when
- //1)it must group the attributes and
- //2)it must not load geometry and
- //3)all statistic functions exist in the SGBD
- string sGroup="";
- if(groupAttr)
- {
- if(params_->loadGeom())
- useGroupByClause = false;
- else
- {
- sGroup = db->getSQLStatistics(groups);
- isGroup_ = true;
- TeGroupingAttr::iterator it = groups.begin();
- while(it!= groups.end())
- {
- if(it->second != TeNOSTATISTIC)
- isGroup_ = false;
- ++it;
- }
- if(isGroup_)
- useGroupByClause = true;
- }
- groupInMemory_ = !useGroupByClause;
- }
- else
- useOrderByClause = true;
-
- // -------- select
- bool selectNeedGeom = false;
- if(params_->loadGeom())
- selectNeedGeom = true;
-
- //------------------------------------------- end information to mount SQL
-
- //------------------------------------------- begin mount SQL
- // order and group by clause
- orderByClause = " ORDER BY "+ linkName_;
- if(selectNeedGeom)
- orderByClause += ", "+ rep.tableName_ +".geom_id";
- groupByClause = " GROUP BY "+ linkName_;
-
- // ------------- select clause
- if(groupAttr)
- {
- if(!groupInMemory_) //use statistic function database
- {
- bool flag = true;
- string auxS = sGroup;
- while(flag)
- {
- size_t pos = auxS.find(",", 0, 1);
- if (pos == string::npos)
- {
- attrs_select.push_back(auxS);
- flag = false;
- }
- else
- {
- attrs_select.push_back(auxS.substr(0, pos));
- auxS = auxS.substr(pos+1);
- }
- }
- }
- else //load the attributes from TeGroupingAttr
- {
- //fill select clause from set of attributes
- string lastAttr = "";
- TeGroupingAttr::iterator it = groups.begin();
- while(it!= groups.end())
- {
- if(lastAttr != it->first.name_)
- attrs_select.push_back(it->first.name_);
- lastAttr = it->first.name_;
- ++it;
- }
-
- // select datatime information
- if(!attrTable_.name().empty())
- {
- times_select.push_back(attrTable_.name()+"."+attrTable_.attInitialTime());
-
- if(attrTable_.attInitialTime()!=attrTable_.attFinalTime())
- times_select.push_back(attrTable_.name()+"."+attrTable_.attFinalTime());
- }
- }
- }
- else // load all attributes or the attributes that are in the vector
- {
- // get some information about the attribute tables required
- for(unsigned int i=0; i<atts.size(); i++)
- {
- //date time information
- if((atts[i].tableType()==TeAttrEvent) || (atts[i].tableType()==TeFixedGeomDynAttr))
- {
- attrTable_ = atts[i];
- times_select.push_back(atts[i].name()+"."+attrTable_.attInitialTime());
- times_select.push_back(atts[i].name()+"."+attrTable_.attFinalTime());
- }
-
- //unique information
- unique_select.push_back(atts[i].name()+"."+atts[i].uniqueName());
- indexesAux.push_back(-1);
-
- //fill vector of attributes and sql string with all attributes
- if(params_->loadAllAttr())
- {
- TeAttributeList::iterator itAttr = atts[i].attributeList().begin();
- while(itAttr!= atts[i].attributeList().end())
- {
- string attribute = atts[i].name() +"."+ (*itAttr).rep_.name_;
- attrs_select.push_back(attribute);
- ++itAttr;
- }
- }
- }
-
- if(!params_->loadAllAttr())
- {
- vector<string>::iterator itVec = params_->loadAttrs().begin();
- while(itVec!=params_->loadAttrs().end())
- {
- //insert in select clause itVec: deve estar no formato tableName.attrName
- attrs_select.push_back (*itVec);
- ++itVec;
- }
- }
- }
-
- if(selectNeedGeom)
- {
- TeAttributeList attrs;
- if (!db->getAttributeList(rep.tableName_, attrs))
- return false;
-
- for(unsigned int i=0; i<attrs.size(); ++i)
- geoms_select.push_back(rep.tableName_+"."+ attrs[i].rep_.name_);
-
- // order by clause
- if((rep.geomRep_ == TePOLYGONS) && (db->dbmsName() != "OracleSpatial") && (db->dbmsName() != "PostGIS") )
- orderByClause += ", parent_id ASC, num_holes DESC";
- }
-
- // ------------- from and where clause
- if(!fromNeedCollTable)
- {
- if(fromNeedGeomTable)
- fromClause = " FROM " + tableJoin(atts, rep.tableName_, "object_id");
- else
- fromClause = " FROM " + tableJoin(atts);
-
- //if the theme does not have collection, it must apply its restrictions (attribute, temporal and spatial)
- whereClause = params_->theme()->sqlWhereRestrictions(&rep);
- }
- else
- {
- if(fromNeedGeomTable)
- fromClause = params_->theme()->sqlGridFrom(rep.tableName_);
- else
- fromClause = params_->theme()->sqlGridFrom();
- }
-
- if(ent)
- {
- if(attrTable_.name().empty())
- params_->theme()->getTemporalTable(attrTable_);
-
- string iniTime = attrTable_.name()+"."+attrTable_.attInitialTime();
- string finTime = attrTable_.name()+"."+attrTable_.attFinalTime();
- if(!whereClause.empty())
- whereClause += " AND ";
-
- if ((params_->chronon()==TeMONTHOFYEAR) || (params_->chronon()==TeDAYOFWEEK))
- whereClause += db->getSQLTemporalWhere(ent->timeInt_, ent->timeInt_, params_->chronon(), TeTIMEDURING, iniTime, finTime);
- else
- {
- TeTimeInterval interval = ent->time_;
- interval.intervalChronon(params_->chronon());
-
- whereClause += db->getSQLTemporalWhere(interval, TeTIMEDURING, iniTime, finTime);
- }
- }
-
- if(!objectId().empty())
- {
- if(!whereClause.empty())
- whereClause += " AND ";
-
- whereClause += linkName_ +" = '"+ objectId() +"'";
- }
-
- //---------- mount select clause and get the indexes
- unsigned int index=0;
- unsigned int count=0;
- selectClause = "";
- uniqueIndex_[0] = indexesAux;
-
- //this attribute list can contain datetime, link and unique information
- attrIndex1_ = count;
- for(index=0; index<attrs_select.size(); ++index)
- {
- if(!selectClause.empty())
- selectClause += ", ";
- selectClause += attrs_select[index];
- //link index
- if(TeConvertToUpperCase(linkName_)==TeConvertToUpperCase(attrs_select[index]))
- linkIndex_[0] = count;
- //unique index
- for(unsigned int i=0; i<unique_select.size(); ++i)
- {
- if(TeConvertToUpperCase(unique_select[i])==TeConvertToUpperCase(attrs_select[index]))
- uniqueIndex_[0][i] = count;
- }
-
- //time index
- for(unsigned int i=0; i<times_select.size(); ++i)
- {
- if(TeConvertToUpperCase(times_select[i])==TeConvertToUpperCase(attrs_select[index]))
- {
- if(i==0)
- timeIndex1_[0] = count;
- else
- timeIndex2_[0] = count;
- }
- }
- if(timeIndex1_[0]>=0 && timeIndex2_[0]<0)
- timeIndex2_[0] = timeIndex1_[0];
-
- attrIndex2_ = count;
- ++count;
- }
-
- //link attribute
- if(linkIndex_[0]<0)
- {
- if(!selectClause.empty())
- selectClause += ", ";
- selectClause += linkName_;
- linkIndex_[0] = count;
- ++count;
- }
-
- //unique attributes
- for(index=0; index<unique_select.size(); ++index)
- {
- if(uniqueIndex_[0][index]<0)
- {
- //verify if the unique name is equal to link name
- if(TeConvertToUpperCase(unique_select[index]) == TeConvertToUpperCase(linkName_))
- uniqueIndex_[0][index] = linkIndex_[0];
- else
- {
- //adds the unique attributes that were not added
- if(!selectClause.empty())
- selectClause += ", ";
- selectClause += unique_select[index];
- uniqueIndex_[0][index] = count;
- ++count;
- }
- }
- }
-
- //group index
- if(hasCollTable)
- {
- if(!selectClause.empty())
- selectClause += ", ";
- if(useGroupByClause)
- selectClause += " MIN("+ params_->theme()->collectionTable()+".c_legend_id )";
- else
- selectClause += params_->theme()->collectionTable()+".c_legend_id";
-
- groupIndex_ = count;
- ++count;
- }
-
- //time attributes
- if(timeIndex1_[0]<0 && (!times_select.empty()))
- {
- timeIndex1_[0] = count;
- for(index=0; index<times_select.size(); ++index)
- {
- if(!selectClause.empty())
- selectClause += ", ";
- selectClause += times_select[index];
- timeIndex2_[0] = count;
- ++count;
- }
- }
-
- //geometries
- if(!geoms_select.empty())
- geomIndex1_[0] = count;
- for(index=0; index<geoms_select.size(); ++index)
- {
- if(!selectClause.empty())
- selectClause += ", ";
- selectClause += geoms_select[index];
- geomIndex2_[0] = count;
- ++count;
- }
-
- //---------- querier restriction
- string sqlQuerierRest = sqlWhereRestrictions(&rep);
- if(!whereClause.empty())
- whereClause += " AND ";
-
- whereClause += sqlQuerierRest;
-
- fromClause_ = fromClause;
- whereClause_ = whereClause;
- string sql = "SELECT "+ selectClause + fromClause;
- if(!whereClause.empty())
- sql += " WHERE "+ whereClause;
-
- if(useGroupByClause)
- sql += " "+ groupByClause;
- else
- sql += " "+ orderByClause;
-
- //------------------------------------------- end mount SQL
-
- // --------- Submit the query
- portals_.clear();
- TeDatabasePortal* portal = db->getPortal();
-
- if(!portal)
- return false;
-
- if(!portal->query(sql))
- {
- delete (portal);
- flagPortal_ = false;
- return false;
- }
-
- if(!portal->fetchRow())
- {
- delete (portal);
- flagPortal_ = false;
- return false;
- }
-
- string id = portal->getData(linkIndex_[0]);
- bool flag = true;
- while(id.empty() && flag)
- {
- flag = portal->fetchRow();
- if(flag)
- id = portal->getData(0); //object_Id
- }
-
- if(id.empty() || (!flag))
- {
- delete (portal);
- flagPortal_ = false;
- return false;
- }
-
- portals_.push_back (portal);
- flagPortal_ = true;
- lastObjId_ ="";
- return true;
-}
-
-bool
-TeQuerierDBStr1::initGeomPortal(TeRepresentation& rep, TeTSEntry* ent)
-{
- string selectClause, fromClause, whereClause, orderByClause, parClause;
- string initialTime, finalTime;
- string uniqueName;
- vector<int> indexesAux;
- linkIndex_.push_back(-1);
- geomIndex1_.push_back(-1);
- geomIndex2_.push_back(-1);
- timeIndex1_.push_back(-1);
- timeIndex2_.push_back(-1);
-
- TeDatabase* db = params_->theme()->layer()->database();
-
- //------- Get geometry table
- geomRepr_.push_back(rep);
- if(rep.tableName_.empty())
- return false;
-
- int ind = linkIndex_.size()-1; //the last position in the vectors
-
- selectClause = linkName_;
- orderByClause = " ORDER BY "+ linkName_;
- linkIndex_[ind] = 0;
-
- if((rep.geomRep_ == TePOLYGONS) && (db->dbmsName() != "OracleSpatial") && (db->dbmsName() != "PostGIS") )
- orderByClause += " , parent_id ASC, num_holes DESC";
-
- //------- Get temporal attribute
- if(!attrTable_.name().empty())
- {
- initialTime = attrTable_.name() +"."+ attrTable_.attInitialTime ();
- finalTime = attrTable_.name() +"."+ attrTable_.attFinalTime ();
-
- // fill vector of unique name
- uniqueName = attrTable_.name()+"."+attrTable_.uniqueName();
-
- selectClause += ", "+ uniqueName;
- indexesAux.push_back(1);
- selectClause += ", "+ initialTime;
- timeIndex1_[ind] = 2;
- timeIndex2_[ind] = 2;
-
- if (initialTime != finalTime)
- {
- selectClause += ", "+ finalTime;
- timeIndex2_[ind] = 3;
- }
- }
-
- //adds geometry attributes
- selectClause += ","+ rep.tableName_ +".* ";
- uniqueIndex_[ind] = indexesAux;
- if(indexesAux.empty())
- geomIndex1_[ind] = 1;
- else if(timeIndex1_[ind]==timeIndex2_[ind])
- geomIndex1_[ind] = 3;
- else
- geomIndex1_[ind] = 4;
-
- if(!db->tableExist(params_->theme()->collectionAuxTable()))
- {
- TeAttrTableVector atts;
- params_->theme()->getAttTables(atts);
-
- if(atts.empty())
- return false;
-
- fromClause = " FROM " + tableJoin(atts, rep.tableName_, "object_id");
- whereClause = params_->theme()->sqlWhereRestrictions(&rep);
- }
- else
- fromClause = params_->theme()->sqlGridFrom(rep.tableName_);
-
- if(ent)
- {
- string iniTime = attrTable_.name()+"."+initialTime;
- string finTime = attrTable_.name()+"."+finalTime;
- if(!whereClause.empty())
- whereClause += " AND ";
-
- if ((params_->chronon()==TeMONTHOFYEAR) || (params_->chronon()==TeDAYOFWEEK))
- whereClause += db->getSQLTemporalWhere(ent->timeInt_, ent->timeInt_, params_->chronon(), TeTIMEDURING, iniTime, finTime);
- else
- {
- TeTimeInterval interval = ent->time_;
- interval.intervalChronon(params_->chronon());
-
- whereClause += db->getSQLTemporalWhere(interval, TeTIMEDURING, iniTime, finTime);
- }
- }
-
- //where clause
- if(!objectId().empty())
- {
- if(!whereClause.empty())
- whereClause += " AND ";
-
- whereClause += rep.tableName_+".object_id = '"+ objectId() +"'";
- }
-
- //---------- querier restriction
- string sqlQuerierRest = sqlWhereRestrictions(&rep);
- if(!whereClause.empty())
- whereClause += " AND ";
-
- whereClause += sqlQuerierRest;
-
- //----------
-
- string sql = "SELECT "+ selectClause + fromClause;
- if(!whereClause.empty())
- sql += " WHERE "+ whereClause;
- sql += orderByClause;
-
- //------ Submit the query
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- if(!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- if(portal->fetchRow())
- portals_.push_back (portal);
- else
- delete portal;
-
- return true;
-}
-
-
-// ---------- final - initPortal
-// It is used in two cases:
-// 1) when it must return all instances of an object
-// 2) when the attributes was grouped by sql functions - without geometry
-
-bool
-TeQuerierDBStr1::fillSTOGrouped(TeSTInstance& sto, bool fetchInstance)
-{
- if(portals_.empty())
- return false;
-
- TeDatabasePortal* portal = portals_[0];
- if(!portal)
- return false;
-
- TeRepresentation* rep = 0;
- if(!geomRepr_.empty())
- rep = &(geomRepr_[0]);
-
- TeTime minT1, maxT2;
-
- // builds a ST object instance
- TeTime t1, t2;
- vector<string> attrValues;
-
- // verify if exist several geometries for an object
- bool flagGeom = true;
- while(flagGeom && fetchInstance)
- {
- sto.objectId (portal->getData(linkIndex_[0]));
-
- if(rep && (!params_->loadGeom()))
- {
- int geomId = portal->getInt(rep->tableName_ +".geom_id");
-
- if(sto.objectId()==lastObjId_)
- {
- if (geomId_!=geomId)
- {
- flagGeom = portal->fetchRow();
- continue;
- }
- }
- else
- geomId_ = geomId;
- }
- flagGeom = false;
- }
-
- // ------------- begin fill attribute
- // process the records filling the parameters of each instance
- TeAttributeList& attrsPortal = portal->getAttributeList();
-
- //get the attributes
- for(int s=attrIndex1_; s<=attrIndex2_; ++s)
- {
- if(s<0)
- break;
- attrValues.push_back(portal->getData(s));
- if(!fetchInstance) //fill the attribute list
- attrList_->push_back(attrsPortal[s]);
- }
-
- //get the group index
- if(groupIndex_!=-1)
- {
- int gIndex = portal->getInt(groupIndex_);
- sto.setSlice(legendIdGroup_[gIndex]);
- }
-
- if(isGroup_) // it was grouped by sql functions and without geometry
- sto.addUniqueId(string(portal->getData(linkIndex_[0])));
- else
- {
- //unique id
- for(unsigned int s=0; s<uniqueIndex_[0].size(); ++s)
- {
- string uniqueValue = portal->getData(uniqueIndex_[0][s]);
- sto.addUniqueId(uniqueValue);
- }
-
- //date time information
- if(timeIndex1_[0]>=0 && timeIndex2_[0]>=0)
- {
- t1 = portal->getDate(timeIndex1_[0]);
- t2 = portal->getDate(timeIndex2_[0]);
- sto.timeInterval(TeTimeInterval(t1,t2));
- }
- }
-
- //! Set the property in the stoInstance
- sto.setProperties(attrValues);
- sto.setAttrList(attrList_);
-
- if(!fetchInstance) //only to get the attributes
- return true;
-
- // ------------- end fill attribute
- //total time
- if(t1.isValid() && t1<minT1)
- minT1 = t1;
- if(t2.isValid() && maxT2<t2)
- maxT2 = t2;
-
- // ------------- begin fill geometries
- if(params_->loadGeom())
- {
- if(t1.isValid() && t2.isValid())
- flagPortal_ = addGeometry(portal, rep->geomRep_, sto, linkIndex_[0], geomIndex1_[0], TeTimeInterval(t1,t2), timeIndex1_[0], timeIndex2_[0]);
- else
- flagPortal_ = addGeometry(portal, rep->geomRep_, sto, linkIndex_[0], geomIndex1_[0]);
- }
- else
- flagPortal_ = portal->fetchRow();
-
- // ------------- end fill geometries
-
- lastObjId_ = sto.objectId();
- return true;
-}
-
-bool
-TeQuerierDBStr1::fillGeomSTO(TeSTInstance& sto, unsigned int index)
-{
- if((portals_.size()<(index+1)) || (geomRepr_.size()<(index+1)))
- return false;
-
- TeDatabasePortal* portal = portals_[index];
- TeRepresentation rep = geomRepr_[index];
- if(!portal)
- return false;
-
- TeTimeInterval time = sto.timeInterval();
- bool flag = false;
- if(time.isValid())
- flag = addGeometry(portal, rep.geomRep_, sto, linkIndex_[index], geomIndex1_[index], time, timeIndex1_[index], timeIndex2_[index]);
- else
- flag = addGeometry(portal, rep.geomRep_, sto, linkIndex_[index], geomIndex1_[index] );
-
- if(flag==false)
- flagPortal_ = false;
-
- return true;
-}
-
-// It is used in a case:
-// 1) when the attributes of the object instances must be grouping in memory - with or without geometry
-bool
-TeQuerierDBStr1::fillSTONoGrouped(TeSTInstance& sto)
-{
- int s;
- if(portals_.empty())
- return false;
-
- TeDatabasePortal* portal = portals_[0];
- if(!portal)
- return false;
-
- TeRepresentation* rep = 0;
- if(!geomRepr_.empty())
- rep = &(geomRepr_[0]);
-
- map<int, vector<double> > valuesDouble;
- map<int, vector<string> > valuesString;
- string lastObj = "";
-
- TeAttributeList& attrsPortal = portal->getAttributeList();
-
- //get the group index
- if(groupIndex_!=-1)
- {
- int gIndex = portal->getInt(groupIndex_);
- sto.setSlice(legendIdGroup_[gIndex]);
- }
-
- //when there is spatial restriction, the querier can not group the attributes and
- //get the geometry at the same time. In this case, it do not get the geometry.
- if(!params_->loadGeom() || params_->hasSpatialRes())
- {
- int cont = 0;
- do
- {
- string objId = portal->getData(linkIndex_[0]);
- //if there is a spatial restriction, it groups all instances of all objects of the portal
- if(!params_->hasSpatialRes() && (!lastObj.empty() && objId != lastObj))
- break;
-
- string val = "";
- //portal has the attributes that will be grouped
- for(s=attrIndex1_; s<=attrIndex2_; ++s)
- {
- if(s<0)
- break;
- val = portal->getData(s);
- if((attrsPortal[s].rep_.type_==TeREAL) || (attrsPortal[s].rep_.type_==TeINT))
- {
- if(val.empty())
- valuesDouble[s].push_back (TeMAXFLOAT); //invalid value
- else
- valuesDouble[s].push_back (atof(val.c_str()));
- }
- else
- valuesString[s].push_back(val);
- }
-
- flagPortal_ = portal->fetchRow();
- lastObj = objId;
- ++cont;
-
- } while(flagPortal_);
- }
- else // -- when it must fill the geometry
- {
- //------- first: load the geometry, attributes and time of the first object
- //object id
- lastObj = portal->getData(linkIndex_[0]);
-
- //attribute val
- string val = "";
-
- for(s=attrIndex1_; s<=attrIndex2_; ++s)
- {
- val = portal->getData(s);
- if((attrsPortal[s].rep_.type_==TeREAL) || (attrsPortal[s].rep_.type_==TeINT))
- {
- if(val.empty())
- valuesDouble[s].push_back (TeMAXFLOAT); //invalid value
- else
- valuesDouble[s].push_back (atof(val.c_str()));
- }
- else
- valuesString[s].push_back (val);
- }
-
- //time
- TeTime t1, t2;
- if(!attrTable_.name().empty())
- {
- t1 = portal->getDate(timeIndex1_[0]);
- t2 = portal->getDate(timeIndex2_[0]);
- }
-
- sto.objectId(lastObj);
- if(t1.isValid() && t2.isValid())
- flagPortal_ = addGeometry(portal, rep->geomRep_, sto, linkIndex_[0], geomIndex1_[0], TeTimeInterval(t1,t2), timeIndex1_[0], timeIndex2_[0]);
- else
- flagPortal_ = addGeometry(portal, rep->geomRep_, sto, linkIndex_[0], geomIndex1_[0]);
-
- //------- second: load the attributes of the other objects
- int cont = 0;
- while (flagPortal_)
- {
- string objId = portal->getData(linkIndex_[0]);
- //if there is a spatial restriction, it groups all instances of all objects of the portal
- if(objId != lastObj)
- break;
-
- //same object id
- string gId = portal->getData (geomIndex1_[0]);
- int geomId = atoi(gId.c_str());
- if(gId.empty())
- geomId = cont;
-
- if(!cont)
- geomId_ = geomId; //first geom_id
-
- //verify the geomId
- if(geomId==geomId_)
- {
- flagPortal_ = portal->fetchRow();
- lastObj = objId;
- continue;
- }
-
- val = "";
- for(s=attrIndex1_; s<=attrIndex2_; ++s)
- {
- val = portal->getData(s);
- if((attrsPortal[s].rep_.type_==TeREAL) || (attrsPortal[s].rep_.type_==TeINT))
- {
- if(val.empty())
- valuesDouble[s].push_back (TeMAXFLOAT); //invalid value
- else
- valuesDouble[s].push_back (atof(val.c_str()));
- }
- else
- valuesString[s].push_back (val);
- }
-
- flagPortal_ = portal->fetchRow();
- lastObj = objId;
- ++cont;
- }
- }
-
- //fill the property from portal
- //calculate the statistics
- string lastAttr = "";
- unsigned int j=0;
- string colName = "";
- TeGroupingAttr::iterator it = params()->groupAttr().begin();
-
- TeStatisticValMap statDouble;
- TeStatisticStringValMap statString;
-
- TeAttrDataType attrType = TeSTRING;
- while(it!=params()->groupAttr().end())
- {
- if(lastAttr != it->first.name_)
- {
- statDouble.clear();
- statString.clear();
- //if((it->first.type_==TeREAL) || (it->first.type_==TeINT))
- if((attrsPortal[j].rep_.type_==TeREAL) || (attrsPortal[j].rep_.type_==TeINT))
- {
- TeCalculateStatistics(valuesDouble[j].begin(), valuesDouble[j].end(), statDouble);
- attrType = TeREAL;
- }
- else
- {
- TeCalculateStatistics(valuesString[j].begin(), valuesString[j].end(), statString);
- attrType = TeSTRING;
- }
-
- colName = attrsPortal[j].rep_.name_;
- ++j;
- }
-
- double resultD=0;
- string resultS="";
- string prefix;
- switch(it->second)
- {
- case TeCOUNT:
- resultD = statDouble[TeCOUNT];
- resultS = statString[TeCOUNT];
- prefix = "count";
- break;
- case TeVALIDCOUNT:
- resultD = statDouble[TeVALIDCOUNT];
- resultS = statString[TeVALIDCOUNT];
- prefix = "valCount";
- break;
- case TeMINVALUE:
- resultD = statDouble[TeMINVALUE];
- resultS = statString[TeMINVALUE];
- prefix = "min";
- break;
- case TeMAXVALUE:
- resultD = statDouble[TeMAXVALUE];
- resultS = statString[TeMAXVALUE];
- prefix = "max";
- break;
- case TeSUM:
- resultD = statDouble[TeSUM];
- prefix = "sum";
- break;
- case TeMEAN:
- resultD = statDouble[TeMEAN];
- prefix = "mean";
- break;
- case TeSTANDARDDEVIATION:
- resultD = statDouble[TeSTANDARDDEVIATION];
- prefix = "stDeviation";
- break;
- case TeVARIANCE:
- resultD = statDouble[TeVARIANCE];
- prefix = "variance";
- break;
- case TeSKEWNESS:
- resultD = statDouble[TeSKEWNESS];
- prefix = "skwness";
- break;
- case TeKURTOSIS:
- resultD = statDouble[TeKURTOSIS];
- prefix = "kurtosis";
- break;
- case TeAMPLITUDE:
- resultD = statDouble[TeAMPLITUDE];
- prefix = "amplitude";
- break;
- case TeMEDIAN:
- resultD = statDouble[TeMEDIAN];
- prefix = "median";
- break;
- case TeVARCOEFF:
- resultD = statDouble[TeVARCOEFF];
- prefix = "varcoeff";
- break;
- case TeMODE:
- resultD = statDouble[TeMODE];
- prefix = "mode";
- break;
- default:
- break;
- }
-
- lastAttr = it->first.name_;
- ++it;
-
- //fill the property
- if(attrType == TeREAL)
- sto.addPropertyValue(Te2String(resultD));
- else
- sto.addPropertyValue(resultS);
- }
-
- //adds the property in the stoInstance
- if(!params_->hasSpatialRes())
- {
- sto.addUniqueId(lastObj);
- sto.objectId(lastObj);
- }
- sto.setAttrList(attrList_);
-
- lastObjId_ = sto.objectId();
- return true;
-}
-
-
-bool
-TeQuerierDBStr1::loadInstances(TeTSEntry* ent)
-{
- if(!params_->theme())
- return false;
-
- TeRepresPointerVector repres = params_->theme()->layer()->vectRepres();
- TeRepresentation rep;
-
- //fill instances - first fill the geometry representation of the spatial restriction
- if(params_->theme()->hasSpatialRest())
- rep = **(TeFindRepresentation(repres.begin(), repres.end(), params_->theme()->geomRepRestriction()));
- else
- {
- for(int i=0; i<(int)repres.size(); ++i)
- {
- rep = *repres[i];
- break;
- }
- }
-
- if(!initPortal(rep, ent))
- return false;
-
- //get the attribute list
- attrList_->clear();
- if(!groupInMemory_)
- {
- TeSTInstance i;
- fillSTOGrouped(i, false);
- }
- else
- {
- TeGroupingAttr::iterator it = params()->groupAttr().begin();
- while(it!=params()->groupAttr().end())
- {
- TeAttribute at;
- at.rep_ = it->first;
- attrList_->push_back (at);
- ++it;
- }
- }
-
- if(!params_->loadGeom())
- return true;
-
- //set a invalid box
- TeBox box;
- params_->box(box);
-
- for(unsigned int i=0; i<repres.size(); ++i)
- {
- if(repres[i]->geomRep_ == rep.geomRep_)
- continue;
-
- if(!initGeomPortal(*(repres[i]), ent))
- {
- clearVectors();
- return false;
- }
- }
- return true;
-}
-
-bool
-TeQuerierDBStr1::fetchInstance(TeSTInstance& sto)
-{
- sto.clear();
- bool flag = false;
-
- if(!flagPortal_)
- {
- clearVectors();
- return false;
- }
-
- if(groupInMemory_)
- flag = fillSTONoGrouped(sto);
- else
- flag = fillSTOGrouped(sto);
-
- if((flag==false) || (!params_->loadGeom()))
- return flag;
-
- for(unsigned int i=1; i<portals_.size(); ++i)
- flag = fillGeomSTO(sto, i);
-
- updateBox(params_->box(), sto.getGeometries().getBox());
- return flag;
-}
-
-int
-TeQuerierDBStr1::numElemInstances()
-{
- //from clause has the geom table
- if(params_->loadGeom() || params_->hasSpatialRes())
- {
- //load the attribute tables
- TeAttrTableVector atts;
- params_->theme()->getAttTables(atts);
- if(atts.empty())
- return 0;
-
- string selectClause = " DISTINCT ";
- for(unsigned int i=0; i<atts.size(); ++i)
- {
- if(i>0)
- selectClause+= ",";
- selectClause+= atts[i].name() +"."+ atts[i].linkName();
-
- if(atts[i].linkName()!=atts[i].uniqueName())
- selectClause+= ","+ atts[i].name() +"."+ atts[i].uniqueName();
- }
-
- string sql = "SELECT "+ selectClause + fromClause_;
- if(!whereClause_.empty())
- sql += " WHERE "+ whereClause_;
-
- TeDatabasePortal* portal = params_->theme()->layer()->database()->getPortal();
- if(!portal)
- return 0;
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete (portal);
- return 0;
- }
- int result = portal->numRows();
- delete portal;
- return result;
- }
-
- if((portals_.empty()))
- return 0;
-
- //get the first portal
- if(!portals_[0])
- return 0;
-
- return (portals_[0]->numRows());
-}
-
-
-
-
diff --git a/src/terralib/kernel/TeQuerierDBStr1.h b/src/terralib/kernel/TeQuerierDBStr1.h
deleted file mode 100644
index 7f71719..0000000
--- a/src/terralib/kernel/TeQuerierDBStr1.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-/*! \file TeQuerierDBStr1.h
- \brief This file contains a mechanism named "TeQuerierDBStr1" that is
- responsible for loading spatio-temporal elements from a TerraLib database.
-*/
-
-#ifndef __TERRALIB_INTERNAL_QUERIER_DBSTR1_H
-#define __TERRALIB_INTERNAL_QUERIER_DBSTR1_H
-
-#include "TeQuerierDB.h"
-
-/*! \class TeQuerierDBStr1
- \brief A class responsible for loading spatio-temporal elements from a TerraLib database.
-
- This class implements a mechanism that is responsible for loading
- spatio-temporal elements from a TerraLib database, following a specific strategy.
- Each spatio-temporal elements is represented through a TeSTInstance class.
- This class is internally used by the factory of queriers. It should NOT be used
- by anyone.
-
- \sa
- TeQuerierDB TeQuerierParams TeSTInstance
-*/
-class TL_DLL TeQuerierDBStr1 : public TeQuerierDB
-{
-private:
- vector<string> uniqueNames_;
- string lastObjId_;
- int geomId_;
- bool isGroup_; //! if the portal was built with statistics sql funcionts
- bool groupInMemory_; //! if it must group the object instances in the memory
- string linkName_;
-
- string fromClause_; //store the sql clause(from and where) to return the number of instances
- string whereClause_;
-
- /* @name Internal functions to initialize portals */
- //@{
- bool initPortal(TeRepresentation& rep, TeTSEntry* ent=0);
- bool initGeomPortal(TeRepresentation& rep, TeTSEntry* ent=0);
- //@}
-
- /* @name Internal functions to fill the STOs from portals */
- //@{
- bool fillSTOGrouped(TeSTInstance& sto, bool fetchInstance = true);
- bool fillSTONoGrouped(TeSTInstance& sto);
- bool fillGeomSTO(TeSTInstance& sto, unsigned int index);
- //@}
-
-public:
- //! Constructor
- TeQuerierDBStr1(TeQuerierParams* params) :
- TeQuerierDB(params),
- lastObjId_(""),
- isGroup_(false),
- groupInMemory_(false),
- linkName_(""),
- fromClause_(""),
- whereClause_("")
- {}
-
- //! Loads instances
- bool loadInstances(TeTSEntry* ent=0);
-
- //! Returns each loaded instance
- bool fetchInstance(TeSTInstance& sto);
-
- //! Returns the number of instances
- int numElemInstances();
-};
-
-/*! \class TeQuerierDBStr1Factory
- \brief A class that define a factory to build a querier strategy (strategy 1) from TerraLib database.
-
- \sa
- TeQuerierImplFactory TeQuerierDBStr1
-*/
-class TL_DLL TeQuerierDBStr1Factory : public TeQuerierImplFactory
-{
-public:
- //! Constructor
- TeQuerierDBStr1Factory(const string& name) : TeQuerierImplFactory(name) {}
-
- //! Builds a database querier
- virtual TeQuerierImpl* build (const TeQuerierParams& arg)
- {
- TeQuerierParams* tempArg = new TeQuerierParams();
- *tempArg = arg;
- return new TeQuerierDBStr1(tempArg);
- }
-};
-
-//! Creates a static factory to build TeQuerierDBStr1
-namespace
-{
- static TeQuerierDBStr1Factory querierDBStr1("querierDBStr1");
-};
-
-
-#endif
-
diff --git a/src/terralib/kernel/TeQuerierDBStr2.cpp b/src/terralib/kernel/TeQuerierDBStr2.cpp
deleted file mode 100644
index 13b41bb..0000000
--- a/src/terralib/kernel/TeQuerierDBStr2.cpp
+++ /dev/null
@@ -1,350 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeQuerierDBStr2.h"
-#include "TeDatabase.h"
-#include "TeSTInstance.h"
-
-//It must group the attributes of ONE attribute table using DBMS functions
-// and do not load geometries. It must be used with theme (with collection table).
-bool
-TeQuerierDBStr2::initPortal(TeTSEntry* ent)
-{
- string selectClause, fromClause, whereClause, groupByClause;
- string initialTime, finalTime;
- linkIndex_.clear();
- linkIndex_.push_back(-1);
- attrIndex1_=-1;
- attrIndex2_=-1;
- timeIndex1_.clear();
- timeIndex1_.push_back(-1);
- timeIndex2_.clear();
- timeIndex2_.push_back(-1);
- groupIndex_=-1;
-
- TeDatabase* db = params_->theme()->layer()->database();
-
- if(params_->groupAttr().empty())
- return false;
-
- //get the table name (there is only one attribute table)
- string tableName;
- TeGroupingAttr groupAttr = params_->groupAttr();
- TeGroupingAttr::iterator it = groupAttr.begin();
- size_t pos = (it->first.name_).find(".", 0, 1);
- if (pos != string::npos)
- tableName = (it->first.name_).substr(0,pos);
-
- //group information
- legendIdGroup_.clear();
- legendIdGroup_[0]=0;
- TeLegendEntryVector& legVec = params_->theme()->legend();
- for(unsigned int l=0; l<legVec.size(); ++l)
- legendIdGroup_[legVec[l].id()]=legVec[l].group();
-
- clearVectors();
-
- // --------------------------------------------- Mount SQL
-
- //------- Select and Group By clause
- //load the attribute table
- int index = -1;
- TeAttrTableVector attr = params_->theme()->attrTables();
- for(unsigned int i=0; i<attr.size(); ++i)
- {
- if(TeConvertToUpperCase(attr[i].name()) == TeConvertToUpperCase(tableName))
- {
- index = i;
- attrTable_ = attr[i];
- break;
- }
- }
-
- //not find the table
- if(index<0)
- return false;
-
- //verify the attribute table
- if((ent) && (attrTable_.tableType()!=TeAttrEvent) && (attrTable_.tableType()!=TeFixedGeomDynAttr))
- return false;
-
- //object_id
- string linkName;
- if(attrTable_.tableType() != TeAttrExternal)
- linkName = attrTable_.name() +"."+ attrTable_.linkName();
- else
- linkName = params_->theme()->collectionTable() +".c_object_id ";
-
- if(params_->hasSpatialRes())
- selectClause = " MIN("+ linkName +")";
- else
- selectClause = linkName;
- linkIndex_[0]=0;
-
- if(ent)
- {
- //date
- initialTime = attrTable_.name() +"."+ attrTable_.attInitialTime();
-
- groupByClause = db->getSQLTemporalFunction(params_->chronon(), initialTime);
- if(!params_->hasSpatialRes())
- groupByClause += ","+ linkName;
-
- selectClause += ", MAX("+ initialTime +")";
- timeIndex1_[0]=1;
- timeIndex2_[0]=1;
- }
- else
- groupByClause = linkName;
-
-
- //statistic
- selectClause += ","+ db->getSQLStatistics(groupAttr);
- if(timeIndex1_[0]<0)
- attrIndex1_=1;
- else
- attrIndex1_=2;
- attrIndex2_ = attrIndex1_+(params_->groupAttr().size()-1);
-
- //group index
- selectClause += ", MIN("+ params_->theme()->collectionTable()+".c_legend_id )";
- groupIndex_ = attrIndex2_+1;
-
- //---- from clause
- if(params_->hasSpatialRes())
- {
- groupByClause = ""; //It groups all attributes from all objects
- string gTable = params_->theme()->layer()->tableName(params_->geomRepRest());
- fromClause = this->sqlFrom(gTable);
- }
- else
- fromClause = this->sqlFrom();
-
- if(fromClause.empty())
- return false;
-
- //where clause
- if(!params_->objId().empty())
- whereClause = linkName +" = '"+ params_->objId() +"'";
-
- //---------- querier restriction
- string sqlQuerierRest = sqlWhereRestrictions();
- if(!whereClause.empty())
- whereClause += " AND ";
-
- whereClause += sqlQuerierRest;
-
- //----------
-
- string sql = " SELECT "+ selectClause;
- sql += " FROM "+ fromClause;
- if(!whereClause.empty())
- sql += " WHERE "+ whereClause;
- if(!groupByClause.empty())
- sql += " GROUP BY "+ groupByClause;
-
- // --------------------------------------------- Submit the query
-
- portals_.clear();
- TeDatabasePortal* portal = db->getPortal();
-
- if(!portal)
- return false;
-
- if(!portal->query(sql))
- {
- delete (portal);
- flagPortal_ = false;
- return false;
- }
-
- if(!portal->fetchRow())
- {
- delete (portal);
- flagPortal_ = false;
- return false;
- }
-
- string id = portal->getData(linkIndex_[0]); //object_Id
- bool flag = true;
- while(id.empty() && flag)
- {
- flag = portal->fetchRow();
- if(flag)
- id = portal->getData(linkIndex_[0]); //object_Id
- }
-
- if(id.empty() || (!flag)) //se o id �vazio ou chegou ao final do portal
- {
- delete (portal);
- flagPortal_ = false;
- return false;
- }
-
- portals_.push_back (portal);
- flagPortal_ = true;
- return true;
-}
-
-
-bool
-TeQuerierDBStr2::fillSTO(TeSTInstance& sto)
-{
- if(portals_.empty())
- return false;
-
- TeDatabasePortal* portal = portals_[0];
- if(!portal)
- return false;
-
- if(!flagPortal_) // end of portal
- {
- clearVectors();
- return false;
- }
-
- if(TSEntry_.timeFrame_ > -1)
- {
- // first : verify the time
- TeTime t1 = portal->getDate(timeIndex1_[0]);
- t1.chronon ((TSEntry_.time_).intervalChronon());
-
- //if the time is before the requested interval
- while ( (TSEntry_.time_).before(t1) && flagPortal_)
- {
- flagPortal_ = portal->fetchRow();
- t1 = portal->getDate(timeIndex1_[0]);
- t1.chronon ((TSEntry_.time_).intervalChronon());
- }
-
- if(!(TSEntry_.time_).during(t1))
- return false;
-
- TeTimeInterval interval(t1, t1);
- sto.timeInterval(interval);
-
- timeFramePortal_ = (TSEntry_.timeFrame_)+1; //next time frame
- }
-
- //if there is spatial restriction, it groups all instances of all objects
- if(!params_->hasSpatialRes())
- {
- // get object_id
- string objId = string(portal->getData(linkIndex_[0])); // 0: object_id
- sto.objectId (objId);
- sto.addUniqueId (objId);
-
- //get the group index
- if(groupIndex_!=-1)
- {
- int gIndex = portal->getInt(groupIndex_);
- sto.setSlice(legendIdGroup_[gIndex]);
- }
- }
-
- //get property
- for(int s=attrIndex1_; s<=attrIndex2_; ++s)
- sto.addPropertyValue(string(portal->getData(s)));
-
- sto.setAttrList(attrList_);
- flagPortal_ = portal->fetchRow();
- return true;
-}
-
-
-bool
-TeQuerierDBStr2::loadInstances(TeTSEntry* ent)
-{
- if(!params_->theme())
- return false;
-
- //set a invalid box
- TeBox box;
- params_->box(box);
-
- if(ent)
- {
- //if the portal was not initialised (timeFramePortal_==-1) or
- //if the time frame requested is lesser than the time frame appointed by the portal
- if((timeFramePortal_<0) || (ent->timeFrame_<timeFramePortal_))
- {
- if(!initPortal(ent))
- return false;
-
- timeFramePortal_ = 0;
- }
- TSEntry_ = (*ent);
- }
- else // no chronon
- {
- if(!initPortal())
- return false;
-
- timeFramePortal_ = -1;
- }
-
- attrList_->clear();
- TeAttribute at;
- TeGroupingAttr::iterator it = params()->groupAttr().begin();
- while(it!=params()->groupAttr().end())
- {
- TeAttribute at;
- at.rep_ = it->first;
- attrList_->push_back (at);
- ++it;
- }
-
- return true;
-}
-
-bool
-TeQuerierDBStr2::fetchInstance(TeSTInstance& sto)
-{
- sto.clear();
-
- if(!fillSTO(sto))
- return false;
-
- //build a temporal serie to one object
- string val;
- sto.getPropertyValue(val, 0);
- if((ts_) && (ts_->setTSEntryValue(TSEntry_.timeFrame_, atof(val.c_str()), TeDATA)))
- filledSerie_ = true;
-
- return true;
-}
-
-int
-TeQuerierDBStr2::numElemInstances()
-{
- if((portals_.empty()))
- return 0;
-
- //get the first portal
- if(!portals_[0])
- return 0;
-
- return (portals_[0]->numRows());
-}
-
-
diff --git a/src/terralib/kernel/TeQuerierDBStr2.h b/src/terralib/kernel/TeQuerierDBStr2.h
deleted file mode 100644
index 3127c71..0000000
--- a/src/terralib/kernel/TeQuerierDBStr2.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeQuerierDBStr2.h
- \brief This file contains a mechanism named "TeQuerierDBStr2" that is
- responsible for loading spatio-temporal elements from a TerraLib database.
-*/
-
-#ifndef __TERRALIB_INTERNAL_QUERIER_DBSTR2_H
-#define __TERRALIB_INTERNAL_QUERIER_DBSTR2_H
-
-#include "TeQuerierDB.h"
-#include "TeTemporalSeries.h"
-
-/*! \class TeQuerierDBStr2
- \brief A class responsible for loading spatio-temporal elements from a TerraLib database.
-
- This class implements a mechanism that is responsible for loading
- spatio-temporal elements from a TerraLib database, following a specific strategy (Strategy 2).
- Each spatio-temporal elements is represented through a TeSTInstance class.
- This class is internally used by the factory of queriers. It should NOT be used
- by anyone. This Strategy 2 works with simple chronon, without geometry,
- theme with collection table and existence operator in the DBMS.
-
- \sa
- TeQuerierDB TeQuerierParams TeSTInstance
-*/
-
-class TL_DLL TeQuerierDBStr2: public TeQuerierDB
-{
-private:
- int timeFramePortal_; // the time frame appointed by the portal
- TeTSEntry TSEntry_;
-
- /* @name Internal functions to initialize portals */
- //@{
- bool initPortal(TeTSEntry* ent=0);
- //@}
-
- //! Internal function to fill STO
- bool fillSTO(TeSTInstance& sto);
-
-public:
- //! Constructor
- TeQuerierDBStr2(TeQuerierParams* params):
- TeQuerierDB(params),
- timeFramePortal_(-1)
- {}
-
- //! Loads the instances
- bool loadInstances(TeTSEntry* ent=0);
-
- //! Returns each loaded STO
- bool fetchInstance(TeSTInstance& sto);
-
- //! Returns the number of instances
- int numElemInstances();
-};
-
-/*! \class TeQuerierDBStr2Factory
- \brief A class that define a factory to build a querier strategy (strategy 2) from TerraLib database.
-
- \sa
- TeQuerierImplFactory TeQuerierDBStr2
-*/
-class TL_DLL TeQuerierDBStr2Factory : public TeQuerierImplFactory
-{
-public:
- //! Constructor
- TeQuerierDBStr2Factory(const string& name) : TeQuerierImplFactory(name) {}
-
- //! Builds a database querier
- virtual TeQuerierImpl* build (const TeQuerierParams& arg)
- {
- TeQuerierParams* tempArg = new TeQuerierParams();
- *tempArg = arg;
- return new TeQuerierDBStr2(tempArg);
- }
-};
-
-//! Creates a static factory to build TeQuerierDBStr2
-namespace
-{
- static TeQuerierDBStr2Factory querierDBStr2("querierDBStr2");
-};
-
-#endif
diff --git a/src/terralib/kernel/TeQuerierDBStr3.cpp b/src/terralib/kernel/TeQuerierDBStr3.cpp
deleted file mode 100644
index 55d7dcc..0000000
--- a/src/terralib/kernel/TeQuerierDBStr3.cpp
+++ /dev/null
@@ -1,421 +0,0 @@
- /************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include <TeQuerierDBStr3.h>
-#include <TeDatabase.h>
-#include <TeSTInstance.h>
-#include <TeLayer.h>
-
-//It must group the attributes of ONE attribute table and
-//load geometries of ONE representation (cells or points)
-//It must be used with theme (with collection table)
-bool
-TeQuerierDBStr3::initPortal(TeTSEntry* ent)
-{
- string selectClause, fromClause, whereClause, groupByClause;
- string initialTime, finalTime;
- linkIndex_.clear();
- linkIndex_.push_back(-1);
- attrIndex1_=-1;
- attrIndex2_=-1;
- timeIndex1_.clear();
- timeIndex1_.push_back(-1);
- timeIndex2_.clear();
- timeIndex2_.push_back(-1);
- geomIndex1_.clear();
- geomIndex1_.push_back(-1);
- groupIndex_=-1;
-
- TeDatabase* db = params_->theme()->layer()->database();
-
- if(params_->groupAttr().empty())
- return false;
-
- //get the table name
- string tableName;
- TeGroupingAttr groupAttr = params_->groupAttr();
- TeGroupingAttr::iterator it = groupAttr.begin();
- size_t pos = (it->first.name_).find(".", 0, 1);
- if (pos != string::npos)
- tableName = (it->first.name_).substr(0,pos);
-
- //group information
- legendIdGroup_.clear();
- legendIdGroup_[0]=0;
- TeLegendEntryVector& legVec = params_->theme()->legend();
- for(unsigned int l=0; l<legVec.size(); ++l)
- legendIdGroup_[legVec[l].id()]=legVec[l].group();
-
- clearVectors();
-
- // --------------------------------------------- Monut SQL
-
- //------- Select and Group By clause
-
- //load the attribute table
- int index = -1;
- unsigned int i=0;
- TeAttrTableVector attr = params_->theme()->attrTables();
- for(i=0; i<attr.size(); ++i)
- {
- if(TeConvertToUpperCase(attr[i].name()) == TeConvertToUpperCase(tableName))
- {
- index = i;
- attrTable_ = attr[i];
- break;
- }
- }
-
- //not find the table
- if(index<0)
- return false;
-
- //verify the attribute table
- if((ent) && (attrTable_.tableType()!=TeAttrEvent) && (attrTable_.tableType()!=TeFixedGeomDynAttr))
- return false;
-
- //geometric Table
- TeAttributeList geomTableAttrs;
- string geomTable;
- if(params_->theme()->layer()->hasGeometry(TePOINTS))
- {
- geomTable = params_->theme()->layer()->tableName(TePOINTS);
- if(!db->getAttributeList(geomTable, geomTableAttrs))
- return false;
- rep_ = TePOINTS;
- }
- else if (params_->theme()->layer()->hasGeometry(TeCELLS))
- {
- geomTable = params_->theme()->layer()->tableName(TeCELLS);
- if(!db->getAttributeList(geomTable, geomTableAttrs))
- return false;
- rep_ = TeCELLS;
- }
- else
- return false; //this strategy is valid only for cells and point geometry
-
- //object_id
- string linkName = attrTable_.name() +"."+ attrTable_.linkName(); //geomTable.name()+ ".object_id ";
- string uniqueIdName = attrTable_.name() +"."+ attrTable_.uniqueName();
-
- if(params_->hasSpatialRes())
- selectClause = " MIN("+ linkName +")";
- else
- selectClause = linkName;
- linkIndex_[0]=0;
-
- if(ent)
- {
- //date
- initialTime = attrTable_.name() +"."+ attrTable_.attInitialTime();
-
- groupByClause = db->getSQLTemporalFunction(params_->chronon(), initialTime);
- if(!params_->hasSpatialRes())
- groupByClause += ","+ linkName;
-
- selectClause += ", MAX("+ initialTime +")";
- timeIndex1_[0]=1;
- timeIndex2_[0]=1;
- }
- else if(!params_->hasSpatialRes())
- groupByClause = linkName;
-
- //statistic
- selectClause += ","+ db->getSQLStatistics(groupAttr);
- if(timeIndex1_[0]<0)
- attrIndex1_=1;
- else
- attrIndex1_=2;
- attrIndex2_ = attrIndex1_+(params_->groupAttr().size()-1);
-
- //group index
- selectClause += ", MIN("+ params_->theme()->collectionTable()+".c_legend_id )";
- groupIndex_ = attrIndex2_+1;
-
- //----- insert geometrical information in the select clause
- for(i=0; i<geomTableAttrs.size(); ++i)
- selectClause += ", MIN( "+ geomTable +"."+ geomTableAttrs[i].rep_.name_ +" ) AS "+ geomTableAttrs[i].rep_.name_;
- geomIndex1_[0] = attrIndex2_+2;
- //-----
-
- //------- From clause
- fromClause = this->sqlFrom(geomTable);
- if(fromClause.empty())
- return false;
-
- //where clause
- if(!params_->objId().empty())
- whereClause = linkName +" = '"+ params_->objId() +"'";
-
- //---------- querier restriction
- TeRepresentation rep;
- rep.tableName_ = geomTable;
- rep.geomRep_ = rep_;
-
- string sqlQuerierRest = sqlWhereRestrictions(&rep);
- if(!whereClause.empty())
- whereClause += " AND ";
-
- whereClause += sqlQuerierRest;
-
- //----------
- fromClause_ = fromClause;
- whereClause_ = whereClause;
-
- string sql = " SELECT "+ selectClause;
- sql += " FROM "+ fromClause;
- if(!whereClause.empty())
- sql += " WHERE "+ whereClause;
- if(!groupByClause.empty())
- sql += " GROUP BY "+ groupByClause;
-
- // --------------------------------------------- Submit the query
-
- portals_.clear();
- TeDatabasePortal* portal = db->getPortal();
-
- if(!portal)
- return false;
-
- if(!portal->query(sql))
- {
- delete (portal);
- flagPortal_ = false;
- return false;
- }
-
- if(!portal->fetchRow())
- {
- delete (portal);
- flagPortal_ = false;
- return false;
- }
-
- string id = portal->getData(linkIndex_[0]); //object_Id
- bool flag = true;
- while(id.empty() && flag)
- {
- flag = portal->fetchRow();
- if(flag)
- id = portal->getData(linkIndex_[0]); //object_Id
- }
-
- if(id.empty() || (!flag))
- {
- delete (portal);
- flagPortal_ = false;
- return false;
- }
-
- portals_.push_back (portal);
- flagPortal_ = true;
- return true;
-}
-
-
-bool
-TeQuerierDBStr3::fillSTO(TeSTInstance& sto)
-{
- if(portals_.empty())
- return false;
-
- TeDatabasePortal* portal = portals_[0];
- if(!portal)
- return false;
-
- if(!flagPortal_) //end of portal
- {
- clearVectors();
- return false;
- }
-
-
- // first : verify the time
- if(TSEntry_.timeFrame_ > -1)
- {
- TeTime t1 = portal->getDate(timeIndex1_[0]);
- t1.chronon ((TSEntry_.time_).intervalChronon());
-
- //if the time is before the requested interval
- while ( (TSEntry_.time_).before(t1) && flagPortal_)
- {
- flagPortal_ = portal->fetchRow();
- t1 = portal->getDate(timeIndex1_[0]);
- t1.chronon ((TSEntry_.time_).intervalChronon());
- }
-
- if(!(TSEntry_.time_).during(t1))
- return false;
-
- TeTimeInterval interval(t1, t1);
- sto.timeInterval(interval);
-
- timeFramePortal_ = (TSEntry_.timeFrame_)+1; //next time frame
- }
-
- //if there is spatial restriction, it groups all instances of all objects
- if(!params_->hasSpatialRes())
- {
- // get object_id
- string objId = string(portal->getData(linkIndex_[0])); // 0: object_id
- sto.objectId (objId);
- sto.addUniqueId (objId);
-
- //get the group index
- if(groupIndex_!=-1)
- {
- int gIndex = portal->getInt(groupIndex_);
- sto.setSlice(legendIdGroup_[gIndex]);
- }
- }
-
- sto.setAttrList(attrList_);
-
- //get property
- for(int s=attrIndex1_; s<=attrIndex2_; ++s)
- sto.addPropertyValue(portal->getData(s));
-
- // get geometry
- if(rep_ == TePOINTS)
- {
- TePoint point;
- flagPortal_ = portal->fetchGeometry(point,geomIndex1_[0]);
- sto.addGeometry (point);
- }
- else
- {
- TeCell cell;
- flagPortal_ = portal->fetchGeometry(cell, geomIndex1_[0]);
- sto.addGeometry (cell);
- }
-
- return true;
-}
-
-
-bool
-TeQuerierDBStr3::loadInstances(TeTSEntry* ent)
-{
- if(!params_->theme())
- return false;
-
- //set a invalid box
- TeBox box;
- params_->box(box);
-
- if(ent)
- {
- //if the portal was not initialised (timeFramePortal_==-1) or
- //if the time frame requested is lesser than the time frame appointed by the portal
- if((timeFramePortal_<0) || (ent->timeFrame_<timeFramePortal_))
- {
- if(!initPortal(ent))
- return false;
-
- timeFramePortal_ = 0;
- }
- TSEntry_ = (*ent);
- }
- else // no chronon
- {
- if(!initPortal())
- return false;
-
- timeFramePortal_ = -1;
- }
-
- attrList_->clear();
- TeAttribute at;
- TeGroupingAttr::iterator it = params()->groupAttr().begin();
- while(it!=params()->groupAttr().end())
- {
- TeAttribute at;
- at.rep_ = it->first;
- attrList_->push_back (at);
- ++it;
- }
-
- return true;
-}
-
-
-bool
-TeQuerierDBStr3::fetchInstance(TeSTInstance& sto)
-{
- sto.clear();
-
- if(!fillSTO(sto))
- return false;
-
- //build a temporal serie to one object
- string val;
- sto.getPropertyValue(val, 0);
- if((ts_) && (ts_->setTSEntryValue(TSEntry_.timeFrame_, atof(val.c_str()), TeDATA)))
- filledSerie_ = true;
-
- updateBox(params_->box(), sto.getGeometries().getBox());
- return true;
-}
-
-int
-TeQuerierDBStr3::numElemInstances()
-{
- //load the attribute tables
- TeAttrTableVector atts;
- params_->theme()->getAttTables(atts);
- if(atts.empty())
- return 0;
-
- string selectClause = " DISTINCT ";
- for(unsigned int i=0; i<atts.size(); ++i)
- {
- if(i>0)
- selectClause+= ",";
- selectClause+= atts[i].name() +"."+ atts[i].linkName();
-
- if(atts[i].linkName()!=atts[i].uniqueName())
- selectClause+= ","+ atts[i].name() +"."+ atts[i].uniqueName();
- }
-
- string sql = "SELECT "+ selectClause + fromClause_;
- if(!whereClause_.empty())
- sql += " WHERE "+ whereClause_;
-
- TeDatabasePortal* portal = params_->theme()->layer()->database()->getPortal();
- if(!portal)
- return 0;
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete (portal);
- return 0;
- }
- int result = portal->numRows();
- delete portal;
- return result;
-}
-
-
-
-
-
diff --git a/src/terralib/kernel/TeQuerierDBStr3.h b/src/terralib/kernel/TeQuerierDBStr3.h
deleted file mode 100644
index 7836ed9..0000000
--- a/src/terralib/kernel/TeQuerierDBStr3.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeQuerierDBStr3.h
- \brief This file contains a mechanism named "TeQuerierDBStr3" that is
- responsible for loading spatio-temporal elements from a TerraLib database.
-*/
-#ifndef __TERRALIB_INTERNAL_QUERIER_DBSTR3_H
-#define __TERRALIB_INTERNAL_QUERIER_DBSTR3_H
-
-#include "TeQuerierDB.h"
-#include "TeTemporalSeries.h"
-
-/*! \class TeQuerierDBStr3
- \brief A class responsible for loading spatio-temporal elements from a TerraLib database.
-
- This class implements a mechanism that is responsible for loading
- spatio-temporal elements from a TerraLib database, following a specific strategy (Strategy 3).
- Each spatio-temporal elements is represented through a TeSTInstance class.
- This class is internally used by the factory of queriers. It should NOT be used
- by anyone. This Strategy 2 works with simple chronon, with geometry (points or cells),
- theme with collection table and existence operator in the DBMS.
-
- \sa
- TeQuerierDB TeQuerierParams TeSTInstance
-*/
-
-class TL_DLL TeQuerierDBStr3: public TeQuerierDB
-{
-private:
- int timeFramePortal_; // the time frame appointed by the portal
- TeTSEntry TSEntry_;
- TeGeomRep rep_;
-
- string fromClause_; //store the sql clause(from and where) to return the number of instances
- string whereClause_;
-
- /* @name Internal functions to initialize portals */
- //@{
- bool initPortal(TeTSEntry* ent=0);
- //@}
-
- //! Internal function to fill STO
- bool fillSTO(TeSTInstance& sto);
-
-public:
- //! Constructor
- TeQuerierDBStr3(TeQuerierParams* params):
- TeQuerierDB(params),
- timeFramePortal_(-1),
- fromClause_(""),
- whereClause_("")
- {}
-
- //! Loads the instances
- bool loadInstances(TeTSEntry* ent=0);
-
- //! Returns each loaded STO
- bool fetchInstance(TeSTInstance& sto);
-
- //! Returns the number of instances
- int numElemInstances();
-};
-
-/*! \class TeQuerierDBStr3Factory
- \brief A class that define a factory to build a querier strategy (strategy 3) from TerraLib database.
-
- \sa
- TeQuerierImplFactory TeQuerierDBStr3
-*/
-class TL_DLL TeQuerierDBStr3Factory : public TeQuerierImplFactory
-{
-public:
-
- //! Constructor
- TeQuerierDBStr3Factory(const string& name) : TeQuerierImplFactory(name) {}
-
- //! Builds a database querier
- virtual TeQuerierImpl* build (const TeQuerierParams& arg)
- {
- TeQuerierParams* tempArg = new TeQuerierParams();
- *tempArg = arg;
- return new TeQuerierDBStr3(tempArg);
- }
-};
-
-//! Creates a static factory to build TeQuerierDBStr3
-namespace
-{
- static TeQuerierDBStr3Factory querierDBStr3("querierDBStr3");
-};
-
-#endif
diff --git a/src/terralib/kernel/TeQuerierImpl.cpp b/src/terralib/kernel/TeQuerierImpl.cpp
deleted file mode 100644
index 46b993b..0000000
--- a/src/terralib/kernel/TeQuerierImpl.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeQuerierImpl.h"
-#include "TeTemporalSeries.h"
-
-
-TeQuerierImpl::TeQuerierImpl(TeQuerierParams* par): params_(par), filledSerie_(false)
-{
- TeAttributeList* att = new TeAttributeList();
- attrList_ = TeSharedPtr<TeAttributeList>(att);
- ts_ = 0;
- if(par->chronon()!=TeNOCHRONON) //if there is a chronon, build ts
- {
- TeGroupingAttr::iterator it = par->groupAttr().begin();
- if(it!=par->groupAttr().end())
- ts_ = new TeTemporalSeries(par->theme(), par->objId(), par->chronon(), it->first.name_, it->first.name_, it->second, it->second);
- else
- ts_ = new TeTemporalSeries(par->chronon(), par->theme());
- ts_->buildFrameIntervals();
- }
-}
-
-TeQuerierImpl::TeQuerierImpl( const TeQuerierImpl& other)
-{
- if(ts_)
- delete ts_;
-
- if(params_)
- delete params_;
-
- ts_ = 0;
- params_ = 0;
- if(other.params_)
- {
- params_ = new TeQuerierParams();
- *params_ = *(other.params_);
- }
- filledSerie_ = other.filledSerie_;
- attrList_ = other.attrList_;
-}
-
-TeQuerierImpl&
-TeQuerierImpl::operator= (const TeQuerierImpl& other)
-{
- if ( this != &other )
- {
- if(ts_)
- delete ts_;
-
- if(params_)
- delete params_;
-
- ts_ = 0;
- params_ = 0;
- if(other.params_)
- {
- params_ = new TeQuerierParams();
- *params_ = *(other.params_);
- }
- filledSerie_ = other.filledSerie_;
- attrList_ = other.attrList_;
- }
- return *this;
-}
-
-TeQuerierImpl::~TeQuerierImpl()
-{
- if(ts_)
- delete (ts_);
-
- if(params_)
- delete params_;
-}
-
-bool
-TeQuerierImpl::loadTimeFrameInstances(int frame)
-{
- if(frame>-1)
- {
- TeTSEntry ent;
- if(!getTSEntry(ent, frame))
- return false;
-
- return(loadInstances(&ent));
- }
- else
- return(loadInstances());
-}
-
-bool
-TeQuerierImpl::getTSEntry(TeTSEntry& tsEntry, int frame)
-{
- if(!ts_)
- return false;
-
- return(ts_->getTSEntry(tsEntry, frame));
-}
-
-int
-TeQuerierImpl::getNumTimeFrames()
-{
- if(!ts_)
- return 0;
-
- return (ts_->numTimeFrames());
-}
-
-bool
-TeQuerierImpl::getTS(TeTemporalSeries& ts)
-{
- if(!ts_)
- return false;
-
- ts = (*ts_);
- return true;
-}
-
-TeTSParams&
-TeQuerierImpl::getTSParams()
-{
- return (ts_->TSparams_);
-}
-
diff --git a/src/terralib/kernel/TeQuerierImpl.h b/src/terralib/kernel/TeQuerierImpl.h
deleted file mode 100644
index d675147..0000000
--- a/src/terralib/kernel/TeQuerierImpl.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeQuerierDB.h
- \brief This file deals an abstract querier class to build STOs (Spatial Temporal Objects)
-*/
-#ifndef __TERRALIB_INTERNAL_QUERIER_IMPL_H
-#define __TERRALIB_INTERNAL_QUERIER_IMPL_H
-
-#include "TeQuerierParams.h"
-#include "TeFactory.h"
-#include "TeSharedPtr.h"
-
-class TeTSEntry;
-class TeTSParams;
-class TeSTInstance;
-class TeTemporalSeries;
-class TeMultiGeometry;
-
-//! An abstract querier class to build STOs (Spatial Temporal Objects)
-class TL_DLL TeQuerierImpl
-{
-protected:
- //! querier parameters that define the used querier strategy
- TeQuerierParams* params_;
- TeTemporalSeries* ts_; //! temporal series
- bool filledSerie_; //! this flag indicates if the temporal serie was filled
- TeSharedPtr<TeAttributeList> attrList_; //! list of the attributes of the querier
-
-public:
- //! Constructor
- TeQuerierImpl(TeQuerierParams* par);
-
- //! Copy constructor
- TeQuerierImpl( const TeQuerierImpl& other);
-
- //! Operator =
- TeQuerierImpl& operator= (const TeQuerierImpl& other);
-
- //! Destructor
- virtual ~TeQuerierImpl();
-
- //! Returns the object identifier
- string objectId() { return params_->objId();}
-
- //! Returns the theme pointer
- TeTheme* theme() { return params_->theme();}
-
- //! Loads the STOs
- bool loadTimeFrameInstances(int frame=-1);
-
- //! Gets each temporal serie entry, for each time frame
- bool getTSEntry(TeTSEntry& tsEntry, int frame);
-
- //! Gets the number of generated time frames
- int getNumTimeFrames();
-
- //! Gets the full temporal serie
- bool getTS(TeTemporalSeries& ts);
-
- //! Returns the temporal serie params
- TeTSParams& getTSParams();
-
- //! Gets the attribute list from querier
- TeAttributeList getAttrList() { return (*attrList_); }
-
- //! Returns a default object
- static TeQuerierImpl* DefaultObject(const TeQuerierParams& /*params*/) { return 0; }
-
- //! Returns the querier parameters
- TeQuerierParams* params() { return params_; }
-
- //! Loads the STOs
- virtual bool loadInstances(TeTSEntry* ent=0) = 0;
-
- //! Returns each loaded STO
- virtual bool fetchInstance(TeSTInstance& stoi)= 0;
-
- //! Loads all geometries of the index-th geometry representation
- virtual bool loadGeometries(TeMultiGeometry& geometries, unsigned int& index) = 0;
-
- //! Loads all geometries
- virtual bool loadGeometries(TeMultiGeometry& geometries) = 0;
-
- //! Returns the number of instances to each time frame
- virtual int numElemInstances() { return 0;}
-
- //! Empties querier instances
- virtual void clear() { return; }
-};
-
-//! A class that define a factory to build querier strategies
-class TL_DLL TeQuerierImplFactory : public TeFactory<TeQuerierImpl, TeQuerierParams>
-{
-public:
- //! Builds an appropriate decoder from a identifier
- TeQuerierImplFactory(const string& name) : TeFactory<TeQuerierImpl, TeQuerierParams>(name) { }
-
- //! Destructor
- virtual ~TeQuerierImplFactory() {}
-};
-
-#endif
diff --git a/src/terralib/kernel/TeQuerierParams.cpp b/src/terralib/kernel/TeQuerierParams.cpp
deleted file mode 100644
index 8e07106..0000000
--- a/src/terralib/kernel/TeQuerierParams.cpp
+++ /dev/null
@@ -1,286 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeQuerierParams.h"
-#include "TeDatabase.h"
-
-TeQuerierParams::~TeQuerierParams()
-{
- if(themeFlag_)
- delete theme_;
-}
-
-TeQuerierParams::TeQuerierParams(const TeQuerierParams& rhs)
-{
- loadGeometries_ = rhs.loadGeometries_;
- loadAllAttributes_ = rhs.loadAllAttributes_;
- loadAttrNames_ = rhs.loadAttrNames_;
- loadAttrNamesSeted_ = rhs.loadAttrNamesSeted_;
- themeFlag_ = false;
- layer_ = rhs.layer_;
-
- if ((rhs.themeFlag_) && layer_)
- {
- theme_ = new TeTheme("theme_", layer_);
- TeAttrTableVector attrTables;
- layer_->getAttrTables(attrTables);
- theme_->setAttTables(attrTables);
- themeFlag_ = true;
- }
- else
- theme_ = rhs.theme_;
-
- fileName_ = rhs.fileName_;
- chr_ = rhs.chr_;
- objId_ = rhs.objId_;
- groupingAttr_ = rhs.groupingAttr_;
- strategy_ = rhs.strategy_;
-
- //restrictions
- selectedObjs_ = rhs.selectedObjs_;
- spatialRelation_ = rhs.spatialRelation_;
- hasSpatialRes_ = rhs.hasSpatialRes_;
- boxRest_ = rhs.boxRest_;
- geomRest_ = rhs.geomRest_;
- geomRepRest_ = rhs.geomRepRest_;
-}
-
-
-TeQuerierParams&
-TeQuerierParams::operator=(const TeQuerierParams& rhs)
-{
- if (&rhs != this)
- {
- loadGeometries_ = rhs.loadGeometries_;
- loadAllAttributes_ = rhs.loadAllAttributes_;
- loadAttrNames_ = rhs.loadAttrNames_;
- loadAttrNamesSeted_ = rhs.loadAttrNamesSeted_;
- themeFlag_ = false;
- layer_ = rhs.layer_;
-
- if ((rhs.themeFlag_) && layer_)
- {
- theme_ = new TeTheme("theme_", layer_);
- TeAttrTableVector attrTables;
- layer_->getAttrTables(attrTables);
- theme_->setAttTables(attrTables);
- themeFlag_ = true;
- }
- else
- theme_ = rhs.theme_;
-
- fileName_ = rhs.fileName_;
- chr_ = rhs.chr_;
- objId_ = rhs.objId_;
- groupingAttr_ = rhs.groupingAttr_;
- strategy_ = rhs.strategy_;
-
- //restrictions
- selectedObjs_ = rhs.selectedObjs_;
- spatialRelation_ = rhs.spatialRelation_;
- hasSpatialRes_ = rhs.hasSpatialRes_;
- boxRest_ = rhs.boxRest_;
- geomRest_ = rhs.geomRest_;
- geomRepRest_ = rhs.geomRepRest_;
- }
- return *this;
-}
-
-void
-TeQuerierParams::setParams(TeLayer* layer)
-{
- layer_ = layer;
- if(theme_ == 0)
- {
- theme_ = new TeTheme("theme_", layer_);
- TeAttrTableVector attrTables;
- theme_->layer(layer_);
- layer_->getAttrTables(attrTables);
- theme_->setAttTables(attrTables);
- themeFlag_ = true;
- }
- strategy_ = "querierDBStr1";
-}
-
-void
-TeQuerierParams::setParams(TeTheme* theme, TeChronon chr)
-{
- theme_ = theme;
- chr_ = chr;
- strategy_ = "querierDBStr1";
-
- bool geomRep = (theme_->layer()->hasGeometry (TeCELLS) || theme_->layer()->hasGeometry (TePOINTS));
- int numRepres = theme_->layer()->vectRepres().size();
-
- bool groupAttr = !(groupingAttr_.empty());
- bool hasOneTable = true;
-
- if(groupAttr)
- {
- string lastTable = "";
- TeGroupingAttr::iterator it = groupingAttr_.begin();
- while(it!=groupingAttr_.end())
- {
- string tableName;
- size_t pos = (it->first.name_).find(".", 0, 1);
- if (pos != string::npos)
- tableName = (it->first.name_).substr(0,pos);
-
- if((!lastTable.empty()) && (lastTable!=tableName))
- {
- hasOneTable = false;
- break;
- }
- lastTable = tableName;
- ++it;
- }
-
- //verify if the statistis can be calculated by SGBD
- TeGroupingAttr groups = groupingAttr_;
- string sGroup = theme->layer()->database()->getSQLStatistics(groups);
- TeGroupingAttr::iterator itgroup = groups.begin();
- while(itgroup!= groups.end())
- {
- if(itgroup->second != TeNOSTATISTIC)
- {
- strategy_ = "querierDBStr1";
- return;
- }
- ++itgroup;
- }
- }
-
- if( groupAttr && hasOneTable && (!loadGeom()))
- strategy_ = "querierDBStr2";
- else if( groupAttr && hasOneTable && loadGeom() && geomRep && (numRepres==1))
- strategy_ = "querierDBStr3";
-
- return;
-}
-
-void
-TeQuerierParams::setParams(TeTheme* theme, const string& objId, TeChronon chr)
-{
- objId_ = objId;
- setParams(theme, chr);
-}
-
-void
-TeQuerierParams::setParams(const string& fileName, TeChronon chr)
-{
- fileName_ = fileName;
- chr_ = chr;
- strategy_ = "querierSHP";
-}
-
-
-void
-TeQuerierParams::setFillParams(bool loadGeom, bool loadAllAttr, vector<string> loadAttr)
-{
- loadGeometries_ = loadGeom;
- loadAllAttributes_ = loadAllAttr;
-
- if(!loadAttr.empty())
- loadAllAttributes_ = false;
-
- loadAttrNames_ = loadAttr;
- loadAttrNamesSeted_ = loadAttr;
- groupingAttr_.clear();
-
- if(theme_)
- setParams(theme_, objId_, chr_);
-}
-
-void
-TeQuerierParams::setFillParams(bool loadGeom, TeGroupingAttr attrG)
-{
- loadGeometries_ = loadGeom;
- loadAttrNames_.clear();
- loadAttrNamesSeted_.clear();
- groupingAttr_ = attrG;
-
- if(theme_)
- setParams(theme_, objId_, chr_);
-}
-
-void
-TeQuerierParams::setSpatialRest(TeBox& box, int relation, TeGeomRep rep)
-{
- hasSpatialRes_ = true;
- boxRest_ = box;
- spatialRelation_ = relation;
-
- if(rep==TeGEOMETRYNONE)
- geomRepRest_ = theme_->layer()->vectRepres()[0]->geomRep_;
- else
- geomRepRest_ = rep;
-
- geomRest_ = 0;
-}
-
-void
-TeQuerierParams::setSpatialRest(TeGeometry* geom, int relation, TeGeomRep rep)
-{
- hasSpatialRes_ = true;
- geomRest_ = geom;
- spatialRelation_ = relation;
-
- if(rep==TeGEOMETRYNONE)
- geomRepRest_ = theme_->layer()->vectRepres()[0]->geomRep_;
- else
- geomRepRest_ = rep;
-
- boxRest_ = TeBox();
-}
-
-TeBox&
-TeQuerierParams::box()
-{
- return box_;
-}
-
-void
-TeQuerierParams::clear()
-{
- loadAttrNames_.clear();
- loadAttrNamesSeted_.clear();
- groupingAttr_.clear();
- if(themeFlag_)
- delete theme_;
- themeFlag_=false;
- theme_ = 0;
- layer_ = 0;
- fileName_ = "";
- box_ = TeBox();
- chr_ = TeNOCHRONON;
- objId_ = "";
- strategy_="";
- selectedObjs_=TeAll;
- spatialRelation_=TeUNDEFINEDREL;
- hasSpatialRes_ = false;
- boxRest_=TeBox();
- geomRest_=0;
- geomRepRest_=TeGEOMETRYNONE;
-}
-
-
diff --git a/src/terralib/kernel/TeQuerierParams.h b/src/terralib/kernel/TeQuerierParams.h
deleted file mode 100644
index 1b3ac0f..0000000
--- a/src/terralib/kernel/TeQuerierParams.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeQuerierParams.h
- \brief This file contains a class responsible for defining the querier mechanism behavior.
-*/
-
-#ifndef __TERRALIB_INTERNAL_QUERIER_PARAMS_H
-#define __TERRALIB_INTERNAL_QUERIER_PARAMS_H
-
-#include "TeTheme.h"
-
-/*! \class TeQuerierParams
- \brief A class responsible for defining the querier mechanism behavior.
-
- This class contains a set of attributes that define the querier behavior,
- for example, which instances the querier will load or if the querier will load
- the geometries and which attributes.
- It is used in the querier constructor.
-
- \sa
- TeQuerier
-*/
-class TL_DLL TeQuerierParams
-{
-protected:
- bool loadGeometries_; //!< if the querier must load the geometries of each instance
- bool loadAllAttributes_; //!< if the querier must load all attributes of each instance
- vector<string> loadAttrNames_; //!< which attributes the querier must load
- vector<string> loadAttrNamesSeted_; //!< internal structure
- TeGroupingAttr groupingAttr_; //!< which attributes will be load and which aggregate function will be used in each attribute
-
- bool themeFlag_; //!< if the theme is temporary
- TeTheme* theme_; //!< pointer to a source theme
- TeLayer* layer_; //!< pointer to a source layer
-
- string fileName_; //!< source file name (.shp, etc)
- TeBox box_; //!< minimal bounding box that contains all geometries returned by this querier
-
- TeChronon chr_; //!< chronon used to generate time frames
- string objId_; //!< object identification
-
- //TeStatisticType tsOper_; //operator used in the construction of temporal series
-
- string strategy_; //! querier strategy name
-
- TeSelectedObjects selectedObjs_; //!< if the querier must load only the instances pointed or queried
-
- int spatialRelation_; //!< spatial relation used by spatial restriction
- bool hasSpatialRes_; //!< Verifies if there is a spatial restriction defined
- TeBox boxRest_; //!< A bounding box used by spatial restriction
- TeGeometry* geomRest_; //!< A geometry pointer used by spatial restriction
- TeGeomRep geomRepRest_; //!< geometric representation of the theme that will be considered by spatial restriction
-
-public:
- //! Constructor
- TeQuerierParams(bool loadGeom = false, bool loadAllAttr = true):
- loadGeometries_(loadGeom),
- loadAllAttributes_(loadAllAttr),
- themeFlag_(false),
- theme_ (0),
- layer_ (0),
- fileName_(""),
- box_(TeBox()),
- chr_ (TeNOCHRONON),
- objId_(""),
- selectedObjs_(TeAll),
- spatialRelation_(0),
- hasSpatialRes_(false),
- geomRest_(0)
- { }
-
- //! Constructor
- TeQuerierParams(bool loadGeom, const vector<string>& loadAttr):
- loadGeometries_(loadGeom),
- loadAllAttributes_(false),
- themeFlag_(false),
- theme_ (0),
- layer_ (0),
- fileName_(""),
- box_(TeBox()),
- chr_ (TeNOCHRONON),
- objId_(""),
- selectedObjs_(TeAll),
- spatialRelation_(0),
- hasSpatialRes_(false),
- geomRest_(0)
- {
- loadAttrNamesSeted_.clear();
- loadAttrNamesSeted_ = loadAttr;
- }
-
-
- //! Constructor
- TeQuerierParams(bool loadGeom, TeGroupingAttr& groupAttr):
- loadGeometries_(loadGeom),
- loadAllAttributes_(false),
- themeFlag_(false),
- theme_ (0),
- layer_ (0),
- fileName_(""),
- box_(TeBox()),
- chr_ (TeNOCHRONON),
- objId_(""),
- selectedObjs_(TeAll),
- spatialRelation_(0),
- hasSpatialRes_(false),
- geomRest_(0)
- {
- groupingAttr_.clear();
- groupingAttr_ = groupAttr;
- }
-
- //! Destructor
- virtual ~TeQuerierParams();
-
- //! Copy Constructor
- TeQuerierParams(const TeQuerierParams& qp);
-
- //! Assignment operator
- virtual TeQuerierParams& operator=(const TeQuerierParams& rhs);
-
- //! Sets the layer that will be used as source of instances
- virtual void setParams(TeLayer* layer);
-
- //! Sets the theme that will be used as source of instances and a chronon that defines the time frames
- virtual void setParams(TeTheme* theme, TeChronon chr=TeNOCHRONON);
-
- //! Sets the theme that will be used as source of instances of a specific object and a chronon that defines the time frames
- virtual void setParams(TeTheme* theme, const string& objId, TeChronon chr=TeNOCHRONON);
-
- //! Sets the file name that will be used as source of instances and a chronon that defines the time frames
- virtual void setParams(const string& fileName, TeChronon chr=TeNOCHRONON);
-
- //! Sets the parameters used to fill the instances
- virtual void setFillParams(bool loadGeom, bool loadAllAttr, vector<string> loadAttr = vector<string>());
-
- //! Sets the parameters used to fill the instances
- virtual void setFillParams(bool loadGeom, TeGroupingAttr attrG);
-
- //! Sets a spatial restriction (a spatial relation and a bounding box)
- virtual void setSpatialRest(TeBox& box, int relation = TeWITHIN, TeGeomRep rep = TeGEOMETRYNONE);
-
- //! Sets a spatial restriction (a spatial relation and a geometry)
- virtual void setSpatialRest(TeGeometry* geom, int relation = TeWITHIN, TeGeomRep rep = TeGEOMETRYNONE);
-
- //! Sets the selected objects
- virtual void setSelecetObjs(TeSelectedObjects so) { selectedObjs_ = so; }
-
- //! Sets which attributes must be loaded
- virtual void setLoadAttrs(const vector<string>& vec) { loadAttrNames_ = vec; }
-
- //! Returns the identification of the strategy associated to the querier
- virtual string decName() const { return strategy_; }
-
- //! Returns the source theme
- virtual TeTheme* theme() { return theme_; }
-
- //! Returns the source layer
- virtual TeLayer* layer() { return layer_; }
-
- //! Returns the source file name
- virtual string fileName() { return fileName_; }
-
- //! Returns the minimal bounding box
- virtual TeBox& box();
-
- //! Sets the minimal bounding box
- virtual void box(TeBox& b) { box_ = b; }
-
- //! Returns the chronon used to create the time frames
- virtual TeChronon chronon() { return chr_; }
-
- //! Returns the object identification
- virtual string objId() { return objId_; }
-
- //! Returns which attributes will be loaded and how they will be grouped
- virtual TeGroupingAttr& groupAttr() { return groupingAttr_;}
-
- //! Returns if the querier must load the geometries
- virtual bool loadGeom () { return loadGeometries_; }
-
- //! Returns if the querier must load all attributes
- virtual bool loadAllAttr() { return loadAllAttributes_;}
-
- //! Returns the subset of attributes that will be loaded
- virtual vector<string>& loadAttrs() { return loadAttrNames_;}
-
- //! Internal function. Returns the subset of attributes that will be loaded
- virtual vector<string>& loadSetedAttrs() { return loadAttrNamesSeted_;}
-
- //! Returns which objects must be loaded
- virtual TeSelectedObjects selectedObjs() { return selectedObjs_; }
-
- //! Returns the spatial relation
- virtual int spatialRelation() { return spatialRelation_; }
-
- //! Verifies if there is a spatial restriction defined
- virtual bool hasSpatialRes() { return hasSpatialRes_;}
-
- //! Returns the bounding box associated to the spatial restriction
- virtual TeBox boxRest() { return boxRest_; }
-
- //! Returns the geometry associated to the spatial restriction
- virtual TeGeometry* geomRest() { return geomRest_; }
-
- //! Returns which theme geometric representation must be considered by the spatial restriction
- virtual TeGeomRep geomRepRest() { return geomRepRest_; }
-
- //! Clear querier params
- virtual void clear();
-};
-
-#endif
diff --git a/src/terralib/kernel/TeRTree.h b/src/terralib/kernel/TeRTree.h
deleted file mode 100644
index fc23221..0000000
--- a/src/terralib/kernel/TeRTree.h
+++ /dev/null
@@ -1,980 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeRTree.h
- \brief This file contains an implementation of rtree data structures in main memory for two dimensions.
- \note These data structures and algorithms MUST BE USED ONLY BY TerraLib kernel and should NOT be used by anyone because
- THIS IS FOR INTERNAL USE ONLY.
- \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
-*/
-
-#ifndef __TERRALIB_INTERNAL_RTREE_H
-#define __TERRALIB_INTERNAL_RTREE_H
-
-#include "TeGeometry.h"
-#include "TeGeometryAlgorithms.h"
-
-/*! \brief This namespace contain the definitions of various Spatial Data Structures,
- like K-d-Tree and R-Tree, ONLY FOR INTERNAL USE (must NOT be used by anyone).
-*/
-namespace TeSAM
-{
-//! Class that represents a node of a TeRTree
-/*!
- If level is 0 so this is a leaf node otherwise this is a internal node.
-
- WARNING:
-
- 1. A branch is a union, so be carefull with the types used here!
-
- */
-template<class DATATYPE, int MAXNODES = 8, int MINNODES = MAXNODES / 2>
-class TeRTreeNode
-{
- public:
-
- //! Struct that represents a node-branch of a TeRTree
- /*!
- May be data or may be another subtree, if parents level is 0 so this is a data in a leaf node.
-
- */
- struct TeRTreeBranch
- {
- TeBox rect_; //!< Bounding box for branch or object (if this is a leaf).
-
- union
- {
- TeRTreeNode* child_; //!< Child node pointer.
- DATATYPE data_; //!< Data Id or Ptr.
- };
- };
-
- public:
-
- int count_; //!< Count.
-
- int level_; //!< Leaf is zero, others positive.
-
- TeRTreeBranch branch_[MAXNODES]; //!< Branch.
-
- //! Constructor.
-
-
- TeRTreeNode()
- : count_(0), level_(-1)
- {
- }
-
- //! Returns true if this is a internal node.
- bool isInternalNode() const
- {
- return (level_ > 0);
- }
-
- //! Returns true if this is a leaf node.
- bool isLeaf() const
- {
- return (level_ == 0);
- }
-
- //! This method is used by split, when a node is re-filled.
- void init()
- {
- count_ = 0;
-
- level_ = -1;
- }
-
- private:
-
- //! No copy allowed
- TeRTreeNode(const TeRTreeNode& other);
-
- //! No copy allowed
- TeRTreeNode& operator=(const TeRTreeNode& other);
-
-}; // end of class TeRTreeNode
-
-//! A class that represents a two dimensional R-Tree
-/*!
- This implementation is based on:
- Antonin Guttman. R-Trees: A Dynamic Index Structure for Spatial Searching. ACM SIGMOD: International Conference on Management of Data, 1984, pp. 47-57.
-
- and in his original source code. <BR>
-
- WARNING: <BR>
-
- 1. Don't use this class! It is for TerraLib internal use. <BR>
-
- 2. Only the basic methods for inserting and searching were implemented. <BR>
-
- 3. In future we will implement: <BR>
- - the delete method. <BR>
- - the near query <BR>
- - point query <BR>
- */
-template<class DATATYPE, int MAXNODES = 8, int MINNODES = MAXNODES / 2>
-class TeRTree
-{
- public:
-
- //! Export this typename.
- typedef TeRTreeNode<DATATYPE, MAXNODES, MINNODES> TeRTreeNodeType;
-
- //! Export this typename.
- typedef typename TeRTreeNodeType::TeRTreeBranch TeRTreeBranch;
-
- protected:
-
- //! Structure of auxiliary variables for finding a split partition.
- struct TePartitionVars
- {
- int partition_[MAXNODES + 1]; //!< Auxiliary partition vector.
- int taken_[MAXNODES + 1]; //!< Flag to indicate that entry is ok.
- int count_[2]; //!< Number of entries in each new page.
- TeBox cover_[2]; //!< Auxiliary box of each new page.
- double area_[2]; //!< Auxiliary area of each new page.
-
- TeRTreeBranch branchBuf_[MAXNODES + 1]; //!< Auxiliary branch buffer.
- TeBox coverSplit_; //!< Auxiliary box covering branchBuf.
-
- //! Initializes partition vars.
- void init()
- {
- count_[0] = 0;
- count_[1] = 0;
-
- for(int i = 0; i <= MAXNODES; ++i)
- {
- taken_[i] = 0;
- partition_[i] = -1;
- }
- }
- };
-
- TeRTreeNodeType* root_; //!< Pointer to root node
-
- TeBox mbr_; //!< Bounding box of the tree
-
- mutable unsigned int size_; //!< The size of R-Tree (number of nodes)
-
- public:
-
- //! Construtor
- TeRTree(const TeBox& mbr)
- : root_(0), mbr_(mbr), size_(0)
- {
- ++size_;
- root_ = new TeRTreeNodeType();
- root_->level_ = 0;
- }
-
- //! Destructor
- ~TeRTree()
- {
- clear();
-
- if(root_)
- delete root_;
- }
-
- //! The number of elements of the tree
- const unsigned int& size(void) const
- {
- return size_;
- }
-
- //! Return true if the tree is empty
- bool isEmpty(void) const
- {
- return (root_->count_ == 0);
- }
-
- //! Clear all tree nodes
- void clear(void)
- {
- if(root_)
- {
- erase(root_);
- root_ = 0;
-
- size_ = 1;
- root_ = new TeRTreeNodeType();
- root_->level_ = 0;
- }
- }
-
- //! Inserts item into the tree
- void insert(const TeBox& rect, const DATATYPE& data)
- {
- insert(rect, data, &root_, 0);
- }
-
- //! Removes item from tree
- bool remove(const TeBox& rect, const DATATYPE& data)
- {
- return remove(rect, data, &root_);
- }
-
- //! Range search query
- int search(const TeBox& rect, vector<DATATYPE>& report) const
- {
- int foundObjs = 0;
-
- if(root_)
- search(rect, root_, report, foundObjs);
-
- return foundObjs;
- }
-
- //! Sets the bounding box of all elements in the tree
- void setBox(const TeBox& mbr)
- {
- mbr_ = mbr;
- }
-
- //! Gets the bounding box of all elements in the tree
- const TeBox& getBox(void) const
- {
- return mbr_;
- }
-
- protected:
-
- //! Insert a data rectangle into an index structure.
- /*!
- Insert provides for splitting the root. <BR>
- Returns true if root was split, false if it was not. <BR>
- The level argument specifies the number of steps up from the leaf
- level to insert; e.g. a data rectangle goes in at level = 0. <BR>
- chooseLeaf does the recursion.
- */
- inline bool insert(const TeBox& rect, const DATATYPE& data, TeRTreeNodeType** root, int level);
-
- //! Delete a data rectangle from an index structure.
- /*!
- Pass in a pointer to a Rect, the tid of the record, ptr to ptr to root node. <BR>
- Returns 1 if record not found, 0 if success. <BR>
- DeleteRect provides for eliminating the root.
- */
- inline bool remove(const TeBox& rect, const DATATYPE& data, TeRTreeNodeType** root);
-
- //! Delete a rectangle from non-root part of an index structure.
- /*!
- Called by DeleteRect. <BR>
- Descends tree recursively,
- merges branches on the way back up.
- */
- inline bool remove2(const TeBox& rect, const DATATYPE& data, TeRTreeNodeType* n, vector<TeRTreeNodeType*>& ee);
-
- //! Disconnect a dependent node.
- inline void disconBranch(TeRTreeNodeType* n, int i);
-
- //! Inserts a new data rectangle into the index structure.
- /*!
- Recursively descends tree, propagates splits back up.
- Returns false if node was not split. Old node updated.
- If node was split, returns true and sets the pointer pointed to by
- new to point to the new node. Old node updated to become one of two.
- The level argument specifies the number of steps up from the leaf
- level to insert; e.g. a data rectangle goes in at level = 0.
- */
- inline bool chooseLeaf(const TeBox& rect, const DATATYPE& data, TeRTreeNodeType* node, TeRTreeNodeType** newNode, int level);
-
- //! Recursive range query
- inline void search(const TeBox& rect, TeRTreeNodeType* node, vector<DATATYPE>& report, int& foundObjs) const;
-
- //! Find the smallest rectangle that includes all rectangles in branches of a node
- inline TeBox nodeCover(TeRTreeNodeType* n) const;
-
- //! Combine two rectangles into larger one containing both
- inline TeBox combineRect(const TeBox& rectA, const TeBox& rectB) const;
-
- //! Add a branch to a node.
- /*!
- Split the node if necessary. <BR>
- Returns false if node not split. <BR>
- Old node updated. <BR>
- Returns true if node split, sets *new to address of new node. <BR>
- Old node updated, becomes one of two.
- */
- inline bool addBranch(TeRTreeBranch* branch, TeRTreeNodeType* node, TeRTreeNodeType** newNode) const;
-
- //! Pick a branch.
- /*!
- Pick the one that will need the smallest increase
- in area to accomodate the new rectangle. This will result in the
- least total area for the covering rectangles in the current node.
- In case of a tie, pick the one which was smaller before, to get
- the best resolution when searching.
- */
- inline int pickBranch(const TeBox& rect, TeRTreeNodeType* node) const;
-
- //! Split a node.
- /*!
- Divides the nodes branches and the extra one between two nodes. <BR>
- Old node is one of the new ones, and one really new one is created.
- */
- inline void splitNode(TeRTreeNodeType* node, TeRTreeBranch* branch, TeRTreeNodeType** newNode) const;
-
- //! Load branch buffer with branches from full node plus the extra branch.
- inline void getBranches(TeRTreeNodeType* n, TeRTreeBranch* b, TePartitionVars& p) const;
-
- //! Method 0 for finding a partition.
- /*!
- First find two seeds, one for each group, well separated.
- Then put other rects in whichever group will be smallest after addition.
- */
- inline void methodZero(TePartitionVars& p) const;
-
- //! Pick two rects from set to be the first elements of the two groups.
- /*!
- Pick the two that are separated most along any dimension, or overlap least.
- Distance for separation or overlap is measured modulo the width of the
- space covered by the entire set along that dimension.
- */
- inline void pickSeeds(TePartitionVars& p) const;
-
- //! Put a branch in one of the groups
- inline void classify(int i, int group, TePartitionVars& p) const;
-
- //! Put each rect that is not already in a group into a group.
- /*!
- Process one rect at a time, using the following hierarchy of criteria.
- In case of a tie, go to the next test.<BR>
- 1) If one group already has the max number of elements that will allow
- the minimum fill for the other group, put r in the other.<BR>
- 2) Put r in the group whose cover will expand less. This automatically
- takes care of the case where one group cover contains r.<BR>
- 3) Put r in the group whose cover will be smaller. This takes care of the
- case where r is contained in both covers.<BR>
- 4) Put r in the group with fewer elements.<BR>
- 5) Put in group 1 (arbitrary).<BR>
-
- Also update the covers for both groups.
- */
- inline void pigeonhole(TePartitionVars& p) const;
-
- //! Copy branches from the buffer into two nodes according to the partition.
- inline void loadNodes(TeRTreeNodeType* n, TeRTreeNodeType* q, TePartitionVars& p) const;
-
- //! Calculate rect area
- double rectArea(const TeBox& b) const
- {
- return b.width() * b.height();
- }
-
- //! Erases a node from the tree and all nodes below it.
- void erase(TeRTreeNodeType* node)
- {
- if(node->isLeaf())
- {
- delete node;
-
- return;
- }
-
- for(int i = 0u; i < node->count_; ++i)
- erase(node->branch_[i].child_);
-
- delete node;
-
- return;
- }
-
- //! Only to determine if the two box intersects withou using an epsilon
- bool rtreeBoxIntersects(const TeBox& bx1, const TeBox& bx2) const
- {
- return ::TeIntersects(bx1, bx2);
- }
-
- private:
-
- //! No copy allowed
- TeRTree(const TeRTree& other);
-
- //! No copy allowed
- TeRTree& operator=(const TeRTree& other);
-
-}; // end of class TeRTree
-
-
-//------------------- Implementation of the templates classes
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-bool TeRTree<DATATYPE, MAXNODES, MINNODES>::insert(const TeBox& rect, const DATATYPE& data, TeRTreeNodeType** root, int level)
-{
-// this is the algorithm insert
- TeRTreeNodeType* newRoot;
- TeRTreeNodeType* newNode;
- TeRTreeBranch branch;
-
- if(chooseLeaf(rect, data, *root, &newNode, level)) // I1
- {
-// I4
-// if root was split
-// grow a new root, make tree taller
- ++size_;
- newRoot = new TeRTreeNodeType();
-
- newRoot->level_ = (*root)->level_ + 1;
-
-// first half node
- branch.rect_ = nodeCover(*root);
- branch.child_ = *root;
- addBranch(&branch, newRoot, 0);
-
-// second half node
- branch.rect_ = nodeCover(newNode);
- branch.child_ = newNode;
- addBranch(&branch, newRoot, 0);
-
- *root = newRoot;
-
- return true;
- }
-
- return false;
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-bool TeRTree<DATATYPE, MAXNODES, MINNODES>::remove(const TeBox& rect, const DATATYPE& data, TeRTreeNodeType** root)
-{
- int i;
- TeRTreeNodeType *t;
- vector<TeRTreeNodeType*> reInsertList;
-
- if(remove2(rect, data, *root, reInsertList))
- {
-// if we are here, so we have found and deleted a data item
-
-// reinsert any branches from eliminated nodes
- while(!reInsertList.empty())
- {
- t = reInsertList[0];
- for(i = 0; i < t->count_; ++i)
- insert(t->branch_[i].rect_, t->branch_[i].data_, root, t->level_);
-
-// erase node from list
- reInsertList.erase(reInsertList.begin());
-
-// remove node card from memory
- delete t;
- --size_;
- }
-
- /* check for redundant root (not leaf, 1 child) and eliminate */
- if(((*root)->count_ == 1) && ((*root)->isInternalNode()))
- {
- t = (*root)->branch_[0].child_;
-
- delete (*root);
- --size_;
-
- *root = t;
- }
-
- return true;
- }
-
- return false;
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-bool TeRTree<DATATYPE, MAXNODES, MINNODES>::remove2(const TeBox& rect, const DATATYPE& data, TeRTreeNodeType* n, vector<TeRTreeNodeType*>& ee)
-{
- int i;
-
- if(n->isInternalNode()) /* not a leaf node */
- {
- for(i = 0; i < n->count_; ++i)
- {
- if(rtreeBoxIntersects(rect, n->branch_[i].rect_))
- {
- if(remove2(rect, data, n->branch_[i].child_, ee))
- {
- if(n->branch_[i].child_->count_ >= MINNODES)
- n->branch_[i].rect_ = nodeCover(n->branch_[i].child_);
- else
- {
- /* not enough entries in child, eliminate child node */
- ee.push_back(n->branch_[i].child_); //reInsert(n->branch_[i].child_, ee);
- disconBranch(n, i);
- }
-
- return true; // found item
- }
- }
- }
-
- return false; // din't find item
- }
- else /* a leaf node */
- {
- for(i = 0; i < n->count_; ++i)
- {
- if(n->branch_[i].data_ == data)
- {
- disconBranch(n, i);
- return true; // found item
- }
- }
-
- return false; // didn't find item
- }
-}
-
-/*template<class DATATYPE, int MAXNODES, int MINNODES> void TeRTree<DATATYPE, MAXNODES, MINNODES>::reInsert(TeRTreeNodeType* n, vector<TeRTreeNodeType*>& ee)
-{
- ee.push_back(n);
-}*/
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-void TeRTree<DATATYPE, MAXNODES, MINNODES>::disconBranch(TeRTreeNodeType* n, int i)
-{
-// remove element copying the last element in array
- n->branch_[i] = n->branch_[n->count_ - 1];
-
- --(n->count_);
-}
-
-// CHOOSELEAF
-template<class DATATYPE, int MAXNODES, int MINNODES>
-bool TeRTree<DATATYPE, MAXNODES, MINNODES>::chooseLeaf(const TeBox& rect, const DATATYPE& data, TeRTreeNodeType* node, TeRTreeNodeType** newNode, int level)
-{
- TeRTreeBranch b;
- TeRTreeNodeType* n2;
-
- if(node->level_ > level)
- {
-// Still above level for insertion, go down tree recursively
- int i = pickBranch(rect, node); // CL3
-
- if(!chooseLeaf(rect, data, node->branch_[i].child_, &n2, level))
- {
-// child was not split
- node->branch_[i].rect_ = combineRect(rect, node->branch_[i].rect_);
-
- return false;
- }
- else
- {
-// child was split
- node->branch_[i].rect_ = nodeCover(node->branch_[i].child_);
-
- b.child_ = n2;
- b.rect_ = nodeCover(n2);
-
- return addBranch(&b, node, newNode);
- }
- }
- else if (node->level_ == level)
- {
-// have reached level for insertion. Add rect, split if necessary
-
- b.rect_ = rect;
- //b.child_ = (TeRTreeNodeType*) data;
- b.data_ = data;
-
-// child field of leaves contains tid of data record
- return addBranch(&b, node, newNode);
- }
- else
- {
-// Not supposed to happen
- throw;
- return false;
- }
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-void TeRTree<DATATYPE, MAXNODES, MINNODES>::search(const TeBox& rect, TeRTreeNodeType* node, vector<DATATYPE>& report, int& foundObjs) const
-{
- int i;
-// S1
- if(node->isInternalNode()) // This is an internal node in the tree
- {
- for(i = 0; i < node->count_; ++i)
- {
- if(rtreeBoxIntersects(rect, node->branch_[i].rect_))
- search(rect, node->branch_[i].child_, report, foundObjs);
- }
- }
-// S2
- else // This is a leaf node
- {
- for(i = 0; i < node->count_; ++i)
- {
- if(rtreeBoxIntersects(rect, node->branch_[i].rect_))
- {
- DATATYPE& id = node->branch_[i].data_;
-
- report.push_back(id);
-
- ++foundObjs;
- }
- }
- }
-
- return;
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-TeBox TeRTree<DATATYPE, MAXNODES, MINNODES>::nodeCover(TeRTreeNodeType* n) const
-{
- bool flag = true;
-
- TeBox r;
-
- for(int i = 0; i < n->count_; ++i)
- {
- if(flag)
- {
- r = n->branch_[i].rect_;
- flag = false;
- }
- else
- r = combineRect(r, n->branch_[i].rect_);
- }
-
- return r;
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-TeBox TeRTree<DATATYPE, MAXNODES, MINNODES>::combineRect(const TeBox& rectA, const TeBox& rectB) const
-{
- TeBox newRect;
-
- newRect.x1_ = MIN(rectA.x1_, rectB.x1_);
- newRect.y1_ = MIN(rectA.y1_, rectB.y1_);
- newRect.x2_ = MAX(rectA.x2_, rectB.x2_);
- newRect.y2_ = MAX(rectA.y2_, rectB.y2_);
-
- return newRect;
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-bool TeRTree<DATATYPE, MAXNODES, MINNODES>::addBranch(TeRTreeBranch* branch, TeRTreeNodeType* node, TeRTreeNodeType** newNode) const
-{
- if(node->count_ < MAXNODES) /* split won't be necessary */
- {
- node->branch_[node->count_] = *branch;
-
- ++(node->count_);
-
- return false;
- }
- else
- {
- splitNode(node, branch, newNode);
-
- return true;
- }
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-int TeRTree<DATATYPE, MAXNODES, MINNODES>::pickBranch(const TeBox& rect, TeRTreeNodeType* node) const
-{
-// CL3
- bool flag = true;
-
- double bestIncr = -1.0;
-
- double bestArea = 0.;
-
- int best = 0;
-
- for(int i = 0; i < node->count_; ++i)
- {
- TeBox rr = node->branch_[i].rect_;
- double area = rectArea(rr);
-
- rr = combineRect(rect, rr);
-
- double increase = rectArea(rr) - area;
-
- if((increase < bestIncr) || flag)
- {
- best = i;
-
- bestArea = area;
- bestIncr = increase;
-
- flag = false;
- }
- else if((increase == bestIncr) && (area < bestArea))
- {
- best = i;
- bestArea = area;
- bestIncr = increase;
- }
- }
-
- return best;
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-void TeRTree<DATATYPE, MAXNODES, MINNODES>::splitNode(TeRTreeNodeType* node, TeRTreeBranch* branch, TeRTreeNodeType** newNode) const
-{
- TePartitionVars partitions;
-
-// load all the branches into a buffer, initialize old node
- int level = node->level_;
-
- getBranches(node, branch, partitions);
-
-// find partition
- methodZero(partitions);
-
-// put branches from buffer into 2 nodes according to chosen partition
- ++size_;
-
- *newNode = new TeRTreeNodeType();
- (*newNode)->level_ = node->level_ = level;
-
- loadNodes(node, *newNode, partitions);
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-void TeRTree<DATATYPE, MAXNODES, MINNODES>::getBranches(TeRTreeNodeType* n, TeRTreeBranch* b, TePartitionVars& p) const
-{
- int i;
-// load the branch buffer
- for(i = 0; i < MAXNODES; ++i)
- {
- p.branchBuf_[i] = n->branch_[i];
- }
-
- p.branchBuf_[MAXNODES] = *b;
-
-// calculate rect containing all in the set
- p.coverSplit_ = p.branchBuf_[0].rect_;
-
- for(i = 1; i <= MAXNODES; ++i)
- p.coverSplit_ = combineRect(p.coverSplit_, p.branchBuf_[i].rect_);
-
- n->init();
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-void TeRTree<DATATYPE, MAXNODES, MINNODES>::methodZero(TePartitionVars& p) const
-{
- p.init();
- pickSeeds(p);
- pigeonhole(p);
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-void TeRTree<DATATYPE, MAXNODES, MINNODES>::pickSeeds(TePartitionVars& p) const
-{
- double w;
- double separation;
- double bestSep;
- double width[2];
- int leastUpper[2];
- int greatestLower[2];
- int seed0;
- int seed1;
- int i;
-// LPS1
-// find the rectangles farthest out in each direction along dimens "x"
- greatestLower[0] = leastUpper[0] = 0;
-
- for(i = 1; i <= MAXNODES; ++i)
- {
- TeBox& r = p.branchBuf_[i].rect_;
-
- if(r.x1_ > p.branchBuf_[greatestLower[0]].rect_.x1_)
- greatestLower[0] = i;
-
- if(r.x2_ < p.branchBuf_[leastUpper[0]].rect_.x2_)
- leastUpper[0] = i;
- }
-
-// LPS2
-// LPS3
-// find the width of the whole collection along this dimension
- width[0] = p.coverSplit_.x2_ - p.coverSplit_.x1_;
-
-// find the rectangles farthest out in each direction along dimens "y"
- greatestLower[1] = leastUpper[1] = 0;
-
- for(i = 1; i <= MAXNODES; ++i)
- {
- TeBox& r = p.branchBuf_[i].rect_;
-
- if(r.y1_ > p.branchBuf_[greatestLower[1]].rect_.y1_)
- greatestLower[1] = i;
-
- if(r.y2_ < p.branchBuf_[leastUpper[1]].rect_.y2_)
- leastUpper[1] = i;
- }
-
-// LPS2
-// LPS3
-// find the width of the whole collection along this dimension
- width[1] = p.coverSplit_.y2_ - p.coverSplit_.y1_;
-
-
-// pick the best separation dimension and the two seed rects
-
-// divisor for normalizing by width
-
-// x
- if(width[0] == 0.0)
- w = 1.0;
- else
- w = width[0];
-
- TeBox rlow = p.branchBuf_[leastUpper[0]].rect_;
- TeBox rhigh = p.branchBuf_[greatestLower[0]].rect_;
-
- seed0 = leastUpper[0];
- seed1 = greatestLower[0];
-
- bestSep = (rhigh.x1_ - rlow.x2_) / w;
-
-// y
- if(width[1] == 0.0)
- w = 1.0;
- else
- w = width[1];
-
- rlow = p.branchBuf_[leastUpper[1]].rect_;
- rhigh = p.branchBuf_[greatestLower[1]].rect_;
-
- separation = (rhigh.y1_ - rlow.y2_) / w;
-
-// LPS3
- if(separation > bestSep)
- {
- seed0 = leastUpper[1];
- seed1 = greatestLower[1];
-
- bestSep = separation;
- }
-
- if(seed0 != seed1)
- {
- classify(seed0, 0, p);
- classify(seed1, 1, p);
- }
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-void TeRTree<DATATYPE, MAXNODES, MINNODES>::classify(int i, int group, TePartitionVars& p) const
-{
- p.partition_[i] = group;
- p.taken_[i] = 1;
-
- if(p.count_[group] == 0)
- p.cover_[group] = p.branchBuf_[i].rect_;
- else
- p.cover_[group] = combineRect(p.branchBuf_[i].rect_, p.cover_[group]);
-
- p.area_[group] = rectArea(p.cover_[group]);
-
- ++(p.count_[group]);
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-void TeRTree<DATATYPE, MAXNODES, MINNODES>::pigeonhole(TePartitionVars& p) const
-{
- TeBox newCover[2];
-
- double newArea[2];
- double increase[2];
-
- for(int i = 0; i <= MAXNODES; ++i)
- {
- if(p.taken_[i] == 0)
- {
-// if one group too full, put rect in the other regardless
- if(p.count_[0] >= (MAXNODES + 1 - MINNODES))
- {
- classify(i, 1, p);
-
- continue;
- }
- else if(p.count_[1] >= (MAXNODES + 1 - MINNODES))
- {
- classify(i, 0, p);
-
- continue;
- }
-
-// find the areas of the two groups' old and new covers
- for(int group = 0; group < 2; ++group)
- {
- if(p.count_[group] > 0)
- {
- newCover[group] = combineRect(p.branchBuf_[i].rect_, p.cover_[group]);
- }
- else
- {
- newCover[group] = p.branchBuf_[i].rect_;
- }
-
- newArea[group] = rectArea(newCover[group]);
- increase[group] = newArea[group] - p.area_[group];
- }
-
-// put rect in group whose cover will need to expand less
- if(increase[0] < increase[1])
- classify(i, 0, p);
- else if(increase[1] < increase[0])
- classify(i, 1, p);
-// put rect in group that will have a smaller area cover
- else if(p.area_[0] < p.area_[1])
- classify(i, 0, p);
- else if(p.area_[1] < p.area_[0])
- classify(i, 1, p);
-// put rect in group with fewer elements
- else if(p.count_[0] < p.count_[1])
- classify(i, 0, p);
- else
- classify(i, 1, p);
- }
- }
-}
-
-template<class DATATYPE, int MAXNODES, int MINNODES>
-void TeRTree<DATATYPE, MAXNODES, MINNODES>::loadNodes(TeRTreeNodeType* n, TeRTreeNodeType* q, TePartitionVars& p) const
-{
- for(int i = 0; i <= MAXNODES; ++i)
- {
- if(p.partition_[i] == 0)
- addBranch(&(p.branchBuf_[i]), n, 0);
- else if(p.partition_[i] == 1)
- addBranch(&(p.branchBuf_[i]), q, 0);
- //else
- // throw; // ERROR
- }
-}
-}; // end namespace TeSAM
-
-
-#endif // __TERRALIB_INTERNAL_RTREE_H
-
-
-
-
diff --git a/src/terralib/kernel/TeRaster.cpp b/src/terralib/kernel/TeRaster.cpp
deleted file mode 100644
index 2fbbde6..0000000
--- a/src/terralib/kernel/TeRaster.cpp
+++ /dev/null
@@ -1,1049 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include <TeRaster.h>
-#include <TeDecoder.h>
-#include <TeUtils.h>
-#include <TeStdFile.h>
-#include <TeException.h>
-#include "TeRasterRemap.h"
-#include "TeDecoderMemory.h"
-#include <TeInitRasterDecoders.h>
-#include <TeVectorRemap.h>
-#include <algorithm>
-
-
-//! virtual class that define the strategics of the iteratorPoly, each strategic is a functor
-class TeStrategic
-{
-protected:
- TeRaster* raster_;
- double y_;
- TeCoordPairVect SegOut_; //line and column index
-
-public:
- TeStrategic(TeRaster* r=0, double y=0): raster_(r), y_(y) {}
-
- virtual ~TeStrategic() {}
-
- void Init(TeRaster* r, double y)
- {
- raster_ = r;
- y_ = y;
- }
-
- virtual void strateg(double xMin, double xMax, double y) = 0;
-
- void operator() (TeCoordPair& pair)
- {
- //xmin and xmax of the segment (line and column index)
- TeCoord2D minSegLC = raster_->coord2Index(TeCoord2D(pair.pt1.x_, y_));
- TeCoord2D maxSegLC = raster_->coord2Index(TeCoord2D(pair.pt2.x_, y_));
-
- double xMinLCd = minSegLC.x_;
- double xMaxLCd = maxSegLC.x_;
- double yLC = maxSegLC.y_;
-
- //verify if is outside raster area
- if(xMinLCd<-0.5)
- {
- if(xMaxLCd<-0.5)
- return;
- else
- xMinLCd=-0.5;
- }
- strateg(xMinLCd, xMaxLCd, yLC);
- }
- TeCoordPairVect result() const {return SegOut_;}
-};
-
-
-//! functor TePixelBoxInPoly
-/*
- return the elements of the raster which box is
- contained in the polygon
-*/
-class TePixelBoxInPoly: public TeStrategic
-{
-
-public:
- TePixelBoxInPoly(TeRaster* r=0, double y=0): TeStrategic(r,y) {}
-
- virtual ~TePixelBoxInPoly() {}
-
- void strateg(double xMin, double xMax, double y)
- {
- //verify if contain the element center
- int xMinLCi = TeRoundRasterIndex(xMin);
- int xMaxLCi = TeRoundRasterIndex(xMax);
-
- if (xMinLCi < xMin)
- xMinLCi++;
-
- if (xMaxLCi > xMax)
- xMaxLCi--;
-
- if (xMinLCi <= xMaxLCi)
- {
- //new segment
- TeCoord2D minLC (xMinLCi, y);
- TeCoord2D maxLC (xMaxLCi, y);
-
- TeCoordPair res(minLC,maxLC);
- SegOut_.push_back (res);
- }
- }
-
-};
-
-
-//! functor TePixelBBInterPoly
-/*
- return the elements of the raster "cujo" boundingbox
- intersects the polygon
-*/
-class TePixelBBInterPoly: public TeStrategic
-{
-
-public:
- TePixelBBInterPoly(TeRaster* r=0, double y=0): TeStrategic(r,y) {}
-
- virtual ~TePixelBBInterPoly() {}
-
- void strateg(double xMin, double xMax, double y)
- {
- //element center
- int xMinLCi = TeRoundRasterIndex(xMin);
- int xMaxLCi = TeRoundRasterIndex(xMax);
-
- if (SegOut_.size()>0)
- {
- TeCoordPair prev = SegOut_[SegOut_.size()-1];
- if (xMinLCi == prev.pt2.x())
- xMinLCi++;
- if (xMinLCi > xMaxLCi)
- return;
- }
-
- TeCoord2D minLC (xMinLCi, y);
- TeCoord2D maxLC (xMaxLCi, y);
-
- TeCoordPair res(minLC,maxLC);
-
- SegOut_.push_back (res);
- }
-};
-
-
-TeCoordPairVect
-applyStrategic(double& y, double ymin, double xmin, TeStrategicIterator st, TeRaster* raster, TePolygon& poly)
-{
- TeCoordPairVect Segments = TeGetIntersections(poly, y);
- double resy = raster->params().resy_;
-
- //In polygon
- if((st==TeBoxPixelIn) || (st==TeBBoxPixelInters))
- {
- bool empty=false;
- if(Segments.empty())
- {
- empty = true;
- y -= resy;
-
- while((y>=ymin) && (empty))
- {
- Segments = TeGetIntersections(poly, y);
- if(!Segments.empty())
- empty = false;
- else
- y -=resy;
- }
- }
- if(!empty)
- {
- if (st==TeBoxPixelIn)
- {
- TePixelBoxInPoly strat(raster,y);
- strat = for_each(Segments.begin (), Segments.end(), strat);
- return strat.result();
- }
- else
- {
- TePixelBBInterPoly strat(raster,y);
- strat = for_each(Segments.begin (), Segments.end(), strat);
- return strat.result();
- }
- }
- }
- //Out polygon
- else if((st==TeBoxPixelOut) || (st==TeBBoxPixelNotInters))
- {
- int nCols = raster->params().ncols_;
-
- //se o segmento for vazio, no h interseo entre essa linha e o polgono
- //fazer um segmento de todas as colunas
- if(Segments.empty())
- {
- //passar para indice: linha e coluna
- TeCoord2D coordCM (xmin, y);
- double linLC = (raster->coord2Index(coordCM)).y();
-
- int lin = TeRoundRasterIndex(linLC);
-
- TeCoord2D index1(0, lin);
- TeCoord2D index2(nCols-1,lin);
-
- TeCoordPair pair(index1,index2);
-
- Segments.push_back(pair);
- return Segments;
- }
- else
- {
- TeCoordPairVect segsIn, segResult;
-
- if(st==TeBoxPixelOut)
- {
- TePixelBoxInPoly strat(raster,y);
- //return the segments in the polygon
- strat = for_each(Segments.begin (), Segments.end(), strat);
- segsIn = strat.result();
- }
- else
- {
- TePixelBBInterPoly strat(raster,y);
- //return the segments in the polygon
- strat = for_each(Segments.begin (), Segments.end(), strat);
- segsIn = strat.result();
- }
-
- TeCoordPairVect::iterator it = segsIn.begin();
-
- double colMin = 0;
- double colMax = 0;
- double lin = 0;
-
- while(it!=segsIn.end())
- {
- TeCoord2D coord1 = (*it).pt1;
- TeCoord2D coord2 = (*it).pt2;
- lin = coord1.y();
-
- colMax = coord1.x()-1;
-
- if (colMax >= colMin)
- {
- TeCoord2D index1(colMin, lin);
- TeCoord2D index2(colMax, lin);
-
- TeCoordPair pair(index1,index2);
-
- segResult.push_back(pair);
- }
- colMin = coord2.x()+1;
- ++it;
- }
-
- //Montar o ltimo segmento
- TeCoord2D index1(colMin, lin);
- TeCoord2D index2(nCols-1,lin);
-
- TeCoordPair pair(index1,index2);
- segResult.push_back(pair);
- return segResult;
- }
- }
-
- return Segments;
-}
-
-
-
-TeRaster::TeRaster( TeRasterParams& pars )
-{
- TeInitRasterDecoders();
- decoder_ = 0;
- string decName;
- params_.status_ = TeRasterParams::TeNotReady;
- pars.errorMessage_ = "";
- if (pars.decoderIdentifier_.empty()) // the decoder is not specified in raster parameters
- {
- if (!pars.fileName_.empty()) // try to guess from the file name
- {
- string ext = TeConvertToUpperCase(TeGetExtension(pars.fileName_.c_str()));
- decName = TeDecoderFactory::instanceName2Dec()[ext];
- if ( decName.empty())
- {
- pars.errorMessage_ = "Can not instantiate a decoder from the raster file (or table) name.";
- return;
- }
- pars.decoderIdentifier_ = decName;
- }
- else // no decoder type, and no filename
- {
- pars.errorMessage_ = "Can not instantiate a decoder for the raster data.";
- return;
- }
- }
- decoder_ = TeDecoderFactory::make(pars);
- if (decoder_)
- {
- params_ = decoder_->params();
- box_ = decoder_->params().box();
- }
-}
-
-TeRaster::TeRaster( const string& filename, const char& mode )
-{
- TeInitRasterDecoders();
- params_.fileName_ = filename;
- params_.mode_ = mode;
- decoder_ = 0;
- params_.status_ = TeRasterParams::TeNotReady;
- string decName;
- if (!filename.empty())
- {
- string ext = TeConvertToUpperCase(TeGetExtension(filename.c_str()));
- decName = TeDecoderFactory::instanceName2Dec()[ext];
- if (decName.empty())
- {
- params_.errorMessage_ = "Can not instantiate a decoder from the raster file (or table) name.";
- return;
- }
- }
- else
- {
- params_.errorMessage_ = "Can not instantiate a decoder for the raster data.";
- return;
- }
- params_.decoderIdentifier_= decName;
- decoder_ = TeDecoderFactory::make(params_);
- if (decoder_)
- {
- params_ = decoder_->params();
- box_ = decoder_->params().box();
- }
-}
-
-
-TeRaster::TeRaster(int ncols, int nlines, int nbands, TeDataType elemType)
-{
- params_.decoderIdentifier_= "MEM";
- params_.ncols_ = ncols;
- params_.nlines_ = nlines;
- params_.nBands(nbands);
- params_.setDataType(elemType);
- params_.mode_ = 'c';
- params_.lowerLeftResolutionSize(0.5,0.5,1.0,1.0,params_.ncols_,params_.nlines_,true);
- TeProjection* proj = new TeNoProjection();
- params_.projection(proj);
- decoder_ = new TeDecoderMemory(params_);
- delete proj;
- if (decoder_)
- {
- params_ = decoder_->params();
- box_ = decoder_->params().box();
- }
-}
-
-
-TeRaster::~TeRaster( )
-{
- if (decoder_)
- delete decoder_;
-}
-
-void TeRaster::updateParams( TeRasterParams& par)
-{
- params_ = par; // update raster parameters
- if (decoder_)
- decoder_->updateParams(par); // update its decoder parameters
- box_ = params_.box();
-}
-
-void TeRaster::setDecoder( TeDecoder* dec )
-{
- if (dec)
- {
- decoder_ = dec; // set the decoder
- params_ = decoder_->params(); // copy decoder parameters to raster
- box_ = params_.box();
- }
-}
-
-void TeRaster::clear()
-{
- if (decoder_)
- decoder_->clear();
-}
-
-TeRaster::iterator TeRaster::begin()
-{
- return iterator(0,0, params_.ncols_,params_.nlines_, params_.nBands(), this);
-}
-
-TeRaster::iterator TeRaster::end()
-{
- return iterator(params_.ncols_,params_.nlines_-1,params_.ncols_,params_.nlines_, params_.nBands(), this);
-}
-
-TeRaster::iteratorPoly TeRaster::end(TePolygon& poly, TeStrategicIterator st, int band)
-{
- return iteratorPoly(params_.ncols_,params_.nlines_-1,params_.ncols_,params_.nlines_, params_.nBands(), this, poly, st, band);
-}
-
-bool TeRaster::selectBlocks(TeBox& bb, int resFac, TeRasterParams& parBlock)
-{
- if (!decoder_)
- return false;
- return decoder_->selectBlocks(bb,resFac,parBlock);
-}
-
-int TeRaster::numberOfSelectedBlocks()
-{
- if (!decoder_)
- return 0;
- return decoder_->numberOfSelectedBlocks();
-}
-
-bool TeRaster::fetchRasterBlock(TeDecoderMemory* memDec)
-{
- if (!decoder_)
- return false;
- return decoder_->getSelectedRasterBlock(memDec);
-}
-
-void TeRaster::clearBlockSelection()
-{
- if (!decoder_)
- return ;
- decoder_->clearBlockSelection();
-}
-
-void TeRaster::iterator::moveForward()
-{
- this->operator++();
-}
-
-bool TeRaster::iterator::operator==(const iterator& rhs) const
-{
- return (this->colCurrent_ == rhs.colCurrent_ && this->linCurrent_== rhs.linCurrent_);
-}
-
-bool TeRaster::iterator::operator!=(const iterator& rhs) const
-{
- return (this->colCurrent_ != rhs.colCurrent_ || this->linCurrent_!= rhs.linCurrent_);
-}
-
-void TeRaster::iteratorPoly::moveForward()
-{
- this->operator++();
-}
-
-bool TeRaster::init( TeRasterParams& pars )
-{
- if (!decoder_ )
- {
- params_.status_ = TeRasterParams::TeNotReady;
- string decName;
- if (params_.decoderIdentifier_.empty()) // the decoder is not especified in raster parameters
- {
- if (!params_.fileName_.empty()) // try to guess from the file name
- {
- string ext = TeConvertToUpperCase(TeGetExtension(params_.fileName_.c_str()));
- decName = TeDecoderFactory::instanceName2Dec()[ext];
- if ( decName.empty())
- {
- pars.errorMessage_ = "Can not instantiate a decoder from the raster file (or table) name.";
- return false;
- }
- params_.decoderIdentifier_ = decName;
- }
- else // no decoder type, and no filename
- {
- pars.errorMessage_ = "Can not instantiate a decoder for the raster data.";
- return false;
- }
- }
- decoder_ = TeDecoderFactory::make(params_);
- if (!decoder_)
- {
- pars.errorMessage_ = "Can not instantiate a decoder for the raster data.";
- return false;
- }
- }
- decoder_->init(pars);
- params_ = decoder_->params();
- box_ = decoder_->params().box();
- return (params_.status_ != TeRasterParams::TeNotReady);
-}
-
-bool TeRaster::init()
-{
- if (decoder_)
- {
- decoder_->init(params_);
- params_ = decoder_->params();
- return (params_.status_ != TeRasterParams::TeNotReady);
- }
- params_.errorMessage_ = "There is no decoder associated to the raster data.";
- return false;
-}
-
-bool TeRaster::setElement (int col, int lin, double val,int band)
-{
- if (params_.status_!= TeRasterParams::TeReadyToWrite)
- {
- params_.errorMessage_ = "Raster is not properly initalizated to be written.";
- return false;
- }
- if ( col < 0 || col >= params_.ncols_ ||
- lin < 0 || lin >= params_.nlines_ ||
- band < 0 || band >= params_.nBands())
- {
- params_.errorMessage_ = "Fail to access element out of the range of the raster dimensions.";
- return false;
- }
-
- bool res = decoder_->setElement(col,lin,val,band);
- if ( res && (!params_.useDummy_ || val != params_.dummy_[band]))
- {
- // check if should update min and max values
- if (val < params_.vmin_[band])
- {
- params_.vmin_[band] = val;
- decoder_->params().vmin_[band] = val;
- }
-
- if (val > params_.vmax_[band])
- {
- params_.vmax_[band] = val;
- decoder_->params().vmax_[band] = val;
- }
- }
- return res;
-}
-
-bool TeRaster::getElement (int col, int lin, double& val,int band)
-{
- if (!params_.status_ || col < 0 || col >= params_.ncols_ ||
- lin < 0 || lin >= params_.nlines_ ||
- band < 0 || band >= params_.nBands())
- {
- params_.errorMessage_ = "Fail to access element out of the range of the raster dimensions.";
- return false;
- }
-
- if (decoder_->getElement (col,lin,val,band) &&
- (!params_.useDummy_ || val != params_.dummy_[band]))
- return true;
- else
- return false;
-}
-
-bool TeRaster::setElement(int col, int lin, double Rval, double Gval, double Bval, unsigned int transp)
-{
- if (params_.status_!= TeRasterParams::TeReadyToWrite)
- {
- params_.errorMessage_ = "Raster is not properly initalizated to be written.";
- return false;
- }
- if ( params_.nBands() != 3 ||
- col < 0 || col >= params_.ncols_ ||
- lin < 0 || lin >= params_.nlines_ )
- {
- params_.errorMessage_ = "Fail to access element out of the range of the raster dimensions.";
- return false;
- }
- return decoder_->setElementRGB(col, lin, Rval, Gval, Bval, transp);
-}
-
-TeRaster::iteratorPoly
-TeRaster::begin(TePolygon& poly, TeStrategicIterator st, int band)
-{
- double minLinLC, maxLinLC, minColLC, maxColLC; //index
- double minLinCM, maxLinCM, minColCM, maxColCM; //world coordinates
- int nlines = 0;
- int ncols = 0;
- double resy = params_.resy_;
- bool end = false;
-
- //box (world coordinates) of the polygon
- TeBox boxPol = poly.box();
- if((st==TeBoxPixelOut) || (st==TeBBoxPixelNotInters)) //out polygon
- {
- minLinLC = (params_.nlines_-1);
- maxLinLC = 0.0;
- minColLC = 0.0;
- maxColLC = (params_.ncols_-1);
- }
- else //in polygon
- {
- //change to line and column index
- TeCoord2D minColLinLC = coord2Index(boxPol.lowerLeft());
- TeCoord2D maxColLinLC = coord2Index(boxPol.upperRight());
-
- //segment that pass by center of the element
- minLinLC = TeRound(minColLinLC.y());
- maxLinLC = TeRound(maxColLinLC.y());
- minColLC = TeRound(minColLinLC.x());
- maxColLC = TeRound(maxColLinLC.x());
-
- //number of lines and columns of the polygon box
- nlines = (int)((minLinLC - maxLinLC)+1);
- ncols = (int)((maxColLC - minColLC)+1);
-
-
- //if is negative
- if(minLinLC<-0.5)
- {
- if(maxLinLC<-0.5)
- end=true;
- else
- minLinLC = -0.5;
- }
-
- if(minColLC<-0.5)
- {
- if(maxColLC<-0.5)
- end=true;
- else
- minColLC = -0.5;
- }
- }
-
- TeCoord2D MinColLinLC(minColLC, minLinLC);
- TeCoord2D MaxColLinLC(maxColLC, maxLinLC);
-
- //calculate the minimal and maximal line and minimal column (in world coordinates)
- TeCoord2D MinColLinCM = index2Coord(MinColLinLC);
- minLinCM = MinColLinCM.y();
- minColCM = MinColLinCM.x();
- maxLinCM = index2Coord(MaxColLinLC).y();
- maxColCM = index2Coord(MaxColLinLC).x();
-
- TeCoordPairVect segRes;
- bool empty = true;
- bool first = true;
-
- while(empty && (maxLinCM >= minLinCM))
- {
- if(!first)
- {
- maxLinCM -= resy;
- TeCoord2D maxColLinLC = coord2Index(TeCoord2D(maxColCM,maxLinCM));
- maxLinLC = TeRound(maxColLinLC.y());
- }
-
- segRes = applyStrategic(maxLinCM, minLinCM, minColCM, st, this, poly);
- empty = segRes.empty();
- first = false;
- }
-
- if(!segRes.empty())
- {
- minColLC = segRes[0].pt1.x();
- double lMin = segRes[0].pt1.y();
- maxColLC = segRes[0].pt2.x();
-
- int cCurr = TeRound(minColLC); //column current
- int lCurr = TeRound(lMin); //line current
-
- iteratorPoly itPoly(cCurr, lCurr, params_.ncols_, params_.nlines_, params_.nBands(), this, poly,
- st, maxLinLC, minLinLC, minColLC, maxColLC, segRes,
- 0, nlines, ncols, end, minLinCM);
- return itPoly;
-
- }
- else
- {
- iteratorPoly itPoly = this->end(poly, st, band);
- return itPoly;
- }
-}
-
-
-bool
-TeRaster::fillRaster(TeRaster* dstRaster, TeRasterTransform* transf, bool bestRes)
-{
- if (!dstRaster ||
- dstRaster->params().status_ != TeRasterParams::TeReadyToWrite)
- {
- params_.errorMessage_ = "Destination raster non-existing or not ready to write";
- return false;
- }
-
- if (params_.status_ != TeRasterParams::TeReadyToRead &&
- params_.status_ != TeRasterParams::TeReadyToWrite)
- {
- params_.errorMessage_ = "Raster not ready to be extracted";
- return false;
- }
-
- int dt = CLOCKS_PER_SEC/4;
- int dt2 = CLOCKS_PER_SEC * 5;
- clock_t t0, t1, t2;
-
- TeRasterRemap fillRemap;
- fillRemap.setOutput(dstRaster);
- fillRemap.setInput(this);
- if (transf)
- fillRemap.setTransformer(transf);
- int res = 1;
- TeBox b = dstRaster->params().boundingBox();
- if (bestRes)
- res = decoder_->bestResolution(b, dstRaster->params().nlines_, dstRaster->params().ncols_,
- dstRaster->params().projection());
- this->clearBlockSelection();
- bool result = true;
- TeRasterParams parBlock;
- if (selectBlocks(b, res, parBlock))
- {
- if (TeProgress::instance())
- TeProgress::instance()->setTotalSteps(this->numberOfSelectedBlocks());
- TeRaster* block = new TeRaster;
- TeDecoderMemory* decMem = new TeDecoderMemory(parBlock);
- decMem->init();
- int n = 0;
- t2 = clock();
- t0 = t1 = t2;
- bool flag = true;
- do
- {
- flag = fetchRasterBlock(decMem);
- block->setDecoder(decMem);
- fillRemap.setInput(block);
- if (!fillRemap.apply())
- break;
- n++;
- if (TeProgress::instance())
- {
- t2 = clock();
- if (int(t2-t1) > dt)
- {
- t1 = t2;
- if (TeProgress::instance()->wasCancelled())
- break;
- if((int)(t2-t0) > dt2) // show progress
- TeProgress::instance()->setProgress(n);
- }
- }
- }while (flag);
- decMem->clear();
- delete block;
- }
- else
- result = fillRemap.apply();
- this->clearBlockSelection();
- if (TeProgress::instance())
- TeProgress::instance()->reset();
- return result;
-}
-
-//! Prefix move forward operator
-TeRaster::iterator&
-TeRaster::iterator::operator++()
-{
- if (++colCurrent_ == nCols_)
- {
- if (linCurrent_ < nLines_-1)
- {
- linCurrent_++;
- colCurrent_ = 0;
- }
- }
- return *this;
-}
-
-TeRaster::iterator
-TeRaster::iterator::operator++(int)
-{
- iterator temp = *this;
- ++(*this);
- return temp;
-}
-
-vector<double>
-TeRaster::iterator::operator*()
-{
- vector<double> vt(nBands_);
- if ((linCurrent_ < nLines_) && (colCurrent_ < nCols_))
- {
- for (int n=0; n<nBands_; n++)
- raster_->getElement(colCurrent_,linCurrent_,vt[n],n);
- }
- return vt;
-}
-
-double
-TeRaster::iterator::operator*(int band)
-{
- double val = this->raster_->params().dummy_[band];
- if ((linCurrent_ < nLines_) && (colCurrent_ < nCols_))
- {
- if (raster_->getElement(colCurrent_,linCurrent_,val,band))
- return val;
- }
- return val;
-}
-
-void
-TeRaster::iteratorPoly::getNewSegment(int linCurr)
-{
- //change to world coordinates
- TeCoord2D coord(colMin_,linCurr);
- TeCoord2D colLinCM = raster_->index2Coord(coord);
-
- double linCM = colLinCM.y();
- double colMinCM = colLinCM.x();
-
- //applyStrategic: return the segments
- segments_ = applyStrategic(linCM, linMinCM_, colMinCM, strategy_, raster_, poly_);
-
- if(segments_.empty())
- {
- colCurrent_=(int)colMax_;
- return;
- }
-
- colMin_ = segments_[0].pt1.x();
- colMax_ = segments_[0].pt2.x();
-
- colCurrent_=(int)colMin_;
- posSegments_ = 0;
- end_ = false;
-}
-
-//! Prefix move forward operator
-TeRaster::iteratorPoly&
-TeRaster::iteratorPoly::operator++() //prefix
-{
- if (++colCurrent_>colMax_)
- {
- if((++posSegments_ > (int)(segments_.size()-1)) || (segments_.size()<1))
- {
- if(++linCurrent_>linMax_)
- {
- end_ = true;
- *this = raster_->end(poly_,strategy_);
- }
- else
- {
- segments_.clear();
- do
- {
- getNewSegment(linCurrent_);
- if (segments_.empty())
- linCurrent_++;
- else
- break;
- } while (linCurrent_<=linMax_);
- if (linCurrent_ > linMax_)
- {
- end_ = true;
- *this = raster_->end(poly_,strategy_);
- }
- }
- }
- else
- {
- colMin_ = segments_[posSegments_].pt1.x();
- colMax_ = segments_[posSegments_].pt2.x();
- colCurrent_=(int)colMin_;
- }
- }
- return *this;
-}
-
-TeRaster::iteratorPoly
-TeRaster::iteratorPoly::operator++(int)
-{
- iteratorPoly temp = *this;
- ++(*this);
- return temp;
-}
-
-double
-TeRaster::iteratorPoly::operator*()
-{
- double val = 0.0;
- if ((linCurrent_ < nLines_) && (colCurrent_ < nCols_))
- {
- if (raster_->getElement(colCurrent_,linCurrent_,val,band_))
- return val;
- }
- return 0.0;
-}
-
-//! Returns the value of a given band of the element pointed by the iterator
-double
-TeRaster::iteratorPoly::operator*(int band)
-{
- double val = 0.0;
- if ((linCurrent_ < nLines_) && (colCurrent_ < nCols_))
- {
- if (raster_->getElement(colCurrent_,linCurrent_,val,band))
- return val;
- }
- return 0.0;
-}
-
-bool
-TeRaster::iteratorPoly::getProperty(TeProperty& prop)
-{
- double val = 0.0;
- prop.attr_.rep_.type_ = TeREAL;
- if (!raster_) prop.attr_.rep_.name_ = raster_->params().fileName_ + Te2String(band_);
- prop.value_ = Te2String (val);
-
- if ((linCurrent_ < nLines_) && (colCurrent_ < nCols_))
- {
- if (raster_->getElement(colCurrent_,linCurrent_,val,band_))
- {
- prop.value_ = Te2String(val);
- return true;
- }
- }
- return false;
-}
-
-TeRaster*
-TeRasterClipping(TeRaster* whole, TePolygonSet& mask, TeProjection* geomProj, const string& clipName, double background, const string& decId)
-{
- if( decId.empty() ) {
- throw TeException( UNKNOWN_DECODER_TECHNOLOGY_TYPE, "Invalid decoder",
- false );
- }
-
- if( whole == 0 ) {
- throw TeException( UNKNOWN_ERROR_TYPE, "Invalid raster pointer",
- false );
- }
-
- if( mask.empty() ) {
- throw TeException( UNKNOWN_ERROR_TYPE, "Invalid polygon set mask",
- false );
- }
-
- if( ( decId != "MEM" ) && clipName.empty() ) {
- throw TeException( UNKNOWN_ERROR_TYPE, "Invalid clipname",
- false );
- }
-
- if( geomProj == 0 ) {
- throw TeException( UNKNOWN_ERROR_TYPE, "Invalid projection pointer",
- false );
- }
-
- if (whole->params().status_ != TeRasterParams::TeReadyToRead &&
- whole->params().status_ != TeRasterParams::TeReadyToWrite )
- return 0;
-
- bool isEqualProj = (*whole->projection() == *geomProj);
- if (!isEqualProj &&
- (geomProj->name() == "NoProjection" || whole->projection()->name() == "NoProjection"))
- return 0;
-
- TePolygonSet mask2;
- if (!isEqualProj)
- TeVectorRemap(mask,geomProj,mask2,whole->projection());
- else
- mask2 = mask;
-
- if (!TeIntersects(mask2.box(),whole->params().boundingBox()))
- return 0;
-
- TeRasterParams par = whole->params();
- if (!decId.empty())
- {
- par.decoderIdentifier_ = decId;
- if (decId == "DB")
- {
- if (!par.database_)
- return 0;
- }
- }
- par.fileName_ = clipName;
- par.mode_ = 'c';
- TeCoord2D bll = whole->coord2Index(mask2.box().lowerLeft());
- TeCoord2D bur = whole->coord2Index(mask2.box().upperRight());
-
- bll = whole->index2Coord(TeCoord2D(TeRoundRasterIndex(bll.x_),TeRoundRasterIndex(bll.y_)));
- bur = whole->index2Coord(TeCoord2D(TeRoundRasterIndex(bur.x_),TeRoundRasterIndex(bur.y_)));
-
- par.boxResolution(bll.x_, bll.y_, bur.x_, bur.y_,par.resx_, par.resy_);
- par.setDummy(background);
- TeRaster* clip = new TeRaster(par);
- clip->init();
- if (clip->params().status_ != TeRasterParams::TeReadyToWrite)
- return 0;
-
- TeCoord2D cd = TeCoord2D(0,0);
- TeCoord2D ul = clip->params().index2Coord(cd);
- TeCoord2D dxdy = whole->params().coord2Index(ul);
- int j = TeRoundRasterIndex(dxdy.x_); // column delta
- int i = TeRoundRasterIndex(dxdy.y_); // line delta
- unsigned int np = mask2.size();
- unsigned int nb = whole->params().nBands();
- unsigned int band;
- double val;
-
- //progress bar
- if(TeProgress::instance())
- {
- string caption = "Raster Clipping operation";
- TeProgress::instance()->setCaption(caption.c_str());
- string msg = "Executing clipping operation. Please, wait!";
- TeProgress::instance()->setMessage(msg);
- TeProgress::instance()->setTotalSteps(np);
- }
- for (unsigned int p=0; p<np; ++p)
- {
- TeRaster::iteratorPoly it = whole->begin(mask2[p],TeBoxPixelIn);
- while (!it.end())
- {
- for(band = 0; band < nb; ++band)
- {
- if (whole->getElement(it.currentColumn(),it.currentLine(),val,band))
- clip->setElement(it.currentColumn()-j,it.currentLine()-i,val,band);
- }
- ++it;
- }
- //progress bar
- if(TeProgress::instance())
- {
- if(TeProgress::instance()->wasCancelled())
- {
- TeProgress::instance()->reset();
- break;
- }
- TeProgress::instance()->setProgress(p);
- }
- }
- if(TeProgress::instance())
- TeProgress::instance()->reset();
- clip->clear();
- clip->params().mode_ = 'r';
- clip->init();
- return clip;
-}
diff --git a/src/terralib/kernel/TeRaster.h b/src/terralib/kernel/TeRaster.h
deleted file mode 100644
index 583a597..0000000
--- a/src/terralib/kernel/TeRaster.h
+++ /dev/null
@@ -1,525 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeRaster.h
- \brief This file contains structures and definitions to deal with raster structures
-*/
-#ifndef __TERRALIB_INTERNAL_RASTER_H
-#define __TERRALIB_INTERNAL_RASTER_H
-
-#include "TeDecoder.h"
-#include "TeDataTypes.h"
-#include "TeCoord2D.h"
-#include "TeAttribute.h"
-#include "TeGeometry.h"
-#include "TeGeometryAlgorithms.h"
-
-class TeRasterTransform;
-
-#include <map>
-
-//! Strategy used to decide if a pixel is inside/outside a polygon
-enum TeStrategicIterator
-{ TeBoxPixelIn, //!< center of pixel is inside the geometry
- TeBBoxPixelInters, //!< bounding box of pixel intercepts the geometry
- TeBoxPixelOut, //!< center of pixel is outside the geometry
- TeBBoxPixelNotInters //!< bounding box of pixel do not intercept the geometry
-};
-
-/*! \fn bool TeCoordPairVect applyStrategic(double& y, double ymin, double xmin, TeStrategicIterator st, TeRaster* raster, TePolygon& poly);
- \brief Returns
- \param y
- \param ymin
- \param xmin
- \param st pixel in polygon strategy
- \param raster pointer to raster
- \param poly polygon
- */
-TL_DLL TeCoordPairVect applyStrategic(double& y, double ymin, double xmin,
- TeStrategicIterator st, TeRaster* raster, TePolygon& poly);
-
-//! Support for a raster geometry
-/*
- \par A Raster Geometry is made of a matrix of ncolumns x nlines elements
- with nBands dimension. Each element, or pixel, of the raster its is
- indexed by a column, line and band and has a double value associated.
- \par Each Raster geometry has a decoder associated to it. Its decoder
- knows how to get return the value (as a double) of each pixel.
- \par All information about the data is stored in a TeRasterParams structure
- that is duplicated in its decoder.
- \sa TeDecoder TeRasterParams
-*/
-class TL_DLL TeRaster : public TeGeometry
-{
- TeRasterParams params_; //!< structure that describes all information about a raster
- TeDecoder *decoder_; //!< pointer to a decoder of values
-
-public:
- //! Constructor from file
- /*!
- This method tries to instatiate a decoder for this data from the
- file extension of the filename.
- \param filename the name of a file that contains the raster data
- \param mode file opening mode ('r', 'w' or 'c')
- \par Obs: the method init should be called before any attempt to read or write this raster data
- */
- TeRaster(const string& filename, const char& mode = 'r');
-
- //! Constructor from parameters
- /*!
- This method tries to instatiate a decoder for this data. It uses the identification
- explicitly described or the extension of a file name specified in the parameters.
- \param pars a raster parameters structure that contains information about the raster
- \par Obs: the method init should be called before any attempt to read or write data
- to the raster.
- */
- TeRaster(TeRasterParams& pars);
-
- //! Contructor from commom parameters
- /*
- This method creates a raste data in memory, using only the most basic
- parameters:
- \par ncols number of columns
- \par nlines number of lines
- \par nbands number of bands
- \par elemType size of each element
- */
- TeRaster(int ncols, int nlines, int nbands, TeDataType elemType);
-
- //! Empty constructor
- TeRaster() : decoder_(0) {}
-
- //! Destructor
- ~TeRaster ();
-
- //! Returns the parameters of the raster
- TeRasterParams& params();
-
- //! Returns the number of lines of the raster
- int nBands();
-
- //! Update the parametes of a raster file
- /*!
- \param par a new raster parameters structure
- */
- void updateParams(TeRasterParams& par);
-
- //! Returns the type of the geometry
- TeGeomRep elemType();
-
- //! Associate a decoder to a raster
- /*!
- \param dec pointer to a raster decoder
- */
- void setDecoder(TeDecoder* dec);
-
- //! Returns status of the raster as a Boolean value
- /*
- \return true if raster is ready to be read or written and false otherwise
- */
- bool status();
-
- //! Returns a pointer to the decoder associated to this raster
- TeDecoder* decoder();
-
- //! Returns a pointer to the raster projection
- TeProjection* projection();
-
- //! Sets the value of a element of the raster
- /*!
- \param col column number
- \param lin line number
- \param val element value
- \param band band number
- */
- bool setElement (int col, int lin, double val, int band=0);
-
- //! Gets the value of a element of the raster
- /*!
- \param col column number
- \param lin line number
- \param val element value
- \param band band number
- */
- bool getElement (int col, int lin, double& val, int band=0);
-
- //! Fills a destination raster with the raster elements
- /*
- \param dstRaster destination raster
- \param transf pixel evaluator to be used
- \param bestRes flag to indicate that it should use the best resolution available
- */
- bool fillRaster (TeRaster* dstRaster, TeRasterTransform* transf=0, bool bestRes = true);
-
- //! Initalize the raster decoding tool from its parameters
- /*! The result of this method depends on the mode_ specified in the parameters.
- \par 'r' : initializes a raster with reading only permission. If the source
- of the data does not exist it will fail.
- \par 'w' : initializes a raster with reading and writting permission. If the source
- of the data does not exist it will fail.
- \par 'c' : creates a new raster data with default values. Initializes it with
- reading and writting permision. Fails if creation fails.
- */
- bool init();
-
- //! Initalize the raster decoding tool from a raster parameters structure
- /*!
- \return true if raster is read to be read/written and false otherwise.
- */
- bool init(TeRasterParams& pars);
-
- //! Clear internal structures and disable the raster decoding tool
- void clear();
-
- //! Transform a coordinate from line/column domain to projection domain
- TeCoord2D index2Coord(TeCoord2D pt);
-
- //! Transform a coordinate from projection domain domain to line/column
- TeCoord2D coord2Index(TeCoord2D pt);
-
- //----------------
- //! A raster iterator
- /*!
- An strucuture that allows the traversal over the raster elements
- (pixels) in a similar way as the STL iterators.
- */
- class TL_DLL iterator
- {
- public:
- //! Constructor
- /*!
- \param c0 initial column
- \param l0 initial line
- \param nc number of columns
- \param nl number of lines
- \param nb number of bands
- \param pt pointer to the raster to iterate
- */
- iterator(int c0=0, int l0=0, int nc=0, int nl=0, int nb=0, TeRaster* pt=0) :
- linCurrent_(l0),
- colCurrent_(c0),
- nLines_(nl),
- nCols_(nc),
- nBands_(nb),
- raster_(pt)
- {}
-
- //! Destructor
- virtual ~iterator()
- {}
-
- //! Move iterator forward
- virtual void moveForward();
-
- //! Prefix move forward operator
- iterator& operator++();
-
- //! Posfix move forward operator
- iterator operator++(int);
-
- //! Returns iterator current line
- int currentLine();
-
- //! Returns iterator current column
- int currentColumn();
-
- //! Returns the number of bands
- int nBands(void);
-
- //! Iterator de-referencing operator
- /*!
- \return a vector (with nbands_ size) with the values in
- each band, of the element pointed by the iterator
- */
- vector<double> operator*();
-
- //! Returns the value in a given band of a element pointed by the iterator
- double operator*(int band);
-
- //! Returns whether two iterators point to the same element
- bool operator==(const iterator& rhs) const;
-
- //! Returns whether two iterators point to the different elements
- bool operator!=(const iterator& rhs) const;
-
- protected:
- int linCurrent_, colCurrent_;
- int nLines_, nCols_;
- int nBands_;
- TeRaster* raster_;
- };
-
- // --------------------- End of class raster Iterator
-
- //----------------
- //! A raster iterator with a restriction of area
- /*!
- A structure that allows to cover the raster elements
- (pixels) that are IN or OUT a specific region (polygon)
- */
- class TL_DLL iteratorPoly : public iterator
- {
- public:
- //! Constructor
- /*!
- \param colCurr initial column
- \param linCurr initial line
- \param nc number of columns
- \param nl number of lines
- \param nb number of bands
- \param pt pointer to the raster that will be covered
- \param poly polygon that defines a specific region
- \param str strategic of the iterator, IN or OUT the polygon
- \param linMin minimal line of the raster that will be covered
- \param linMax maximal line of the raster that will be covered
- \param colMin minimal column of the raster that will be covered
- \param colMax maximal column of the raster that will be covered
- \param seg the segments of intersection of the current line
- \param posSeg the current segment
- \param nlInPoly number of lines IN the polygon
- \param nColsInPoly number of columns IN the polygon
- \param e iterator end
- \param minLinCM minimal line (in world coordinates)
- \param band band to iterate
- */
- iteratorPoly(int colCurr, int linCurr, int nc, int nl, int nb, TeRaster* pt, TePolygon& poly,
- TeStrategicIterator str, double linMin=0.0, double linMax=0.0, double colMin=0.0,
- double colMax=0.0, TeCoordPairVect seg=TeCoordPairVect(),
- int posSeg=0, int nlInPoly=0, int nColsInPoly=0, bool e=true, double minLinCM=0.0, int band = 0):
- iterator(colCurr,linCurr,nc,nl,nb,pt),
- linMin_(linMin),
- linMax_(linMax),
- colMin_(colMin),
- colMax_(colMax),
- segments_(seg),
- posSegments_(posSeg),
- poly_(poly),
- end_(e),
- strategy_(str),
- nLinesInPoly_(nlInPoly),
- nColsInPoly_(nColsInPoly),
- linMinCM_(minLinCM),
- band_(band)
- {}
-
- //! empty contructor
- iteratorPoly(TeRaster* raster = 0):
- iterator(0,0,0,0,0,raster),
- linMin_(0.0),
- linMax_(0.0),
- colMin_(0.0),
- colMax_(0.0),
- posSegments_(0),
- end_(true),
- nLinesInPoly_(0),
- nColsInPoly_(0),
- band_(0)
- {}
-
- //! destructor
- virtual ~iteratorPoly() {}
-
- void moveForward();
-
- //! Prefix move forward operator
- iteratorPoly& operator++();
-
- //! Prefix move orward operator
- iteratorPoly operator++(int);
-
- //! Dereferencing operator
- /*!
- This operator was designed for compatibility reasons with standard
- containers of STL.
- If there is a band restriction defined it will return the value associated to that band.
- Otherwise will return the value associated to band 0.
- */
- double operator*();
-
- //! Returns the value of a given band of the element pointed by the iterator
- double operator*(int band);
-
- //! Returns the value of of the element pointed by the iterator as TeProperty structure
- /*!
- If there is a band restriction defined it will return the value associated to that band.
- Otherwise will return the value associated to band 0.
- */
- bool getProperty(TeProperty& prop);
-
- //! Returns the last past one element in the polygon
- bool end();
-
- //! Returns the number of lines covered by the iterator
- int nLinesInPoly();
-
- //! Returns the number of columns covered by the iterator
- int nColsInPoly();
-
- private:
-
- //! calculate the segment of the current line that intersect the polygon
- void getNewSegment(int linCurr);
-
- double linMin_, linMax_;
- double colMin_, colMax_;
- TeCoordPairVect segments_;
- int posSegments_;
- TePolygon poly_;
- bool end_;
- TeStrategicIterator strategy_;
- int nLinesInPoly_, nColsInPoly_;
- double linMinCM_; //minimal line in world coordinates
- int band_; // band restriction
- };
-
- //! Returns an iterator to the first element of the raster
- iterator begin();
-
- //! Returns an iterator to the first element of the raster IN or OUT the polygon
- /*!
- \param poly polygon that delimitates the iterator traversal
- \param st stragetegy used to decide if a pixel is in or out a polygon
- \param band optional band restriction
- */
- iteratorPoly begin(TePolygon& poly, TeStrategicIterator st, int band=0);
-
- //! Returns the end past one position of the elements of the raster
- iterator end() ;
- //! Returns an iterator to the end element of the raster
- /*!
- \param poly polygon that delimitates the iterator traversal
- \param st stragetegy used to decide if a pixel is in or out a polygon
- \param band optional band restriction
- */
- iteratorPoly end(TePolygon& poly, TeStrategicIterator st, int band=0);
-
- //! Select all blocks of raster, in a certain resolution factor that intercepts a given bounding box
- bool selectBlocks(TeBox& bb, int resFac, TeRasterParams& parBlock);
-
- //! Returns the number of blocks selected by the last block selection
- int numberOfSelectedBlocks();
-
- //! Returns the current block of a set selected by the last block selection
- bool fetchRasterBlock(TeDecoderMemory* memDec);
-
- //! Clears the current selection of a set selected by the last block selection
- void clearBlockSelection();
-
- //! An optimizated method to set values raster images
- /*
- This method should be used only to set the values of images with 3 bands associated
- respectively to the three colour channes Red, Green and Blue
- \param col column of the image
- \param lin line of the image
- \param Rval the value associated to the band 0 (associated to the R colour Channel)
- \param Gval the value associated to the band 1 (associated to the G colour Channel)
- \param Bval the value associated to the band 2 (associated to the B colour Channel)
- \param transp an optional transparency degree, with a range of 0 (totally transparent) to 255 (totally opaque)
- \return true if if succeed and false otherwise
- */
- bool setElement(int col, int lin, double Rval, double Gval, double Bval, unsigned int /*transp*/ = 255);
-
- //! Give access to the last message detected by the raster manipulation
- const string& errorMessage() const;
-
- private :
-
- //! Building a raster instance from another one is forbiden !
- TeRaster( const TeRaster& ) : TeGeometry()
- {}
-
- //! Copying a raster instance from another one is forbiden !
- const TeRaster& operator=( const TeRaster& ) { return *this; };
-
-};
-
-inline TeRasterParams& TeRaster::params()
-{ return params_; }
-
-inline int TeRaster::nBands()
-{ return params_.nBands(); }
-
-inline TeGeomRep TeRaster::elemType()
-{ return TeRASTER; }
-
-inline bool TeRaster::status()
-{ return params_.status_ != TeRasterParams::TeNotReady; }
-
-inline TeDecoder* TeRaster::decoder()
-{ return decoder_; }
-
-inline TeProjection* TeRaster::projection()
-{ return params_.projection(); }
-
-inline TeCoord2D TeRaster::index2Coord(TeCoord2D pt)
-{ return decoder_->index2Coord(pt); }
-
-inline TeCoord2D TeRaster::coord2Index(TeCoord2D pt)
-{ return decoder_->coord2Index(pt); }
-
-
-inline const string& TeRaster::errorMessage() const
-{ return params_.errorMessage_; }
-
-inline int TeRaster::iterator::currentLine()
-{ return linCurrent_;}
-
-inline int TeRaster::iterator::currentColumn()
-{return colCurrent_; }
-
-inline int TeRaster::iterator::nBands(void)
-{ return nBands_; }
-
-inline bool TeRaster::iteratorPoly::end()
-{ return end_; }
-
-inline int TeRaster::iteratorPoly::nLinesInPoly()
-{ return nLinesInPoly_;}
-
-inline int TeRaster::iteratorPoly::nColsInPoly()
-{ return nColsInPoly_;}
-
-/** @defgroup RasterFunc Raster functions
- A set of functions that manipulates raster representations
- * @{
- */
-/** Clips a raster representation using a polygon set as a mask
- \param whole pointer to the raster to be clipped
- \param mask the polygon set used as the mask to clip the raaster
- \param geomProj pointer the projection of the polygons used as mask
- \param clipName name of the file (or database table) that will contains the clipped raster
- \param background value to be used as the background of the clipped raster
- \param decId optional parameter that explicitly indicates the decoder (or format) used to generate the clipped raster
- \return a pointer to the generated clipped raster if it succeed or a null pointer otherwise.
-
- If the decId is equal to "DB" it is assumed that the clipped raster will be generated
- in the same database as the input raster. If the input raster is not in a database, the
- routine returns a error.
-*/
-TL_DLL TeRaster*
-TeRasterClipping(TeRaster* whole, TePolygonSet& mask, TeProjection* geomProj, const string& clipName, double background, const string& decId="");
-
-//@}
-
-#endif
-
-
diff --git a/src/terralib/kernel/TeRasterMemManager.cpp b/src/terralib/kernel/TeRasterMemManager.cpp
deleted file mode 100644
index 8435add..0000000
--- a/src/terralib/kernel/TeRasterMemManager.cpp
+++ /dev/null
@@ -1,404 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-#include "TeRasterMemManager.h"
-
-#include "TeUtils.h"
-#include "TeErrorLog.h"
-#include "TeAgnostic.h"
-
-
-TeRasterMemManager::TeRasterMemManager()
-{
- init();
-}
-
-
-TeRasterMemManager::~TeRasterMemManager()
-{
- clear();
-}
-
-
-void TeRasterMemManager::clear()
-{
- /* Cleaning the ram tiles and related structures */
-
- TilesPtrsStlVecT::iterator ram_tiles_it = ram_tiles_vec_.begin();
- TilesPtrsStlVecT::iterator ram_tiles_it_end = ram_tiles_vec_.end();
-
- while( ram_tiles_it != ram_tiles_it_end ) {
- delete[] ( (TilePtrT)(*ram_tiles_it) );
- ++ram_tiles_it;
- }
-
- if( all_tiles_ptrs_vec_ ) {
- delete[] all_tiles_ptrs_vec_;
- }
-
- /* cleaning containers */
-
- bands_tiles_sizes_.clear();
- ram_tiles_vec_.clear();
- mm_objs_vec_.clear();
- tile2mm_vec_.clear();
- mm2tile_map_.clear();
-
- /* Reseting the the default values */
-
- init();
-}
-
-bool TeRasterMemManager::reset( unsigned int bands,
- unsigned int tiles_per_band, const std::vector< unsigned int >& tiles_sizes,
- MemoryPolicy mem_pol )
-{
- clear();
-
- TEAGN_TRUE_OR_RETURN( ( ( bands != 0 ) && ( tiles_per_band != 0 ) &&
- ( tiles_sizes.size() == bands ) ), "Invalid parameters" );
-
- tiles_per_band_ = tiles_per_band;
- bands_nmb_ = bands;
- bands_tiles_sizes_ = tiles_sizes;
-
- const unsigned int total_tiles_number = tiles_per_band_ * bands_nmb_;
-
- /* Allocating the tiles vector */
-
- all_tiles_ptrs_vec_ = new TilePtrT[ total_tiles_number ];
- TEAGN_TRUE_OR_RETURN( all_tiles_ptrs_vec_,
- "Unable to allocate the tiles pointers vector" )
-
- for( unsigned int tiles_vects_index = 0 ;
- tiles_vects_index < total_tiles_number ;
- ++tiles_vects_index ) {
-
- all_tiles_ptrs_vec_[ tiles_vects_index ] = 0;
- }
-
- /* Allocating tiles */
-
- if( mem_pol == DiskMemPol ) {
- return allocateMMTiles( 0, 0 );
- } else {
- unsigned int curr_band = 0;
- unsigned int curr_tile = 0;
- TilePtrT newtile_ptr = 0;
- const unsigned long int max_ram_tiles = getMaxRAMTiles( bands_nmb_,
- tiles_per_band_, bands_tiles_sizes_ );
- unsigned int curr_ram_tiles_nmb = 0;
-
- for( curr_band = 0 ; curr_band < bands ; ++curr_band ) {
- unsigned int tile_bytes = bands_tiles_sizes_[ curr_band ];
- TEAGN_TRUE_OR_THROW( ( tile_bytes > 0 ), "Invalid tile bytes" );
-
- unsigned long int curr_tile_index = 0;
-
- for( curr_tile = 0 ; curr_tile < tiles_per_band_ ; ++curr_tile ) {
- curr_tile_index = ( curr_band * tiles_per_band_ ) + curr_tile;
-
- switch( mem_pol ) {
- case RAMMemPol :
- {
- newtile_ptr = (TilePtrT) new TileDataT[ tile_bytes ];
-
- if( newtile_ptr == 0 ) {
- clear();
-
- return false;
- } else {
- all_tiles_ptrs_vec_[ curr_tile_index ] =
- newtile_ptr;
-
- ram_tiles_vec_.push_back( newtile_ptr );
- }
-
- break;
- }
- case AutoMemPol :
- {
- if( curr_ram_tiles_nmb <= max_ram_tiles ) {
- newtile_ptr = (TilePtrT) new TileDataT[ tile_bytes ];
-
- if( newtile_ptr == 0 ) {
- return allocateMMTiles( curr_band, curr_tile );
- } else {
- all_tiles_ptrs_vec_[ curr_tile_index ] =
- newtile_ptr;
-
- ram_tiles_vec_.push_back( newtile_ptr );
-
- ++curr_ram_tiles_nmb;
- }
- } else {
- return allocateMMTiles( curr_band, curr_tile );
- }
-
- break;
- }
- default :
- {
- clear();
-
- TEAGN_LOG_AND_THROW( "Invalid memory policy" );
-
- break;
- }
- }
- }
- }
- }
-
- return true;
-}
-
-
-void TeRasterMemManager::init()
-{
- tiles_per_band_ = 0;
- bands_nmb_ = 0;
- max_mm_file_file_size_ = 1024 * 1024 * 10;
- current_active_mmobj_ptr_ = 0;
- all_tiles_ptrs_vec_ = 0;
-}
-
-
-bool TeRasterMemManager::allocateMMTiles(
- unsigned int starting_band_index, unsigned int starting_tile_index )
-{
- TEAGN_TRUE_OR_THROW( ( bands_tiles_sizes_.size() == bands_nmb_ ),
- "Invalid tile sizes vector" );
- TEAGN_TRUE_OR_THROW( ( starting_band_index < bands_nmb_ ),
- "Invalid starting_band_index" );
- TEAGN_TRUE_OR_THROW( ( starting_tile_index < tiles_per_band_ ),
- "Invalid starting_tile_index" );
-
- /* Resizing the tiles vector */
-
- const unsigned long int total_tiles_number = tiles_per_band_ * bands_nmb_;
-
- tile2mm_vec_.resize( total_tiles_number );
-
- for( unsigned int tile2mm_vec_index = 0 ;
- tile2mm_vec_index < total_tiles_number ;
- ++tile2mm_vec_index ) {
-
- tile2mm_vec_[ tile2mm_vec_index ] = 0;
- }
-
- /* Allocating mapped memory objects */
-
- for( unsigned int curr_band = starting_band_index ; curr_band < bands_nmb_ ;
- ++curr_band ) {
-
- const unsigned int tile_size = bands_tiles_sizes_[ curr_band ];
- TEAGN_TRUE_OR_THROW( ( tile_size <= max_mm_file_file_size_ ),
- "Invalid tile size" );
-
- const unsigned long int tiles_per_file = ( unsigned long int )
- floor( ( (double)max_mm_file_file_size_ ) / ( (double) tile_size ) );
-
- const unsigned long int file_size = (unsigned long int)
- ( tiles_per_file * tile_size );
-
- unsigned int curr_tiles_in_file = tiles_per_file + 1;
-
- unsigned int curr_tile = 0;
- if( curr_band == starting_band_index ) {
- curr_tile = starting_tile_index;
- }
-
- unsigned long int curr_tile_index = 0;
-
- TeMappedMemory* last_mm_ptr = 0;
-
- while( curr_tile < tiles_per_band_ ) {
- curr_tile_index = ( curr_band * tiles_per_band_ ) + curr_tile;
-
- if( curr_tiles_in_file >= tiles_per_file ) {
- TeSharedPtr< TeMappedMemory > mm_ptr(
- new TeMappedMemory() );
-
- if( ! mm_ptr.isActive() ) {
- TEAGN_LOGERR( "Unable to create mapped memory object" );
-
- clear();
-
- return false;
- }
-
- if( ! mm_ptr->reset( file_size, false ) ) {
- TEAGN_LOGERR( "Unable to allocate memory mapped file" );
-
- clear();
-
- return false;
- }
-
- last_mm_ptr = mm_ptr.nakedPointer();
-
- mm_objs_vec_.push_back( mm_ptr );
-
- MM2TileMapNodeT new_mm2tile_node;
- new_mm2tile_node.first = curr_tile_index;
- new_mm2tile_node.second = curr_tile_index;
-
- mm2tile_map_[ last_mm_ptr ] = new_mm2tile_node;
-
- curr_tiles_in_file = 0;
- }
-
- tile2mm_vec_[ curr_tile_index ] = last_mm_ptr;
-
- mm2tile_map_[ last_mm_ptr ].second = curr_tile_index;
-
- ++curr_tiles_in_file;
-
- ++curr_tile;
- }
-
- }
-
- return true;
-}
-
-
-unsigned long int TeRasterMemManager::getMaxRAMTiles( unsigned int bands,
- unsigned int tiles_per_band,
- const std::vector< unsigned int >& tiles_sizes)
-{
- unsigned long int max_ram_tiles = 0;
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- const unsigned int max_ram = (unsigned int)
- ( 0.90 * ( (double)TeGetFreePhysicalMemory() ) );
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- const unsigned int max_ram = (unsigned int)
- ( 0.75 * ( (double)TeGetTotalPhysicalMemory() ) );
- #else
- #error "Unsupported platform"
- #endif
-
- unsigned long int curr_used_ram = 0;
-
- for( unsigned int curr_band = 0 ; curr_band < bands ;
- ++curr_band ) {
-
- const unsigned int tile_size = tiles_sizes[ curr_band ];
-
- for( unsigned int curr_tile = 0 ; curr_tile < tiles_per_band ;
- ++curr_tile ) {
-
- if( ( curr_used_ram + tile_size ) > max_ram ) {
- curr_tile = tiles_per_band;
- curr_band = bands;
- } else {
- ++max_ram_tiles;
- curr_used_ram += tile_size;
- }
- }
- }
-
- return max_ram_tiles;
-}
-
-
-void* TeRasterMemManager::getTilePointer( const unsigned int& band,
- const unsigned int& tile)
-{
- const unsigned int tileindex = ( band * tiles_per_band_ ) + tile;
-
- TEAGN_DEBUG_CONDITION( ( tileindex < ( tiles_per_band_ * bands_nmb_ ) ),
- "The required band/tile out of range" );
-
- TilePtrT tileptr = all_tiles_ptrs_vec_[ tileindex ];
-
- if( tileptr == 0 ) {
- /* Disabling the current mapping - only one active mapping allowed */
-
- if( current_active_mmobj_ptr_ ) {
- MM2TilesMapT::iterator it =
- mm2tile_map_.find( current_active_mmobj_ptr_ );
-
- TEAGN_DEBUG_CONDITION( ( it != mm2tile_map_.end() ),
- "Cannot find tile into mapped memory to tiles map" );
-
- current_active_mmobj_ptr_->toggle( false );
-
- const unsigned long int first_tile_index = it->second.first;
- const unsigned long int last_tile_index_bound = it->second.second + 1;
-
- for( unsigned long int all_tiles_ptrs_vec_index = first_tile_index ;
- all_tiles_ptrs_vec_index < last_tile_index_bound ;
- ++all_tiles_ptrs_vec_index ) {
-
- all_tiles_ptrs_vec_[ all_tiles_ptrs_vec_index ] = 0;
- }
- }
-
- /* Enabling the required mapping */
-
- TEAGN_DEBUG_CONDITION( ( tileindex < tile2mm_vec_.size() ),
- "Tiles to mapped memory objects vector index mismatch" );
-
- current_active_mmobj_ptr_ = tile2mm_vec_[ tileindex ];
- TEAGN_DEBUG_CONDITION( ( current_active_mmobj_ptr_ != 0 ),
- "Invalid active mapping object" );
- TEAGN_TRUE_OR_THROW( current_active_mmobj_ptr_->toggle( true ),
- "Unable to activate mapped memory" );
-
- /* Updating main vactor mapped memory tiles pointers */
-
- TilePtrT mm_start_ptr = ( TilePtrT )
- current_active_mmobj_ptr_->getPointer();
-
- TEAGN_DEBUG_CONDITION( ( band < bands_tiles_sizes_.size() ),
- "Invalid band" );
- const unsigned long int tile_size = bands_tiles_sizes_[ band ];
-
- MM2TilesMapT::iterator it =
- mm2tile_map_.find( current_active_mmobj_ptr_ );
- TEAGN_DEBUG_CONDITION( ( it != mm2tile_map_.end() ),
- "Cannot find tile into mapped memory to tiles map" );
-
- const unsigned long int first_tile_index = it->second.first;
- const unsigned long int last_tile_index_bound = it->second.second + 1;
-
- for( unsigned long int all_tiles_ptrs_vec_index = first_tile_index ;
- all_tiles_ptrs_vec_index < last_tile_index_bound ;
- ++all_tiles_ptrs_vec_index ) {
-
- all_tiles_ptrs_vec_[ all_tiles_ptrs_vec_index ] = mm_start_ptr;
-
- mm_start_ptr += tile_size;
- }
-
- tileptr = all_tiles_ptrs_vec_[ tileindex ];
- }
-
- TEAGN_DEBUG_CONDITION( ( tileptr != 0 ), "Invalid tile pointer" )
-
- return tileptr;
-}
-
-
diff --git a/src/terralib/kernel/TeRasterMemManager.h b/src/terralib/kernel/TeRasterMemManager.h
deleted file mode 100644
index 0fde0a2..0000000
--- a/src/terralib/kernel/TeRasterMemManager.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeRasterMemManager.h
- \brief This file contains a class that deals with a raster memory management
-*/
-
-#ifndef TERASTERMEMMANAGER_H
- #define TERASTERMEMMANAGER_H
-
- #include "TeMappedMemory.h"
- #include "TeSharedPtr.h"
-
- #include <vector>
- #include <map>
-
- /**
- * @brief This class deals with a raster memory management.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- */
- class TL_DLL TeRasterMemManager {
-
- public :
-
- /**
- * @enum Memory policy.
- */
- enum MemoryPolicy {
- /**
- * @brief Automatic memory policy ( Try to use RAM or DISK,
- * if there is no avaliable RAM ).
- */
- AutoMemPol = 1,
- /**
- * @brief RAM memory policy.
- */
- RAMMemPol = 2,
- /**
- * @brief Disk memory policy ( virtual mapped memory ).
- */
- DiskMemPol = 3
- };
-
- /**
- * @brief Default Constructor.
- */
- TeRasterMemManager();
-
- /**
- * @brief Default Destructor
- */
- ~TeRasterMemManager();
-
- /**
- * @brief Clear all data structures.
- */
- void clear();
-
- /**
- * @brief Reset the instance following new raster parameters.
- * @param bands The number of bands (channels).
- * @param tiles_per_band The tiles inside each band.
- * @param tiles_sizes The tile size (bytes) for each band.
- * @param mem_pol Memory policy.
- * @return true if OK, false on errors.
- */
- bool reset( unsigned int bands, unsigned int tiles_per_band,
- const std::vector< unsigned int >& tiles_sizes,
- MemoryPolicy mem_pol );
-
- /**
- * @brief Returnas a pointer to a internal allocated tile.
- * @param band Band index.
- * @param tile Tile index.
- * @return a pointer to a internal allocated tile.
- * @note This pointer is only valid until the next call to this function.
- */
- void* getTilePointer( const unsigned int& band,
- const unsigned int& tile );
-
- protected :
-
- /**
- * @typedef unsigned char TileDataT
- * Tile data type.
- */
- typedef unsigned char TileDataT;
-
- /**
- * @typedef TileDataT* TilePtrT
- * Tile pointer type.
- */
- typedef TileDataT* TilePtrT;
-
- /**
- * @typedef std::vector< TilePtrT > TilesPtrsStlVecT
- * RAM Tiles vector type.
- */
- typedef std::vector< TilePtrT > TilesPtrsStlVecT;
-
- /**
- * @typedef std::vector< TeSharedPtr< TeMappedMemory > > MMemsVecT
- * Mapped memory objects vector type.
- */
- typedef std::vector< TeSharedPtr< TeMappedMemory > > MMemsVecT;
-
- /**
- * @typedef std::pair< unsigned long int, unsigned long int > MM2TileMapNodeT
- * Mapped memory to first and last tiles indexes map node type.
- */
- typedef std::pair< unsigned long int, unsigned long int >
- MM2TileMapNodeT;
-
- /**
- * @typedef std::multimap< TeMappedMemory*, std::pair< unsigned long int, unsigned long int > MM2TilesMapT
- * Mapped memory to first and last tiles indexes map type.
- */
- typedef std::map< TeMappedMemory*, MM2TileMapNodeT > MM2TilesMapT;
-
- /**
- * @brief Tiles per band.
- */
- unsigned int tiles_per_band_;
-
- /**
- * @brief The number of bands.
- */
- unsigned int bands_nmb_;
-
- /**
- * @brief The maximum mapped memory file size.
- */
- unsigned long int max_mm_file_file_size_;
-
- /**
- * @brief A pointer to the current active memory map object.
- */
- TeMappedMemory* current_active_mmobj_ptr_;
-
- /**
- * @brief A vector of tiles sizes for each band.
- */
- std::vector< unsigned int > bands_tiles_sizes_;
-
- /**
- * @brief A vector of pointers to all allocated tiles.
- * @note Declared as a simple vector to optimize the
- * tile access.
- */
- TilePtrT* all_tiles_ptrs_vec_;
-
- /**
- * @brief RAM bands pointers vector.
- */
- TilesPtrsStlVecT ram_tiles_vec_;
-
- /**
- * @brief Mapped memory objects pointers vector.
- */
- MMemsVecT mm_objs_vec_;
-
- /**
- * @brief A vector mapping tiles indexes to their respective mapped
- * memory object.
- */
- std::vector< TeMappedMemory* > tile2mm_vec_;
-
- /**
- * @brief A map from mapped memory object pointers to their respective
- * tile indexes.
- */
- MM2TilesMapT mm2tile_map_;
-
- /**
- * @brief Initiates the internal variables to their default values.
- */
- void init();
-
- /**
- * @brief Allocate mapped memory tiles starting at a specific
- * band and tile number.
- * @param starting_band_index Starting Band index.
- * @param starting_tile_index Starting tile index.
- * @return true if OK, false on errors.
- * @note bands_ptr_ must be previously allocated.
- */
- bool allocateMMTiles(
- unsigned int starting_band_index,
- unsigned int starting_tile_index );
-
- /**
- * @brief Return the maximum RAM tiles that can fit in the
- * current RAM for all bands.
- * @param bands The number of bands (channels).
- * @param tiles_per_band The tiles inside each band.
- * @param tiles_sizes The tile size (bytes) for each band.
- * @return Return the maximum RAM tiles.
- */
- unsigned long int getMaxRAMTiles( unsigned int bands,
- unsigned int tiles_per_band,
- const std::vector< unsigned int >& tiles_sizes );
-
- private :
-
- /**
- * @brief Alternative Constructor.
- * @param ext External reference.
- */
- TeRasterMemManager( const TeRasterMemManager& ) {};
-
- /**
- * @brief =operator implementation.
- * @param ext External reference.
- */
- const TeRasterMemManager& operator=( const TeRasterMemManager& )
- { return *this; };
-
- };
-
-#endif
-
diff --git a/src/terralib/kernel/TeRasterParams.cpp b/src/terralib/kernel/TeRasterParams.cpp
deleted file mode 100644
index e0aa52d..0000000
--- a/src/terralib/kernel/TeRasterParams.cpp
+++ /dev/null
@@ -1,877 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeRasterParams.h"
-#include "TeUtils.h"
-#include "TeAsciiFile.h"
-#include "TeAgnostic.h"
-#include <cstdlib>
-
-// copy constructor
-TeRasterParams::TeRasterParams(const TeRasterParams& other)
-{
- resolution_ = other.resolution_;
- subBand_ = other.subBand_;
- nlines_ = other.nlines_;
- ncols_ = other.ncols_;
- nbands_ = other.nbands_;
- lutName_ = other.lutName_;
- swap_ = other.swap_;
- useDummy_ = other.useDummy_;
-
- nbitsperPixel_.clear();
- vmin_.clear();
- vmax_.clear();
- bands_.clear();
- photometric_.clear();
- dataType_.clear();
- dummy_.clear();
- compression_.clear();
-
- nbitsperPixel_= other.nbitsperPixel_;
- vmin_= other.vmin_;
- vmax_= other.vmax_;
- bands_= other.bands_;
- photometric_= other.photometric_;
- dataType_= other.dataType_;
- dummy_= other.dummy_;
- compression_= other.compression_;
-
- resx_ = other.resx_;
- resy_ = other.resy_;
- fileName_ = other.fileName_;
- mode_ = other.mode_;
- status_ = other.status_;
- offset_ = other.offset_;
- tiling_type_ = other.tiling_type_;
- blockHeight_ = other.blockHeight_;
- blockWidth_ = other.blockWidth_;
- decoderIdentifier_ = other.decoderIdentifier_;
- nTilesInMemory_ = other.nTilesInMemory_;
- if (other.projection_)
- projection_ = TeProjectionFactory::make(other.projection_->params());
- else
- projection_=0;
- box_ = other.box_;
- database_ = other.database_;
- layerId_ = other.layerId_;
- objectId_ = other.objectId_;
-
- interleaving_ = other.interleaving_;
-
- lutr_.clear();
- lutg_.clear();
- lutb_.clear();
- lutr_ = other.lutr_;
- lutg_ = other.lutg_;
- lutb_ = other.lutb_;
-
- dyJ_ = other.dyJ_;
- dxI_ = other.dxI_;
- dyI_ = other.dyI_;
- dxJ_ = other.dxJ_;
- x0_ = other.x0_;
- y0_ = other.y0_;
- errorMessage_ = other.errorMessage_;
- hasSetDummy_ = other.hasSetDummy_;
-}
-
-// operator =
-TeRasterParams&
-TeRasterParams::operator=(const TeRasterParams& rhs)
-{
- if ( this != &rhs )
- {
- resolution_ = rhs.resolution_;
- subBand_ = rhs.subBand_;
- nlines_ = rhs.nlines_;
- ncols_ = rhs.ncols_;
- nbands_ = rhs.nbands_;
- swap_ = rhs.swap_;
- useDummy_ = rhs.useDummy_;
- lutName_ = rhs.lutName_;
-
- nbitsperPixel_.clear();
- vmin_.clear();
- vmax_.clear();
- bands_.clear();
- photometric_.clear();
- dataType_.clear();
- dummy_.clear();
- compression_.clear();
-
- nbitsperPixel_= rhs.nbitsperPixel_;
- vmin_= rhs.vmin_;
- vmax_= rhs.vmax_;
- bands_= rhs.bands_;
- photometric_= rhs.photometric_;
- dataType_= rhs.dataType_;
- dummy_= rhs.dummy_;
- compression_= rhs.compression_;
-
- resx_ = rhs.resx_;
- resy_ = rhs.resy_;
- fileName_ = rhs.fileName_;
- mode_ = rhs.mode_;
- status_ = rhs.status_;
- offset_ = rhs.offset_;
- tiling_type_ = rhs.tiling_type_;
- blockHeight_ = rhs.blockHeight_;
- blockWidth_ = rhs.blockWidth_;
- decoderIdentifier_ = rhs.decoderIdentifier_;
- nTilesInMemory_ = rhs.nTilesInMemory_;
- if (projection_)
- {
- delete projection_;
- projection_ = 0;
- }
- if (rhs.projection_)
- projection_ = TeProjectionFactory::make(rhs.projection_->params());
- box_ = rhs.box_;
- database_ = rhs.database_;
- layerId_ = rhs.layerId_;
- objectId_ = rhs.objectId_;
- interleaving_ = rhs.interleaving_;
-
- lutr_.clear();
- lutg_.clear();
- lutb_.clear();
- lutr_ = rhs.lutr_;
- lutg_ = rhs.lutg_;
- lutb_ = rhs.lutb_;
-
- dyJ_ = rhs.dyJ_;
- dxI_ = rhs.dxI_;
- x0_ = rhs.x0_;
- y0_ = rhs.y0_;
- dyI_ = rhs.dyI_;
- dxJ_ = rhs.dxJ_;
- errorMessage_ = rhs.errorMessage_;
- hasSetDummy_ = rhs.hasSetDummy_;
- }
- return *this;
-}
-
-void
-TeRasterParams::resizeToTiling(TeBox& bb, int bWidth, int bHeight)
-{
- blockHeight_ = bHeight;
- blockWidth_ = bWidth;
-
- double bXSize = bWidth*resx_;
- double bYSize = bHeight*resy_;
-
- TeBox baux = adjustToCut(bb, bXSize, bYSize);
- this->boundingBoxResolution(baux.x1_,baux.y1_,baux.x2_,baux.y2_,resx_,resy_);
-}
-
-//! Calculates the *bounding box* when box coordinates are relative to the center of the pixel
-TeBox
-TeRasterParams::boundingBox ()
-{ return TeBox (box_.x1()-resx_/2.,
- box_.y1()-resy_/2.,
- box_.x2()+resx_/2.,
- box_.y2()+resy_/2.);
-}
-
-void
-TeRasterParams::boundingBoxResolution (double x1, double y1, double x2, double y2, double resx, double resy, TeBox::TeBoxCorner lock)
-{
- double xx2 = x2; //FAMI
-
- resx_ = resx;
- resy_ = resy;
- ncols_ = (int)((x2-x1)/resx_+0.5);
-//FAMI BEGIN
- if ( (x1+360.) == x2 ) //around the globe
- {
- ncols_--;
- xx2 = x2 - resx_;
- }
-//FAMI END
- nlines_ = (int)((y2-y1)/resy_+0.5);
-
- if (lock == TeBox::TeUPPERLEFT)
- box_ = TeBox(x1+0.5*resx_, y2-nlines_*resy_+0.5*resy_,
- x1+ncols_*resx_-0.5*resx_, y2-0.5*resy_);
-
- else if (lock == TeBox::TeLOWERLEFT)
- box_ = TeBox(x1+0.5*resx_, y1+0.5*resy_,
- x1+ncols_*resx_-0.5*resx_, y1+nlines_*resy_-0.5*resy_);
-
- else if (lock == TeBox::TeUPPERRIGHT)
-//FAMI box_ = TeBox(x2-ncols_*resx_+0.5*resx_, y2-nlines_*resy_+0.5*resy_,
-//FAMI x2-0.5*resx_,y2-0.5*resy_);
- box_ = TeBox(xx2-ncols_*resx_+0.5*resx_, y2-nlines_*resy_+0.5*resy_,
- xx2-0.5*resx_,y2-0.5*resy_);
-
- else // TeLOWERRIGHT
-//FAMI box_ = TeBox(x2-ncols_*resx_+0.5*resx_,y1+0.5*resy_,
-//FAMI x2-0.5*resx_,y1+nlines_*resy_-0.5*resy_);
- box_ = TeBox(xx2-ncols_*resx_+0.5*resx_,y1+0.5*resy_,
- xx2-0.5*resx_,y1+nlines_*resy_-0.5*resy_);
-}
-
-void
-TeRasterParams::boundingBoxLinesColumns (double x1, double y1, double x2, double y2,
- int nlines, int ncols, TeBox::TeBoxCorner lock)
-{
- nlines_ = nlines;
- ncols_ = ncols;
-
- resx_ = (x2-x1)/ncols_;
- resy_ = (y2-y1)/nlines_;
-
- if (lock == TeBox::TeUPPERLEFT)
- box_ = TeBox(x1+0.5*resx_, y2-nlines_*resy_+0.5*resy_,
- x1+ncols_*resx_-0.5*resx_, y2-0.5*resy_);
-
- else if (lock == TeBox::TeLOWERLEFT)
- box_ = TeBox(x1+0.5*resx_, y1+0.5*resy_,
- x1+ncols_*resx_-0.5*resx_, y1+nlines_*resy_-0.5*resy_);
-
- else if (lock == TeBox::TeUPPERRIGHT)
- box_ = TeBox(x2-ncols_*resx_+0.5*resx_, y2-nlines_*resy_+0.5*resy_,
- x2-0.5*resx_,y2-0.5*resy_);
-
- else // TeLOWERRIGHT
- box_ = TeBox(x2-ncols_*resx_+0.5*resx_,y1+0.5*resy_,
- x2-0.5*resx_,y1+nlines_*resy_-0.5*resy_);
-}
-
-void
-TeRasterParams::boxResolution (double x1, double y1, double x2, double y2,
- double resx, double resy, TeBox::TeBoxCorner lock)
-{
- resx_ = resx;
- resy_ = resy;
-
- ncols_ = (int)((x2-x1)/resx_+0.45)+1;
- nlines_ = (int)((y2-y1)/resy_+0.45)+1;
-
- if (lock == TeBox::TeUPPERLEFT)
- box_ = TeBox(x1, y2-(nlines_-1)*resy_,x1+(ncols_-1)*resx_,y2);
-
- else if (lock == TeBox::TeLOWERLEFT)
- box_ = TeBox(x1, y1,x1+(ncols_-1)*resx_,y1+(nlines_-1)*resy_);
-
- else if (lock == TeBox::TeUPPERRIGHT)
- box_ = TeBox(x2-(ncols_-1)*resx_, y2-(nlines_-1)*resy_,x2,y2);
-
- else // TeLOWERRIGHT
- box_ = TeBox(x2-(ncols_-1)*resx_,y1,x2,y1+(nlines_-1)*resy_);
-}
-
-void
-TeRasterParams::boxLinesColumns (double x1, double y1, double x2, double y2,
- int nlines, int ncols, TeBox::TeBoxCorner lock)
-{
- nlines_ = nlines;
- ncols_ = ncols;
-
- resx_ = (x2-x1)/(ncols_-1);
- resy_ = (y2-y1)/(nlines_-1);
-
- if (lock == TeBox::TeUPPERLEFT)
- box_ = TeBox(x1, y2-(nlines_-1)*resy_,x1+(ncols_-1)*resx_,y2);
-
- else if (lock == TeBox::TeLOWERLEFT)
- box_ = TeBox(x1, y1,x1+(ncols_-1)*resx_,y1+(nlines_-1)*resy_);
-
- else if (lock == TeBox::TeUPPERRIGHT)
- box_ = TeBox(x2-(ncols_-1)*resx_, y2-(nlines_-1)*resy_,x2,y2);
-
- else // TeLOWERRIGHT
- box_ = TeBox(x2-(ncols_-1)*resx_,y1,x2,y1+(nlines_-1)*resy_);
-}
-
-void
-TeRasterParams::topLeftResolutionSize (double left, double top,
- double resx, double resy,
- int ncol, int nlin,
- bool coordIsCentrePixel)
-{
- resx_ = resx;
- resy_ = resy;
- ncols_ = ncol;
- nlines_ = nlin;
-
- if (coordIsCentrePixel)
- box_ = TeBox(left,top-(nlin-1)*resy_,left+(ncol-1)*resx_,top);
- else
- {
- TeBox bb(left,top-nlines_*resy_,left+ncols_*resx_,top);
- box_ = TeBox(bb.x1()+resx_/2.,
- bb.y1()+resy_/2.,
- bb.x2()-resx_/2.,
- bb.y2()-resy_/2.);
- }
-}
-
-void
-TeRasterParams::lowerLeftResolutionSize (double left, double lower,
- double resx, double resy,
- int ncol, int nlin,
- bool coordIsCentrePixel)
-{
- resx_ = resx;
- resy_ = resy;
- ncols_ = ncol;
- nlines_ = nlin;
-
- if (coordIsCentrePixel)
- box_ = TeBox(left,lower,left+(ncol-1)*resx_,lower+(nlin-1)*resy_);
- else
- {
- TeBox bb(left,lower,left+ncols_*resx_,lower+nlines_*resy_);
- box_ = TeBox(bb.x1()+resx_/2.,
- bb.y1()+resy_/2.,
- bb.x2()-resx_/2.,
- bb.y2()-resy_/2.);
- }
-}
-
-void
-TeRasterParams::nBands(int n)
-{
- TEAGN_TRUE_OR_THROW( ( n > 0 ), "Invalid number of bands" )
-
- if (nbands_ != n)
- {
- if ( nbands_ == 0 ) {
- nbitsperPixel_.resize(nbands_);
- vmin_.resize(nbands_);
- vmax_.resize(nbands_);
- bands_.resize(nbands_);
- photometric_.resize(nbands_);
- dataType_.resize(nbands_);
- dummy_.resize(nbands_);
- compression_.resize(nbands_);
- double d = dummy_[0];
- for (int i = 0; i<n; i++)
- {
- bands_[i] = i;
- vmin_[i] = TeMAXFLOAT;
- vmax_[i] = -TeMAXFLOAT;
- dataType_[i] = TeUNSIGNEDCHAR;
- photometric_[i] = TeRasterParams::TeUnknown;
- dummy_[i] = d;
- }
- } else if ( nbands_ > n ) {
- for( unsigned int count = ( nbands_ - n ) ; count > 0 ; --count ) {
- nbitsperPixel_.pop_back();
- vmin_.pop_back();
- vmax_.pop_back();
- bands_.pop_back();
- photometric_.pop_back();
- dataType_.pop_back();
- dummy_.pop_back();
- compression_.pop_back();
- }
- } else {
- /* nbands_ < n */
-
- for( unsigned int count = ( n - nbands_ ) ; count > 0 ; --count ) {
- nbitsperPixel_.push_back( nbitsperPixel_[ nbands_ - 1 ] );
- vmin_.push_back( vmin_[ nbands_ - 1 ] );
- vmax_.push_back( vmax_[ nbands_ - 1 ] );
- bands_.push_back( bands_[ nbands_ - 1 ] );
- photometric_.push_back( photometric_[ nbands_ - 1 ] );
- dataType_.push_back( dataType_[ nbands_ - 1 ] );
- dummy_.push_back( dummy_[ nbands_ - 1 ] );
- compression_.push_back( compression_[ nbands_ - 1 ] );
- }
- }
-
- nbands_ = n;
- }
-}
-
-void
-TeRasterParams::projection(TeProjection* proj)
-{
- if (projection_)
- {
- delete projection_;
- projection_ = 0;
- }
- if (proj)
- projection_ = TeProjectionFactory::make(proj->params());
-}
-
-void
-TeRasterParams::setDataType(TeDataType type, int band)
-{
- int nb = 8;
- double defValue = 0.0;
- switch (type) {
- case TeUNSIGNEDCHAR:
- nb = sizeof(unsigned char)*8;
- defValue = 255;
- break;
- case TeCHAR :
- defValue = 255;
- nb = sizeof(char)*8;
- break;
- case TeUNSIGNEDSHORT:
- nb = sizeof(unsigned short)*8;
- defValue = pow(2.,nb)-1;
- break;
- case (TeSHORT):
- nb = sizeof(short)*8;
- defValue = pow(2.,nb)-1;
- break;
- case (TeUNSIGNEDLONG):
- nb = sizeof(unsigned long)*8;
- defValue = pow(2.,nb)-1;
- break;
- case (TeLONG):
- nb = sizeof(long)*8;
- break;
- case (TeFLOAT):
- nb = sizeof(float)*8;
- defValue = pow(2.,nb)-1;
- break;
- case (TeDOUBLE):
- nb = sizeof(double)*8;
- defValue = TeMAXFLOAT;
- break;
- default:
- break;
- }
- if (band<0 || band>= (int)dataType_.size())
- for (unsigned int i=0; i<dataType_.size();++i)
- {
- dataType_[i]=type;
- nbitsperPixel_[i]=nb;
- if (!hasSetDummy_)
- dummy_[i]=defValue;
- }
- else
- {
- dataType_[band]=type;
- nbitsperPixel_[band]=nb;
- dummy_[band]=defValue;
- }
-}
-
-int TeRasterParams::elementSize(int band)
-{
- switch (dataType_[band]) {
- case TeUNSIGNEDCHAR:
- return sizeof(unsigned char);
- case TeCHAR :
- return sizeof(char);
- case TeUNSIGNEDSHORT:
- return sizeof(unsigned short);
- case (TeSHORT):
- return sizeof(short);
- case TeINTEGER:
- return sizeof(int);
- case (TeUNSIGNEDLONG):
- return (sizeof(unsigned long));
- case (TeLONG):
- return (sizeof(long));
- case (TeFLOAT):
- return (sizeof(float));
- default:
- return (sizeof(double));
- }
-}
-
-
-void
-TeRasterParams::setPhotometric(TeRasterParams::TeRasterPhotometricInterpretation photom, int band)
-{
- if (band<0 || band>= (int)photometric_.size())
- for (unsigned int i=0; i<photometric_.size(); photometric_[i]=photom,i++);
- else
- photometric_[band]=photom;
-}
-
-void
-TeRasterParams::setCompressionMode(TeRasterParams::TeRasterCompressionMode cmode, int band)
-{
- if (band<0 || band>= (int)compression_.size())
- for (unsigned int i=0; i<compression_.size(); compression_[i]=cmode,i++);
- else
- compression_[band] = cmode;
-}
-
-void
-TeRasterParams::setDummy(double dummy, int band)
-{
- if (band<0 || band>= (int)dummy_.size())
- for (unsigned int i=0; i<dummy_.size(); dummy_[i]=dummy,i++);
- else
- dummy_[band] = dummy;
- this->useDummy_ = true;
- hasSetDummy_ = true;
-}
-
-TeCoord2D
-TeRasterParams::coord2Index (const TeCoord2D& pt) const
-{
- double i, j;
- if (dxI_ != 0 || dyJ_ != 0)
- {
- double x = pt.x();
- double y = pt.y();
-
- i = (dyJ_*(x-x0_)-dxJ_*(y-y0_))/(dxI_*dyJ_-dxJ_*dyI_);
- j = (x-x0_-i*dxI_)/dxJ_;
- return TeCoord2D (j,i);
- }
- else
- {
- i = (pt.x() - box_.x1()) / resx_;
- j = (box_.y2() - pt.y()) / resy_;
- return TeCoord2D (i,j);
- }
-}
-
-TeCoord2D
-TeRasterParams::index2Coord (const TeCoord2D& pt) const
-{
- double x,y;
- double i = pt.y();
- double j = pt.x();
-
- if (dxI_ != 0 || dyJ_ != 0)
- {
- x = x0_ + i*dxI_ + j*dxJ_;
- y = y0_ + i*dyI_ + j*dyJ_;
- }
- else
- {
- x = box_.x1() + pt.x() * resx_;
- y = box_.y2() - pt.y() * resy_;
- }
- return TeCoord2D (x,y);
-}
-
-void
-TeRasterParams::writeParametersFile()
-{
- string metFileName = TeGetName (fileName_.c_str())+".met";
- try {
- TeAsciiFile metFile(metFileName,"w");
- string line = "%Raw raster file metadata\n";
- metFile.writeString(line);
- line = "NROWS " + Te2String(nlines_);
- metFile.writeString(line);
- metFile.writeNewLine();
- line = "NCOLS " + Te2String(ncols_);
- metFile.writeString(line);
- metFile.writeNewLine();
- line = "NBANDS " + Te2String(this->nBands());
- metFile.writeString(line);
- metFile.writeNewLine();
-
- if (this->nBands() > 1)
- {
- line = "INTERLEAVING ";
- if (interleaving_ == TeRasterParams::TePerPixel)
- line += "BIP";
- else if (interleaving_ == TeRasterParams::TePerLine)
- line += "BIL";
- else
- line += "BSQ";
- metFile.writeString(line);
- metFile.writeNewLine();
- }
-
- int ndecimals = 0;
- line = "DATATYPE ";
- if (dataType_[0] == TeBIT)
- line += "bit";
- else if (dataType_[0] == TeUNSIGNEDCHAR)
- line += "unsignedchar";
- else if (dataType_[0] == TeCHAR)
- line += "char";
- else if (dataType_[0] == TeUNSIGNEDSHORT)
- line += "unsignedshort";
- else if (dataType_[0] == TeSHORT)
- line += "short";
- else if (dataType_[0] == TeINTEGER)
- line += "integer";
- else if (dataType_[0] == TeUNSIGNEDLONG)
- line += "unsignedlong";
- else if (dataType_[0] == TeLONG)
- line += "long";
- else if (dataType_[0] == TeFLOAT)
- {
- line += "float";
- ndecimals = 6;
- }
- else if (dataType_[0] == TeDOUBLE)
- {
- line += "double";
- ndecimals = 10;
- }
- metFile.writeString(line);
- metFile.writeNewLine();
-
- if (swap_)
- {
- line = "SWAPPED yes";
- metFile.writeString(line);
- metFile.writeNewLine();
- }
- else
- line.clear();
- if (useDummy_)
- {
- line += "NO_DATA " + Te2String(dummy_[0], ndecimals);
- metFile.writeString(line);
- metFile.writeNewLine();
- }
-
- if( projection_ ) {
- if (projection_->name() == "NoProjection" ||
- projection_->name() == "LatLong") {
-
- ndecimals = 8;
- } else {
- ndecimals = 3;
- }
- } else {
- ndecimals = 8;
- }
-
- line = "RESOLUTION_X " + Te2String(resx_,ndecimals);
- metFile.writeString(line);
- metFile.writeNewLine();
- line = "RESOLUTION_Y " + Te2String(resy_,ndecimals);
- metFile.writeString(line);
- metFile.writeNewLine();
- line = "LOWERLEFT_X " + Te2String(this->box().x1_,ndecimals);
- metFile.writeString(line);
- metFile.writeNewLine();
- line = "LOWERLEFT_Y " + Te2String(this->box().y1_,ndecimals);
- metFile.writeString(line);
- metFile.writeNewLine();
- if (this->projection())
- {
- line = "PROJECTION ";
- line += this->projection()->describe();
- metFile.writeString(line);
- metFile.writeNewLine();
- line = "DATUM " + this->projection()->datum().name();
- metFile.writeString(line);
- }
- }
- catch(...)
- {
- }
-}
-
-
-
-void
-TeRasterParams::readParametersFile()
-{
- // read all keys in the metadata file (there is no order expected)
- string metFileName = TeGetName (fileName_.c_str())+".met";
- map<string,string> metadata;
- try {
- TeAsciiFile metFile(metFileName,"r");
- string key, value;
- while (metFile.isNotAtEOF())
- {
- key = metFile.readString();
- if (key[0] == '%')
- {
- metFile.findNewLine();
- continue;
- }
- value = metFile.readString();
- metadata.insert(make_pair(key,value));
- metFile.findNewLine();
- }
- }
- catch(...)
- {
- }
- if (!metadata.empty())
- {
- double xll=0, yll=0;
- map<string,string>::iterator it;
- it = metadata.find("NROWS");
- if (it != metadata.end())
- nlines_ = atoi(it->second.c_str());
- it = metadata.find("NCOLS");
- if (it != metadata.end())
- ncols_ = atoi(it->second.c_str());
- it = metadata.find("NBANDS");
- if (it != metadata.end())
- this->nBands(atoi(it->second.c_str()));
- else
- this->nBands(1);
- it = metadata.find("RESOLUTION_X");
- if (it != metadata.end())
- resx_ = atof(it->second.c_str());
- it = metadata.find("RESOLUTION_Y");
- if (it != metadata.end())
- resy_ = atof(it->second.c_str());
- it = metadata.find("LOWERLEFT_X");
- if (it != metadata.end())
- {
- xll = atof(it->second.c_str());
- it = metadata.find("LOWERLEFT_Y");
- if (it != metadata.end())
- {
- yll = atof(it->second.c_str());
- lowerLeftResolutionSize(xll,yll, resx_, resy_,ncols_, nlines_);
- }
- }
- it = metadata.find("INTERLEAVING");
- if (it != metadata.end())
- {
- if (it->second == "BIL")
- interleaving_ = TeRasterParams::TePerLine;
- else if (it->second == "BSQ")
- interleaving_ = TeRasterParams::TePerBand;
- else interleaving_ = TeRasterParams::TePerPixel;
- }
-
- it = metadata.find("DATATYPE");
- if (it != metadata.end())
- {
- if (it->second == "bit")
- this->setDataType(TeBIT);
- else if (it->second == "unsignedchar")
- this->setDataType(TeUNSIGNEDCHAR);
- else if (it->second == "char")
- this->setDataType(TeCHAR);
- else if (it->second == "unsignedshort")
- this->setDataType(TeUNSIGNEDSHORT);
- else if (it->second == "short")
- this->setDataType(TeSHORT);
- else if (it->second == "integer")
- this->setDataType(TeINTEGER);
- else if (it->second == "unsignedlong")
- this->setDataType(TeUNSIGNEDLONG);
- else if (it->second == "long")
- this->setDataType(TeLONG);
- else if (it->second == "float")
- this->setDataType(TeFLOAT);
- else if (it->second == "double")
- this->setDataType(TeDOUBLE);
- }
- it = metadata.find("SWAPPED");
- if (it != metadata.end() && it->second == "yes")
- swap_ = true;
-
- it = metadata.find("NO_DATA");
- if (it != metadata.end())
- {
- useDummy_ = true;
- this->setDummy(atof(it->second.c_str()));
- }
-
- it = metadata.find("PROJECTION");
- if (it != metadata.end())
- {
- string projdesc = it->second;
- TeProjectionParams pars;
- it = metadata.find("DATUM");
- if (it != metadata.end())
- {
- TeDatum dat = TeDatumFactory::make(it->second);
- pars.datum = dat;
- }
- if (decodifyDescription(projdesc,pars))
- {
- TeProjection* proj = TeProjectionFactory::make(pars);
- this->projection(proj);
- }
- }
- }
-}
-
-void
-TeRasterParams::setNavigationParameters(const vector<double>& nwf)
-{
- if (nwf.size() < 6)
- return;
-
- dxJ_ = nwf[0];
- dxI_ = nwf[1];
- dyJ_ = nwf[2];
- dyI_ = nwf[3];
- x0_ = nwf[4];
- y0_ = nwf[5];
- resx_ = dxJ_;
- resy_ = ABS(dyI_);
-
- if (nwf[1] == 0. && nwf[2] == 0)
- {
- this->topLeftResolutionSize(nwf[4],nwf[5],nwf[0],-1*nwf[3],ncols_,nlines_);
- return;
- }
-
- // set the bounding box considering the navigation parameters
- // assumes that: x0 and y0 are relative to the center of the raster element
-
- double xmin = min(x0_-0.5*dxJ_-0.5*dxI_,x0_-0.5*dxJ_+(nlines_-0.5)*dxI_);
- double xmax = max(x0_+(ncols_-0.5)*dxJ_-0.5*dxI_,x0_+(ncols_-0.5)*dxJ_+(nlines_-0.5)*dxI_);
- double ymin = min(y0_+(nlines_-0.5)*dyI_-0.5*dyJ_,y0_+(nlines_-0.5)*dyI_+(ncols_*0.5)*dyJ_);
- double ymax = max(y0_-0.5*dyI_-0.5*dyJ_,y0_-0.5*dyI_+(ncols_*0.5)*dyJ_);
- boundingBoxLinesColumns(xmin,ymin,xmax,ymax,nlines_,ncols_);
-}
-
-void
-TeRasterParams::getNavigationParameters(vector<double>& nwf)
-{
- nwf.clear();
- if (dxI_ != 0. || dyJ_ != 0.)
- {
- nwf.push_back(dxJ_);
- nwf.push_back(dxI_);
- nwf.push_back(dyJ_);
- nwf.push_back(dyI_);
- nwf.push_back(x0_);
- nwf.push_back(y0_);
- }
- else
- {
- nwf.push_back(resx_);
- nwf.push_back(0.);
- nwf.push_back(0.);
- nwf.push_back(-1*resy_);
- nwf.push_back(box_.x1_);
- nwf.push_back(box_.y2_);
- }
-}
-
-void
-TeRasterParams::setNLinesNColumns(int nlines, int ncolumns)
-{
- this->lowerLeftResolutionSize(0.5,0.5,1,1,ncolumns, nlines);
-}
-
diff --git a/src/terralib/kernel/TeRasterParams.h b/src/terralib/kernel/TeRasterParams.h
deleted file mode 100644
index 11e3b85..0000000
--- a/src/terralib/kernel/TeRasterParams.h
+++ /dev/null
@@ -1,500 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeRasterParams.h
- \brief This file contains definitions about parameters of a raster structure
-*/
-#ifndef __TERRALIB_INTERNAL_RASTERPARAMS_H
-#define __TERRALIB_INTERNAL_RASTERPARAMS_H
-
-#include "TeProjection.h"
-#include "TeBox.h"
-#include "TeDataTypes.h"
-
-#include <string>
-#include <list>
-#include <vector>
-
-using namespace std;
-
-class TeDatabase;
-
-//! A class to handle the parameters set associated with a raster data
-/*!
-This class is a data structure to store and manipulate a set of parameters and definitions that characterizes
-a raster data. It contains parameters relative to storaging, geographical or interpretation aspects.
-Not all parameters are valid, or make sense, for all raster data.
-Most parameters are public and can be accessed directly. The private ones should be acessed
-through the methods provided.
-\sa TeRaster
-*/
-class TL_DLL TeRasterParams
-{
-public:
-
- //! Pixels interleaving mode: used by rasters in memory and files in raw formats
- enum TeRasterInterLeavingMode
- {
- TePerPixel, // BIP - Band Interleaved by Pixel
- TePerLine, // BIL - Band Interleaved by Line
- TePerBand // BSQ - Band Sequential
- };
-
- //! Photometric interpretation of a raster data
- enum TeRasterPhotometricInterpretation
- { TeUnknown, TePallete, TeMultiBand, TeRGB };
-
- //! Status of a raster data, in terms of reading and writting possibilities
- enum TeRasterStatus
- { TeNotReady, TeReadyToRead, TeReadyToWrite };
-
- //! Compression modes of a raster data
- enum TeRasterCompressionMode
- { TeNoCompression, TeZLib, TeJpeg, TeTiffCompression };
-
- //! Tiling type modes to store raster data in a TerraLib database
- enum TeRasterTilingType
- { TeExpansible=1, TeNoExpansible=2 };
-
-
- //! Default contructor
- TeRasterParams () :
- nlines_(0),
- ncols_(0),
- resx_(1),
- resy_(1),
- swap_(false),
- useDummy_(false),
- mode_('r'),
- status_(TeRasterParams::TeNotReady),
- resolution_(1),
- subBand_(0),
- offset_(0),
- tiling_type_(TeRasterParams::TeExpansible),
- blockHeight_(0),
- blockWidth_(0),
- nTilesInMemory_(0),
- blockId_(""),
- decoderIdentifier_(""),
- database_ (0),
- layerId_(-1),
- objectId_(""),
- interleaving_(TeRasterParams::TePerPixel),
- lutName_(""),
- dxJ_(0.0),
- dxI_(0.0),
- dyJ_(0.0),
- dyI_(0.0),
- x0_(0.0),
- y0_(0.0),
- box_(TeBox()),
- projection_(0)
- {
- nbands_= 1;
- nbitsperPixel_.resize(nbands_);
- vmin_.resize(nbands_);
- vmax_.resize(nbands_);
- bands_.resize(nbands_);
- photometric_.resize(nbands_);
- dataType_.resize(nbands_);
- dummy_.resize(nbands_);
- compression_.resize(nbands_);
- for (int i=0; i<nbands_; i++)
- {
- bands_[i] = i;
- vmin_[i] = TeMAXFLOAT;
- vmax_[i] = -TeMAXFLOAT;
- dataType_[i] = TeUNSIGNEDCHAR;
- photometric_[i] = TeRasterParams::TeMultiBand;
- dummy_[i] = 255;
- }
- hasSetDummy_ = false;
- }
-
- //! Copy constructor
- TeRasterParams(const TeRasterParams& other);
-
- //! Operator=
- TeRasterParams& operator=(const TeRasterParams& rhs);
-
- //! Destructor
- virtual ~TeRasterParams()
- {
- bands_.clear();
- vmin_.clear();
- vmax_.clear();
- if (!lutr_.empty())
- {
- lutr_.clear();
- lutg_.clear();
- lutb_.clear();
- }
- photometric_.clear();
- dataType_.clear();
- dummy_.clear();
- compression_.clear();
- if (projection_)
- delete projection_;
- hasSetDummy_ = false;
- }
-
- /** @name Extension
- * Methods to deal with the spatial extensions of a raster data
- */
- //@{
- //! Returns the box based on the coordinates of center of the corner elements
- const TeBox& box()
- { return box_; }
-
- //! Returns the outline box
- TeBox boundingBox();
-
- //! Sets extension parameters
- /*
- This methods recalculates the number of lines and columns and box accordingly to
- an input bounding box and X and Y resolutions
- \param x1 bounding box lower left point X coordinate
- \param y1 bounding box lower left point Y coordinate
- \param x2 bounding box upper right point X coordinate
- \param y2 bounding box upper right point Y coordinate
- \param resx X resolution
- \param resy Y resolution
- \param lock corner of the bounding box that should be preserved
- */
- void boundingBoxResolution (double x1, double y1, double x2, double y2, double resx, double resy, TeBox::TeBoxCorner lock = TeBox::TeUPPERLEFT);
-
- //! Sets extension parameters
- /*
- This methods recalculates the resolutions and box accordingly to
- a given bounding box and number of lines and columns
- \param x1 bounding box lower left point X coordinate
- \param y1 bounding box lower left point Y coordinate
- \param x2 bounding box upper right point X coordinate
- \param y2 bounding box upper right point Y coordinate
- \param nlines number of lines
- \param ncols number of columns
- \param lock corner of the bounding box that should be preserved
- */
- void boundingBoxLinesColumns (double x1, double y1, double x2, double y2,
- int nlines, int ncols, TeBox::TeBoxCorner lock = TeBox::TeUPPERLEFT);
-
- //! Sets extension parameters
- /*
- This methods recalculates the number of lines and columns and box accordingly to
- a given box and X and Y resolutions
- \param x1 box lower left point X coordinate
- \param y1 box lower left point Y coordinate
- \param x2 box upper right point X coordinate
- \param y2 box upper right point Y coordinate
- \param resx X resolution
- \param resy Y resolution
- \param lock corner of the bounding box that should be preserved
- */
- void boxResolution (double x1, double y1, double x2, double y2,
- double resx, double resy, TeBox::TeBoxCorner lock = TeBox::TeUPPERLEFT);
-
- //! Sets extension parameters
- /*
- This methods recalculates the resolutions and box accordingly to
- a given box and number of lines and columns
- \param x1 box lower left point X coordinate
- \param y1 box lower left point Y coordinate
- \param x2 box upper right point X coordinate
- \param y2 box upper right point Y coordinate
- \param nlines number of lines
- \param ncols number of columns
- \par Calculates X resolution and Y resolution
- \param lock corner of the bounding box that should be preserved
- */
- void boxLinesColumns (double x1, double y1, double x2, double y2,
- int nlines, int ncols, TeBox::TeBoxCorner lock = TeBox::TeUPPERLEFT);
-
- //! Sets extension parameters
- /*
- \param left lower left point X coordinate
- \param top upper right point Y coordinate
- \param resx X resolution
- \param resy Y resolution
- \param nlines number of lines
- \param ncols number of columns
- \param coordIsCentrePixel flag to indicate that top left coordinate is centre of pixel
- */
- void topLeftResolutionSize (double left, double top, double resx, double resy, int ncol, int nlin, bool coordIsCentrePixel=true);
-
- //! Sets extension parameters
- /*
- \param left lower left point X coordinate
- \param lower lower left point Y coordinate
- \param resx X resolution
- \param resy Y resolution
- \param nlines number of lines
- \param ncols number of columns
- \param coordIsCentrePixel flag to indicate that top left coordinate is centre of pixel
- */
- void lowerLeftResolutionSize (double left, double lower, double resx, double resy, int ncol, int nlin, bool coordIsCentrePixel=true);
-
- //! Sets default extension parameters
- /*
- Sets a valid bouding box, considering a resolution of 1x1 and
- that the coordinate of the center of lower-left element is (0.5,0.5)
- \param nlines number of lines
- \param ncols number of columns
- */
- void setNLinesNColumns(int nlines, int ncolumns);
-
- //! Resizes the raster bounding box to cut it exactly in tiles of a give size
- /*!
- \param bb an initial bounding box
- \param bWidth block width (in number of elements/pixels)
- \param bHeight block height (in number of elements/pixels)
- \note keeps the defined X an Y resolutions
- */
- void resizeToTiling(TeBox& bb, int bWidth, int bHeight);
- //@}
-
- //! Sets the number of bands, or dimentions in a raster data
- /*
- \param n number of bands
- \note If the required number of bands is greater than the
- current number of bands, the last band characteristics
- will be copied to the new defined bands.
- */
- void nBands(int n);
-
- //! Sets the projection
- /*
- \param proj a pointer to a terralib projection instance
- A new instance of projection is created according to the parameters described by proj.
- */
- void projection(TeProjection* proj);
-
- //! Returns the projection
- TeProjection* projection()
- { return projection_; }
-
-
- //! Transform a coordinate from world domain to line/column domain
- TeCoord2D coord2Index (const TeCoord2D& pt) const;
-
- //! Transform a coordinate from line/column domain to world domain
- TeCoord2D index2Coord (const TeCoord2D& pt) const;
-
-
- int nlines_; //!< number of lines
- int ncols_; //!< number of columns
-
- double resx_, //!< horizontal resolution
- resy_; //!< vertical resolution
-
- bool swap_; //!< a flag to indicate that the values of the elements of the raster are swapped
- bool useDummy_; //!< a flag to indicate that raster has dummy values
- char mode_; //!< a character indicating the access mode to the raster data: 'r', 'w' or 'c'
- TeRasterStatus status_; //! Status for reading and writing to raster
-
- /** @name Parameters variable per band
- */
- //@{
- vector<int> nbitsperPixel_; //!< number of bits per pixel
- vector<double> vmin_; //!< minimum value
- vector<double> vmax_; //!< maximum value
- vector<int> bands_; //!< bands information
- vector<double> dummy_; //!< no data value
- vector<TeRasterPhotometricInterpretation> photometric_; //!< photometric interpretation
- vector<TeRasterCompressionMode> compression_; //!< compression type
- vector<TeDataType> dataType_; //!< computational size of elements
-
- //! Sets the size of the elements in a particular or in every band
- /*
- \param type the computational data type
- \param band number of the band. Default: all bands
- */
- void setDataType(TeDataType type, int band=-1);
-
- //! Returns the size in bytes of each raster element
- int elementSize(int band=0);
-
- //! Sets the photometric type in a particular or in every band
- /*
- \param photom the photometric interpretation
- \param band number of the band. Default: all bands
- */
- void setPhotometric(TeRasterPhotometricInterpretation photom, int band=-1);
-
- //! Sets the compression mode of each band
- /*
- \param cmode the compression mode
- \param band number of the band. Default: all bands
- */
- void setCompressionMode(TeRasterCompressionMode cmode, int band=-1);
-
- //! Sets the dummy value in each band
- /*
- \param dummy dummy value
- \param band number of the band. Default: all bands
- */
- void setDummy(double dummy, int band=-1);
- //@}
-
- /** @name Resolution level parameters
- * Used when raster has different levels of resolution
- */
- //@{
- int resolution_; //! resolution level
- int subBand_; //! sub band identification
- //@}
-
- /** @name File parameters
- * Used when raster is stored in files
- */
- //@{
- string fileName_; //!< name of a raster file
- int offset_; //!< offset
- //@}
-
- /** @name Tilling parameters
- */
- //@{
- TeRasterTilingType tiling_type_; //!< raster tiling mode
- int blockHeight_; //!< tiles height
- int blockWidth_; //!< tiles width
- int nTilesInMemory_; //!< number of tiles to be kept in memory
- string blockId_; //!< tiles identification
- //@}
-
- string decoderIdentifier_; //!< decoder associated to his raster
-
- //! Returns the identifier of the decoder associated to the raster
- const string& decName() const
- { return decoderIdentifier_; }
- //set the identifier of the decoder associated to the raster
- void decName(const string& decoder)
- { decoderIdentifier_ = decoder; }
-
-
- /** @name Tilling parameters
- */
- //@{
- TeDatabase* database_; //!< pointer to a TerraLib database where the raster is stored
- int layerId_; //!< identification of the layer that contains the raster
- string objectId_; //!< identification of an object associated to this raster geometry
- //@}
-
- TeRasterInterLeavingMode interleaving_; //!< interleaving mode
-
- /** @name Raster pallete
- * Look up table associated to a raster
- */
- //@{
- string lutName_; //!< name of a lut table associated to this raster
- vector<unsigned short> lutr_; //!< red pallete
- vector<unsigned short> lutg_; //!< green pallete
- vector<unsigned short> lutb_; //!< blue pallete
-
- //! Returns the name of the lut
- const string& lutName()
- { return lutName_; }
- //@}
-
- /** @name Navigation parameters
- * Parameters associated to translation/rotation of the positioning of the raster data
- */
- //@{
- double dxJ_; //!< X offset due to increase of one column position
- double dxI_; //!< X offset due to increase of one line position
- double dyJ_; //!< Y offset due to increase of one column position
- double dyI_; //!< Y offset due to increase of one line position
- double x0_; //!< X coordinate of the upper left raster element
- double y0_; //!< Y coordinate of the upper left raster element
-
- /** Sets the navigation parameters
- \param nwf the navigation parameters set
- \note this method should be called after the number of lines and columns has been set
-
- \verbatim
- The Navigation parameters describe a transformation from column/line domain (i,j)
- to geographical world (x,y), so that:
- | x = x0 + i*dxJ + j*dxI
- | y = y0 + i*dyJ + j*dyI
-
- and:
-
- |i = (dyI*(x-x0) - dxI*(y-y0)) / (dxJ*dyI-dyJ*dxI)
- |j = (dyJ*(x-x0) - dxJ*(y-y0)) / (dyJ*dxI-dxJ*dyI)
-
- where:
- nwf[0] = dxJ : the offset in the X direction along each column
- nwf[1] = dxI : the offset in the X direction along each line
- nwf[2] = dyJ : the offset in the Y direction along each column
- nwf[3] = dyI : the offset in the Y direction along each line
- nwf[4] = x0 : X coordinate of the center of the upper left raster element
- nwf[5] = y0 : Y coordinate of the center of the upper left raster element
- \endverbatim
- */
- void setNavigationParameters(const vector<double>& nwf);
-
- /** Returns the georeferecing parameters
- \param nwf vector of double to return the navigation parameters set
- \verbatim
- The Navigation parameters describe a transformation from column/line domain (i,j)
- to geographical world (x,y), so that:
- | x = x0 + i*dxJ + j*dxI
- | y = y0 + i*dyJ + j*dyI
-
- and:
-
- |i = (dyI*(x-x0) - dxI*(y-y0)) / (dxJ*dyI-dyJ*dxI)
- |j = (dyJ*(x-x0) - dxJ*(y-y0)) / (dyJ*dxI-dxJ*dyI)
-
- where:
- nwf[0] = dxJ : the offset in the X direction along each column
- nwf[1] = dxI : the offset in the X direction along each line
- nwf[2] = dyJ : the offset in the Y direction along each column
- nwf[3] = dyI : the offset in the Y direction along each line
- nwf[4] = x0 : X coordinate of the center of the upper left raster element
- nwf[5] = y0 : Y coordinate of the center of the upper left raster element
- \endverbatim
- */
- void getNavigationParameters(vector<double>& nwf);
- //@}
-
- //! Returns the number of bands of the raster
- int nBands() const
- { return nbands_; }
-
- //! Saves the parameters in a ASCII File, in TerraLib format
- void writeParametersFile();
-
- //! Reads the parameters described in a ASCII File, in TerraLib format
- void readParametersFile();
-
- //! String that contains any error or warning message that raster manipulation might have detected
- string errorMessage_;
-
-private:
- int nbands_; //!< number of bands
- TeBox box_; //!< raster box in center of pixel coordinates
- TeProjection* projection_; //!< raster projection
- bool hasSetDummy_;
-};
-
-#endif
-
diff --git a/src/terralib/kernel/TeRasterRemap.cpp b/src/terralib/kernel/TeRasterRemap.cpp
deleted file mode 100644
index f0140eb..0000000
--- a/src/terralib/kernel/TeRasterRemap.cpp
+++ /dev/null
@@ -1,697 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeDefines.h"
-#include "TeGeometryAlgorithms.h"
-#include "TeRasterRemap.h"
-#include "TeVectorRemap.h"
-#include "TeProgress.h"
-#include <time.h>
-
-
-#include <algorithm> // for max and min
-#include <cstdlib> // for abs
-
-bool TePointOnLine (TeCoord2D& p, TeCoord2D& q, TeCoord2D& t, double tol)
-{
- int tx, ty, px, py, qx, qy, dx, dy;
-
- px = (int)(p.x () / tol);
- py = (int)(p.y () / tol);
-
- qx = (int)(q.x () / tol);
- qy = (int)(q.y () / tol);
-
- tx = (int)(t.x () / tol);
- ty = (int)(t.y () / tol);
-
- dx = abs(px-qx);
- dy = abs(py-qy);
-
- if (dx <=2 && dy <= 2)
- return true;
-
- int q1 = (qy-py)*(tx-px);
- int q2 = (ty-py)*(qx-px);
- int q3 = qx-px;
- int q4 = qy-py;
-
- if (q1 == 0 && q2 == 0 && q3 == 0 && q4 == 0)
- return true;
- if (abs(q1 - q2) > (std::max(abs(q3), abs(q4))))
- return false;
- return true;
-}
-
-bool TeRasterRemap::setROI(TeBox& roi)
-{
- if (roi.isValid())
- {
- TeBox bb;
- if (rasterIn_ && !TeIntersection(roi,rasterIn_->params().boundingBox(),bb))
- return false;
- ROI_ = roi;
- return true;
- }
- return false;
-}
-
-void TeRasterRemap::TeInterpolateIn ( TeBox &box )
-{
- TeRasterParams paramIn = rasterIn_->params();
- TeRasterParams paramOut = rasterOut_->params();
-
- TeProjection *projIn = paramIn.projection();
- TeProjection *projOut = paramOut.projection();
-
- if (!projIn || !projOut)
- return;
-
- projIn->setDestinationProjection(projOut);
- projOut->setDestinationProjection(projIn);
-
-// Take coordinates of box corners in output raster projection
-
- TeCoord2D poll = box.lowerLeft ();
- TeCoord2D pour = box.upperRight ();
-
-// Bring output coordinates to output line/column domain
-
- TeCoord2D pxoll = rasterOut_->coord2Index (poll);
- TeCoord2D pxour = rasterOut_->coord2Index (pour);
-
-// Round output coordinates to nearest exact pixel
-
- int x1,y1;
- x1 = (int) (pxoll.x() - 0.5);
- y1 = (int) (pxoll.y() + 0.5);
- pxoll = TeCoord2D (x1,y1);
-
- int x2,y2;
- x2 = (int)(pxour.x() + 0.5);
- y2 = (int)(pxour.y() - 0.5);
- pxour = TeCoord2D (x2,y2);
-// fprintf (loga,"Coordenadas de saida - x1=%d x2=%d y1=%d y2=%d\n",x1,x2,y1,y2);
-
- poll = rasterOut_->index2Coord (pxoll);
- pour = rasterOut_->index2Coord (pxour);
-// fprintf (loga,"Box de saida - x1=%f x2=%f y1=%f y2=%f\n\n",poll.x(),pour.x(),poll.y(),pour.y());
-
- TeCoord2D poul = TeCoord2D(poll.x(),pour.y());
- TeCoord2D polr = TeCoord2D(pour.x(),poll.y());
-
-//FAMI:BEGIN
-// If desired area on output image is too small, let's perform
-// the interpolation point by point.
- double x,y;
- int i, j;
- TeCoord2D paux;
- if (box.width () < 3.*paramOut.resx_ || box.height () < 3.*paramOut.resy_)
- {
- y = (float)poul.y();
- for (i=y2;i<y1;i++,y-=paramOut.resy_) //y2 < y1, bottom > top
- {
- x = (float)poul.y();
- for (j=x1;j<x2;j++,x+=paramOut.resx_)
- {
- paux.setXY(x,y);
- paux = projOut->PC2LL (paux);
- if (paux.tooBig ()) continue;
- paux = projIn->LL2PC (paux);
- if (paux.tooBig ()) continue;
- paux = rasterIn_->coord2Index (paux);
-
- // linear or bilinear (InterpolateAt) ????
- if (interpolation_ == 0)
- {
- transformer_->apply((int)(paux.x()+0.5),(int)(paux.y()+0.5),j,i);
-//FAMI (transformer_.*transform_)((int)(paux.x()+0.5),(int)(paux.y()+0.5),j,i);
- }
-// if ( (*this)(i,j) == outsidevalue )
-// (*this)(i,j) = imi->InterpolateAt(paux);
- }
- }
- return;
- }
-
-//FAMI:END
-
-// Bring coordinates of box four corners to input raster projection
-#if 0 //FAMI:BEGIN
- TeCoord2D pill = projOut->PC2LL (poll);
- TeCoord2D piur = projOut->PC2LL (pour);
- TeCoord2D piul = projOut->PC2LL (poul);
- TeCoord2D pilr = projOut->PC2LL (polr);
-
- pill = projIn->LL2PC (pill);
- piur = projIn->LL2PC (piur);
- piul = projIn->LL2PC (piul);
- pilr = projIn->LL2PC (pilr);
-#else
- TeCoord2D piul = projOut->PC2LL (poul);
- if (piul.tooBig()) piul.setXY(-TeMAXFLOAT,TeMAXFLOAT);
- else
- {
- piul = projIn->LL2PC (piul);
- if (piul.tooBig()) piul.setXY(-TeMAXFLOAT,TeMAXFLOAT);
- }
-
- TeCoord2D piur = projOut->PC2LL (pour);
- if (piur.tooBig()) piur.setXY(TeMAXFLOAT,TeMAXFLOAT);
- else
- {
- piur = projIn->LL2PC (piur);
- if (piur.tooBig()) piur.setXY(TeMAXFLOAT,TeMAXFLOAT);
- }
-
- TeCoord2D pill = projOut->PC2LL (poll);
- if (pill.tooBig()) pill.setXY(-TeMAXFLOAT,-TeMAXFLOAT);
- else
- {
- pill = projIn->LL2PC (pill);
- if (pill.tooBig()) pill.setXY(-TeMAXFLOAT,-TeMAXFLOAT);
- }
-
- TeCoord2D pilr = projOut->PC2LL (polr);
- if (pilr.tooBig()) pilr.setXY(TeMAXFLOAT,-TeMAXFLOAT);
- else
- {
- pilr = projIn->LL2PC (pilr);
- if (pilr.tooBig()) pilr.setXY(TeMAXFLOAT,-TeMAXFLOAT);
- }
-#endif
-//FAMI:END
-
-// Check if linear interpolation may be performed on input raster
-// Evaluate point at middle of the edges in output domain and check if their
-// corresponding points belong to the edges in input domain. If they belong,
-// a linear interpolation may be performed, else divide output image
-// in four quadrants and try interpolating again
-
-
- TeCoord2D pou((pour.x()-poul.x())/2.+poul.x(), poul.y()), // upper edge
- pob((polr.x()-poll.x())/2.+poll.x(), poll.y()), // bottom edge
- pol(poll.x(), (poul.y()-poll.y())/2.+poll.y()), // left edge
- por(polr.x(), (pour.y()-polr.y())/2.+polr.y()); // right edge
-
-// Evaluate corresponding points in input raster domain
- TeCoord2D piu, pib, pil, pir;
-
- piu = projOut->PC2LL (pou);
- pib = projOut->PC2LL (pob);
- pil = projOut->PC2LL (pol);
- pir = projOut->PC2LL (por);
-
-#if 0 //FAMI:BEGIN
- piu = projIn->LL2PC (piu);
- pib = projIn->LL2PC (pib);
- pil = projIn->LL2PC (pil);
- pir = projIn->LL2PC (pir);
-#else
- if (!piu.tooBig()) piu = projIn->LL2PC (piu);
- if (!pib.tooBig()) pib = projIn->LL2PC (pib);
- if (!pil.tooBig()) pil = projIn->LL2PC (pil);
- if (!pir.tooBig()) pir = projIn->LL2PC (pir);
-
-// Check special case for Satellite projection, when an area
-// outside the globe is being remapped, therefore none of these
-// points will have valid values and we will give up.
-
- if ( piu.tooBig () && pib.tooBig () &&
- pil.tooBig () && pir.tooBig () &&
- piul.tooBig () && piur.tooBig () &&
- pilr.tooBig () && pill.tooBig () )
- {
- return;
- }
-#endif
-//FAMI: END
-
-// Check if middle points belong to the edges
-
- double tol = MAX(paramIn.resx_ ,paramIn.resy_ );
-
-// if (!TeIsOnSegment (piu,piul,piur/*,tol*/) ||
-// !TeIsOnSegment (pir,pilr,piur/*,tol*/) ||
-// !TeIsOnSegment (pib,pill,pilr/*,tol*/) ||
-// !TeIsOnSegment (pil,pill,piul/*,tol*/))
-
- if ( piul.tooBig() || pilr.tooBig() || pill.tooBig() || piur.tooBig() ||
- !TePointOnLine (piul,piur,piu,tol) ||
- !TePointOnLine (pilr,piur,pir,tol) ||
- !TePointOnLine (pill,pilr,pib,tol) ||
- !TePointOnLine (pill,piul,pil,tol))
- {
-// If one of them does not belong to correspondig edge, divide output in four quadrants
- TeCoord2D pom ((por.x()-pol.x())/2.+pol.x(), (pou.y()-pob.y())/2.+pob.y()); // center point
- TeBox quadrantul (pol, pou);
- TeInterpolateIn ( quadrantul );
- TeBox quadrantur (pom, pour);
- TeInterpolateIn ( quadrantur );
- TeBox quadrantll (poll, pom);
- TeInterpolateIn ( quadrantll );
- TeBox quadrantlr (pob, por);
- TeInterpolateIn ( quadrantlr );
- return;
- }
-
-// Start linear interpolation on input image.
-
- double xl, // x at the beginning of the line
- yl, // y at the beginning of the line
- xr, // x at the end of the line
- yr, // y at the end of the line
- dx, // inner loop x increment
- dy, // inner loop y increment
- dxl, // x increment at the beginning of line
- dyl, // y increment at the beginning of line
- dxr, // x increment at the end of line
- dyr; // y increment at the end of line
-
- TeCoord2D pxill = rasterIn_->coord2Index (pill);
- TeCoord2D pxiul = rasterIn_->coord2Index (piul);
- TeCoord2D pxilr = rasterIn_->coord2Index (pilr);
- TeCoord2D pxiur = rasterIn_->coord2Index (piur);
-
-// Evaluate the increments in x and y on both sides of input image
-
-//FAMI int i, j;
-//FAMI double x,y;
-
- x1 = (int)pxoll.x()-1;
- y1 = (int)pxour.y()-1;
-
- x2 = (int)pxour.x()+1;
- y2 = (int)pxoll.y()+1;
-
- dxl = ( (pxill.x()-pxiul.x())/(y2-y1) );
- dyl = ( (pxill.y()-pxiul.y())/(y2-y1) );
-
- dxr = ( (pxilr.x()-pxiur.x())/(y2-y1) );
- dyr = ( (pxilr.y()-pxiur.y())/(y2-y1) );
-
-// Set initial values for x and y at beginning point on input image
-
- xl = pxiul.x() - 1;
- yl = pxiul.y() - 1;
-
-// Set initial values for x and y at end point on input image
-
- xr = pxiur.x() + 1;
- yr = pxiur.y() + 1;
-
-// Evaluate increments for the first line
-
- dx = (xr-xl)/(x2-x1);
- dy = (yr-yl)/(x2-x1);
-
- x = xl; // round to left pixel
- y = yl; // round to left pixel
-
- for (j=y1;j<=y2;j++)
- {
- for (i=x1;i<=x2;i++)
- {
- if (interpolation_ == 0)
- transformer_->apply((int)(x+0.5),(int)(y+0.5),i,j);
- x += dx;
- y += dy;
- }
-
- xl += dxl;
- x = xl;
- xr += dxr;
- yl += dyl;
- y = yl;
- yr += dyr;
- dx = (xr-xl)/(x2-x1);
- dy = (yr-yl)/(x2-x1);
- }
-}
-
-bool TeRasterRemap::apply( bool showProgress )
-{
- // check if input and output raster are set
- if (!rasterIn_ || !rasterOut_)
- return false;
-
- TeRasterParams paramIn = rasterIn_->params();
- TeRasterParams paramOut = rasterOut_->params();
-
- TeProjection* projIn = paramIn.projection();
- TeProjection* projOut = paramOut.projection();
-
- // if only one of the rasters dont have projection cant do remapping
- if ((projIn && !projOut) || (projOut && !projIn))
- return false;
-
- showProgress_ = showProgress;
-
- // if no transformer defined create a new on based on typical cases of
- // visualization and import operations
- bool delTransf = false;
- if (!transformer_)
- {
- delTransf = true; // remember to delete it
- transformer_ = new TeRasterTransform();
- transformer_->setRasterIn(rasterIn_);
- transformer_->setRasterOut(rasterOut_);
-
- // pallete raster to a RGB device -> apply input raster pallete
- if ((paramIn.photometric_[0] == TeRasterParams::TePallete) &&
- paramOut.nBands() == 3)
- transformer_->setTransfFunction(&TeRasterTransform::Pallete2ThreeBand);
- // mono band raster to a RGB device -> repeat band to 3 channels
- else if (paramIn.nBands() == 1 && paramOut.nBands() == 3)
- transformer_->setTransfFunction(&TeRasterTransform::Mono2ThreeBand);
- // copy first n input bands to first n output bands
- else
- transformer_->setTransfFunction(&TeRasterTransform::Band2Band);
- }
- else if(transformer_->getTransfFunction() == TeRasterTransform::TeNoTransf)
- {
- transformer_->setTransfFunction(&TeRasterTransform::Band2Band);
- }
-
- bool result;
- // check if datum's are different
- if (projIn->datum().name() != projOut->datum().name())
- {
- projIn->setDestinationProjection(projOut);
- projOut->setDestinationProjection(projIn);
- }
-
- if (projIn && projOut && (*projIn == *projOut)) // same projection
- {
- TeBox boxIn = paramIn.box();
- TeBox boxOut = paramOut.box();
-
-
- if (!(boxIn == boxOut) || // different resolutions or boxes
- paramIn.resx_ != paramOut.resx_ ||
- paramIn.resy_ != paramOut.resy_ ||
- paramIn.ncols_ != paramOut.ncols_ ||
- paramIn.nlines_ != paramOut.nlines_ )
- result = resample();
- else // same dimensions
- result = copy();
- }
- else // different projection
- result = remap();
-
- if (delTransf)
- {
- delete transformer_;
- transformer_ = 0;
- }
- return result;
-}
-
-bool TeRasterRemap::copy ()
-{
- const TeRasterParams& paramOut = rasterOut_->params();
- if(showProgress_ && TeProgress::instance())
- TeProgress::instance()->setTotalSteps(paramOut.nlines_);
-
- int li, lf, ci, cf;
- if (ROI_.isValid())
- {
- TeCoord2D aux = rasterIn_->coord2Index(ROI_.lowerLeft());
- lf = TeRoundRasterIndex(aux.y_);
- ci = TeRoundRasterIndex(aux.x_);
- aux = rasterIn_->coord2Index(ROI_.upperRight());
- li = TeRoundRasterIndex(aux.y_);
- cf = TeRoundRasterIndex(aux.x_);
- }
- else
- {
- li = ci = 0;
- lf = paramOut.nlines_;
- cf = paramOut.ncols_;
- }
-
- int c, l;
- clock_t ti, tf;
- ti = clock();
- for (l=li; l<lf; ++l)
- {
- for (c=ci; c<cf; ++c)
- transformer_->apply(c,l,c,l);
-
- if (showProgress_ && TeProgress::instance())
- {
- tf = clock();
- if (int((tf-ti)/CLOCKS_PER_SEC) > 3)
- {
- if (TeProgress::instance()->wasCancelled())
- break;
- TeProgress::instance()->setProgress(l);
- ti = tf;
- }
- }
- }
- if(showProgress_ && TeProgress::instance())
- TeProgress::instance()->reset();
- return true;
-}
-
-bool TeRasterRemap::resample ()
-{
- TeRasterParams paramIn = rasterIn_->params();
- TeRasterParams paramOut = rasterOut_->params();
-
- TeBox boxIn = paramIn.boundingBox();
- TeBox boxOut = paramOut.boundingBox();
-
-// Evaluate intersection of input and output rasters in output raster projection domain
-
- TeBox boxInter;
-
- if (!TeIntersection (boxIn,boxOut,boxInter))
- return false;
-
- if (ROI_.isValid())
- {
- if (!TeIntersection (ROI_,boxInter,boxInter))
- return false;
- }
-
-// Take coordinates of intersection box
-
- TeCoord2D poll = boxInter.lowerLeft ();
- TeCoord2D pour = boxInter.upperRight ();
-
-// Bring it to output line/column domain
-
- TeCoord2D pxoll = rasterOut_->coord2Index (poll);
- TeCoord2D pxour = rasterOut_->coord2Index (pour);
-
-// Round it to nearest pixel
- int x1,y1,x2,y2;
- x1 = TeRoundRasterIndex(pxoll.x_) - 1;
- y2 = TeRoundRasterIndex(pxoll.y_) + 1;
- pxoll = TeCoord2D (x1,y2);
-
- x2 = TeRoundRasterIndex(pxour.x_) + 1;
- y1 = TeRoundRasterIndex(pxour.y_) - 1;
- pxour = TeCoord2D (x2,y1);
-
-// Bring it to output projection domain
- poll = rasterOut_->index2Coord (pxoll);
- pour = rasterOut_->index2Coord (pxour);
-
-// Bring upper left point to input line/column domain
- TeCoord2D ulPoint = rasterIn_->coord2Index(TeCoord2D(poll.x(),pour.y()));
-
-// - -
-// |A|B|
-// - -
-// |C| |
-// - -
-// Get output projection domain of corner ABC
- TeCoord2D A = rasterOut_->index2Coord(TeCoord2D(0,0));
- TeCoord2D B = rasterOut_->index2Coord(TeCoord2D(1,0));
- TeCoord2D C = rasterOut_->index2Coord(TeCoord2D(0,1));
-
-// Calculate equivalent input line/column coordinates
- TeCoord2D Ae = rasterIn_->coord2Index(A);
- TeCoord2D Be = rasterIn_->coord2Index(B);
- TeCoord2D Ce = rasterIn_->coord2Index(C);
-
-// Calculate input increments in both directions, in number of pixels
-// for each output 1 pixel increment in
- double eDxJ = Be.x()-Ae.x(); // increment in X direction when moving from A->B
- double eDyJ = Be.y()-Ae.y(); // increment in Y direction when moving from A->B
- double eDyI = Ce.y()-Ae.y(); // increment in Y direction when moving from C->A
- double eDxI = Ce.x()-Ae.x(); // increment in X direction when moving from C->A
-
- int lin_sai,col_sai;
- double lin_entra,col_entra;
-
- double lin_entra_i = ulPoint.y(); // starting at the upper-left corner
- double col_entra_i = ulPoint.x();
-
- if( showProgress_ && TeProgress::instance())
- TeProgress::instance()->setTotalSteps((int)(y2-y1));
-
- int count = 1;
- clock_t ti, tf;
- ti = clock();
- for (lin_sai=y1;lin_sai<=y2;lin_sai++)
- {
- lin_entra = lin_entra_i;
- col_entra = col_entra_i;
- for (col_sai=x1;col_sai<=x2;col_sai++)
- {
- transformer_->apply(TeRoundRasterIndex(col_entra),TeRoundRasterIndex(lin_entra),col_sai,lin_sai);
- col_entra += eDxJ;
- lin_entra += eDyJ;
- }
- count++;
- lin_entra_i += eDyI;
- col_entra_i += eDxI;
- if(showProgress_ && TeProgress::instance())
- {
- tf = clock();
- if (int((tf-ti)/CLOCKS_PER_SEC) > 3)
- {
- if (TeProgress::instance()->wasCancelled())
- break;
- TeProgress::instance()->setProgress(count);
- ti = tf;
- }
- }
- }
- if (showProgress_ && TeProgress::instance())
- TeProgress::instance()->reset();
- return true;
-}
-
-bool TeRasterRemap::remap()
-{
-
- TeRasterParams paramIn = rasterIn_->params();
- TeRasterParams paramOut = rasterOut_->params();
-
- TeProjection *projIn = paramIn.projection();
- TeProjection *projOut = paramOut.projection();
-
-
- if ( projIn == 0 || projOut == 0)
- return false;
-
- projIn->setDestinationProjection(projOut);
-
- TeBox boxIn = paramIn.box();
- TeBox boxOut = paramOut.box();
-
- // Evaluate intersection of input and output rasters in output raster projection domain
- // FAMI **************VERY IMPORTANT**********************
- // There is a problem here for input Satellite image.
- // The boxIn in projection coords when converted to geodetic coords,
- // projIn->PC2LL(boxIn), gives TeMaxDouble. Consequently, this value
- // applied to projOut->LL2PC() gives also wrong values. We need to
- // do something here...
- TeBox boxInter;
- boxIn = TeRemapBox (boxIn, projIn, projOut);
-
-#if 0 //FAMI
- if (!TeIntersection (boxIn,boxOut,boxInter))
- return false;
-#else
- // Test code for satellite image being remaped to cylindrical
- // and polar stereographic projections.
- // REMOVE THIS CODE WHEN THE PROBLEM IS FIXED.
- // For cylindrical projection, function TeInterpolateIn does not work
- // if the output area is bigger than the satellite image area. The
- // temporary solution is to calculate an intersection area between
- // the satellite and the user requested area.
- // For polar stereographic projection, function TeInterpolateIn works.
- string name = projIn->name();
- if (name == "Satellite")
- {
- // compute the longitude's extreme values
- TeSatelliteProjection* proj = (TeSatelliteProjection*)paramIn.projection();
- double lon = proj->lon0(); //origin longitude
- double altitude = proj->RadiusSatOrbit()*1000000. / TeEARTHRADIUS;
- double tetha = acos(TeEARTHRADIUS / (TeEARTHRADIUS + altitude));
- double x1 = (lon-tetha)*TeCRD;
- double x2 = (lon+tetha)*TeCRD;
- TeBox bIn(x1,-65.,x2,65.); //maximum area for satellite image
-
- // Convert user's output area to geodetic coordinates
- // The intersection function is performed in geodetic coords.
- TeCoord2D p1(boxOut.x1(),boxOut.y1());
- TeCoord2D p2(boxOut.x2(),boxOut.y2());
- p1 = projOut->PC2LL(p1);
- p2 = projOut->PC2LL(p2);
- boxOut = TeBox(p1.x()*TeCRD,p1.y()*TeCRD,p2.x()*TeCRD,p2.y()*TeCRD);
-//cout << boxOut.x1() << " " << boxOut.x2() << " " << boxOut.y1() << " " << boxOut.y2() << " " << endl;
-//cout << bIn.x1() << " " << bIn.x2() << " " << bIn.y1() << " " << bIn.y2() << " " << endl;
-
- // Compute common area between the maximum area for satellite
- // image and the user's output area
- // If there is no intersection, try to shift the coordinates by
- // 360 degrees (geographical areas can be defined between -360
- // and +360 degrees)
- //
- if ( projOut->name() == "PolarStereographic" )
- boxInter = boxOut;
- else
- {
- if ( !TeIntersection (boxOut,bIn,boxInter) )
- {
-//cout << boxInter.x1() << " " << boxInter.x2() << " " << boxInter.y1() << " " << boxInter.y2() << " " << endl;
- bIn = TeBox(x1+360.,-65.,x2+360.,65.);
- if ( !TeIntersection (boxOut,bIn,boxInter) )
- return false;
- }
- }
-
- // Convert common area to projection coordinates
-//cout << boxInter.x1() << " " << boxInter.x2() << " " << boxInter.y1() << " " << boxInter.y2() << " " << endl;
- p1 = TeCoord2D(boxInter.x1()*TeCDR,boxInter.y1()*TeCDR);
- p2 = TeCoord2D(boxInter.x2()*TeCDR,boxInter.y2()*TeCDR);
- p1 = projOut->LL2PC(p1);
- p2 = projOut->LL2PC(p2);
- boxInter = TeBox(p1,p2);
- }
- else //non satellite data
-//FAMI1010 Removed this code temporarily. We need to talk to Terralib people to
-// update this routine for Polar Stereographic projection
-// if (!TeIntersection (boxIn,boxOut,boxInter))
-// return false;
- boxInter = boxOut;
-#endif
-
- if (ROI_.isValid())
- {
- boxIn = TeRemapBox (ROI_, projIn, projOut);
- if (!TeIntersection (boxIn,boxInter,boxInter))
- return false;
- }
-
- // Start trying to remap the input quadrilateral
- TeInterpolateIn ( boxInter );
- return true;
-}
diff --git a/src/terralib/kernel/TeRasterRemap.h b/src/terralib/kernel/TeRasterRemap.h
deleted file mode 100644
index 3249e30..0000000
--- a/src/terralib/kernel/TeRasterRemap.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeRasterRemap.h
- \brief This file contains definitions the class and functions need to transform a raster geometry into another geometry
-*/
-#ifndef __TERRALIB_INTERNAL_RASTERREMAP_H
-#define __TERRALIB_INTERNAL_RASTERREMAP_H
-
-#include "TeRaster.h"
-#include "TeGeometry.h"
-#include "TeRasterTransform.h"
-
-//! A functional class to transform a raster geometry into another geometry
-/*!
- RasterRemap class provides functions to remap a raster strtucture into another.
- The two raster can have a different projections, different bounding boxes and/or
- different resolutions.
-
- \sa
- TeRaster, TeRasterParams, TeRasterTransform, TeProjection, TeBox
-
- \note Raster representation in TerraLib is under development, all files that deal
- with raster representation should be considered as a beta version.
-*/
-class TL_DLL TeRasterRemap
-{
-protected:
- TeRaster* rasterIn_; //!< input raster
- TeRaster* rasterOut_; //!< output raster
-
- TeRasterTransform* transformer_;
-
- int interpolation_;
- bool showProgress_;
-
-
- TeBox ROI_; // region of interest (from input) where the remmaping should be done
-
- void TeInterpolateIn (TeBox &box);
-
- bool remap ();
- bool copy ();
- bool resample ();
-
-public:
-
- //! Constructor
- /*
- \param rasterIn pointer to the input raster
- \param rasterOut pointer to the output raster
- \para showProgress flag to indicate that a progress status hould be reported
- */
- TeRasterRemap (TeRaster* rasterIn=0, TeRaster* rasterOut=0, bool showProgress = false):
- rasterIn_(rasterIn),
- rasterOut_(rasterOut),
- transformer_(0),
- interpolation_(0),
- showProgress_(showProgress),
- ROI_(TeBox())
- {}
-
- //! Sets the input raster
- void setInput(TeRaster* rasterIn)
- {
- rasterIn_ = rasterIn;
- if (transformer_)
- transformer_->setRasterIn(rasterIn_);
- }
-
- //! Sets the output raster
- void setOutput(TeRaster* rasterOut)
- {
- rasterOut_ = rasterOut;
- if (transformer_)
- transformer_->setRasterOut(rasterOut_);
- }
-
- //! Sets the interpolation flag
- void setInterpolation(int interpolation)
- { interpolation_ = interpolation; }
-
- //! Sets the transformation to be used when doing remap
- void setTransformer(TeRasterTransform* transf)
- {
- if (transf)
- {
- transformer_ = transf;
- transformer_->setRasterOut(rasterOut_);
- transformer_->setRasterIn(rasterIn_);
- }
- }
-
- //! Returns the transformation to be used when doing remap
- TeRasterTransform* transformer()
- { return transformer_; }
-
- //! Applies the remaping
- bool apply(bool showProgress = false);
-
- //! Defines a region of interest where the remmaping should be done
- /*
- \par roi a box that represents the region of interest. It should
- be inside the raster in bounding box;
- \return false if the roi in invalid or it is not within the input
- raster. True otherwise
- */
- bool setROI(TeBox& roi);
-};
-
-#endif
-
diff --git a/src/terralib/kernel/TeRasterTransform.cpp b/src/terralib/kernel/TeRasterTransform.cpp
deleted file mode 100644
index 64e78ba..0000000
--- a/src/terralib/kernel/TeRasterTransform.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeRasterTransform.h"
-#include "TeVisual.h"
-
-void
-TeRasterTransform::generateLUT(TeLegendEntryVector& legs, unsigned int nentries, TeColor& backColor)
-{
- // find the range covered by the legends
- unsigned int n;
- double vmin = TeMAXFLOAT;
- double vmax = TeMINFLOAT;
- for (n=0; n <legs.size(); n++)
- {
- if (atof(legs[n].slice().from_.c_str()) < vmin)
- vmin = atof(legs[n].slice().from_.c_str());
- if (atof(legs[n].slice().to_.c_str()) > vmax)
- vmax = atof(legs[n].slice().to_.c_str());
- }
- // do a linear transformation from the range defined by the legend to the number of entries
- this->setLinearTransfParameters(vmin,vmax, 0, nentries-1);
-
- // initialize lut with the background color
- lutr_.clear();
- lutg_.clear();
- lutb_.clear();
-
- lutr_.insert(lutr_.begin(),nentries,backColor.red_);
- lutg_.insert(lutg_.begin(),nentries,backColor.green_);
- lutb_.insert(lutb_.begin(),nentries,backColor.blue_);
-
- // to each entry define its equivalent range of indexes on the LUT
- int nunIndx = 0;
- int indexFrom, indexTo;
- for (n=0; n <legs.size(); n++)
- {
- // find the range of entries that
- indexFrom = (int)(atof(legs[n].slice().from_.c_str()) * gain_ + offset_);
- if (indexFrom < 0)
- indexFrom = 0;
- indexTo = (int)(atof(legs[n].slice().to_.c_str()) * gain_ + offset_);
- if (indexTo > (int)nentries)
- indexTo = nentries;
- nunIndx = indexTo - indexFrom + 1;
- if (nunIndx >= 1)
- {
- fill_n(&lutr_[indexFrom],nunIndx,legs[n].getVisualMap()[TePOLYGONS]->color().red_);
- fill_n(&lutg_[indexFrom],nunIndx,legs[n].getVisualMap()[TePOLYGONS]->color().green_);
- fill_n(&lutb_[indexFrom],nunIndx,legs[n].getVisualMap()[TePOLYGONS]->color().blue_);
- }
- }
- lutSize_ = lutr_.size();
-}
-
-TeRasterTransform::TeRasterTransfFunctions TeRasterTransform::getTransfFunction()
-{
- if (transfFuncPtr_ == 0)
- return TeNoTransf;
-
- if (transfFuncPtr_ == &TeRasterTransform::Mono2ThreeBand)
- return TeMono2Three;
-
- if (transfFuncPtr_ == &TeRasterTransform::Band2Band)
- return TeBand2Band;
-
- if (transfFuncPtr_ == &TeRasterTransform::Pallete2ThreeBand)
- return TePall2Three;
-
- if (transfFuncPtr_ == &TeRasterTransform::LUT2ThreeBand)
- return TeLUT2Three;
-
- if (transfFuncPtr_ == &TeRasterTransform::ExtractRGB)
- return TeExtractRGB;
-
- if (transfFuncPtr_ == &TeRasterTransform::ExtractBand)
- return TeExtractBand;
-
- if (transfFuncPtr_ == &TeRasterTransform::ExtractBands)
- return TeExtractBands;
-
- if (transfFuncPtr_ == &TeRasterTransform::ThreeBand2RGB)
- return TeThreeBand2RGB;
- else
- return TeNoTransf;
-}
-
-void TeRasterTransform::setTransfFunction(TeRasterTransfFunctions func)
-{
- if (func == TeMono2Three)
- transfFuncPtr_ = &TeRasterTransform::Mono2ThreeBand;
-
- else if (func == TeBand2Band)
- transfFuncPtr_ = &TeRasterTransform::Band2Band;
-
- else if (func == TePall2Three)
- transfFuncPtr_ = &TeRasterTransform::Pallete2ThreeBand;
-
- else if (func == TeLUT2Three)
- transfFuncPtr_ = &TeRasterTransform::LUT2ThreeBand;
-
- else if (func == TeExtractRGB)
- transfFuncPtr_ = &TeRasterTransform::ExtractRGB;
-
- else if (func == TeExtractBand)
- transfFuncPtr_ = &TeRasterTransform::ExtractBand;
-
- else if (func == TeExtractBands)
- transfFuncPtr_ = &TeRasterTransform::ExtractBands;
-
- else if (func == TeThreeBand2RGB)
- transfFuncPtr_ = &TeRasterTransform::ThreeBand2RGB;
-
- else
- transfFuncPtr_ = 0;
-}
diff --git a/src/terralib/kernel/TeRasterTransform.h b/src/terralib/kernel/TeRasterTransform.h
deleted file mode 100644
index 11b3d3a..0000000
--- a/src/terralib/kernel/TeRasterTransform.h
+++ /dev/null
@@ -1,357 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeRasterTransform.h
- \brief This file deals with the transformation functions over raster pixels
-*/
-#ifndef __TERRALIB_INTERNAL_RASTERTRANSFORM_H
-#define __TERRALIB_INTERNAL_RASTERTRANSFORM_H
-
-#include "TeRaster.h"
-#include "TeLegendEntry.h"
-
-#include <map>
-#include <vector>
-using namespace std;
-
-//! This class defines a way of evaluating the final value of a raster element
-class TL_DLL TeRasterTransform
-{
-public:
-
- //! The three channels of a display
- enum TeRGBChannels { TeREDCHANNEL=0, TeGREENCHANNEL=1, TeBLUECHANNEL=2 };
-
- enum TeRasterTransfFunctions
- { TeNoTransf=0, TeMono2Three=1, TeBand2Band=2, TePall2Three=3, TeLUT2Three=4,
- TeExtractRGB=5, TeExtractBand=6, TeExtractBands=7, TeThreeBand2RGB=8 };
-
- //! One of the available transformation methods
- typedef void (TeRasterTransform::*TransformFunction)(double, double, double, double);
-
-private:
-
- TeRaster* rasterIn_;
- TeRaster* rasterOut_;
-
- double gain_, offset_;
-
- map<TeRGBChannels,short> rgbmap_;
-
- short mband_, mbout_;
-
- TransformFunction transfFuncPtr_;
-
- double rmin_, rmax_;
-
- int lutSize_;
-
- double contrastR_, contrastG_, contrastB_;
- double contrastM_;
-
- unsigned int transp_;
-
-public:
-
- vector<unsigned char> lutr_;
- vector<unsigned char> lutg_;
- vector<unsigned char> lutb_;
-
- //! Constructor
- TeRasterTransform(TeRaster* rIn=0, TeRaster* rOut=0):
- rasterIn_(rIn),
- rasterOut_(rOut),
- gain_(1),
- offset_(0),
- mband_(0),
- mbout_(0),
- transfFuncPtr_(&TeRasterTransform::Band2Band),
- rmax_(TeMAXFLOAT),
- lutSize_(0),
- contrastR_(1.0),
- contrastG_(1.0),
- contrastB_(1.0),
- contrastM_(1.0),
- transp_(255)
- {
- rmin_ = -1 * TeMAXFLOAT;
- }
-
- //! Destructor
- ~TeRasterTransform()
- {
- lutr_.clear();
- lutb_.clear();
- lutg_.clear();
- rgbmap_.clear();
- transfFuncPtr_ = 0;
- }
-
- //! Sets the size of the LUT being used
- void setLutSize(int n)
- { lutSize_ = n; }
-
- //! Gets the size of the LUT being used
- int getLutSize()
- { return lutSize_; }
-
- //! Sets the input raster
- void setRasterIn(TeRaster* rIn)
- { rasterIn_ = rIn; }
-
- //! Sets the input raster
- void setRasterOut(TeRaster* rOut)
- { rasterOut_ = rOut; }
-
- //! Sets the gain
- void setGain(double g)
- { gain_= g; }
-
- //! Sets the offset
- void setOffset(double o)
- { offset_= o; }
-
- //! Sets the transformation method to be used
- void setTransfFunction(TeRasterTransform::TransformFunction transfFuncPtr)
- { transfFuncPtr_ = transfFuncPtr; }
-
- //! Sets the mapping from bands to R,G and B channels
- void setRGBmap (map<TeRGBChannels,short>& rgbmap)
- {
- if (rgbmap.size() < 3)
- return;
- rgbmap_.clear();
- rgbmap_ = rgbmap;
- }
-
- //! Sets the mapping from a particular input band to a particular output channel
- void setBChannelMapping(short bIn, TeRGBChannels bOut)
- {
- rgbmap_[bOut] = bIn;
- }
-
- //! Clears current mapping from bands to channel
- void clearRGBMap()
- {
- rgbmap_.clear();
- }
-
- //! Returns the mapping from a particular input band to a particular output channel
- map<TeRGBChannels,short>& getRGBMap()
- {
- return rgbmap_;
- }
-
- //! Sets the mono band to be transformed
- void setSrcBand(short n)
- { mband_ = n; }
-
- //! Gets the mono band to be transformed
- short getSrcBand()
- { return mband_; }
-
- //! Sets the destination of the mono band
- void setDestBand(short n)
- { mbout_ = n; }
-
- //! Gets the destination of the mono band
- short getDestBand()
- { return mbout_; }
-
- //! Generates a LUT with nentries to display the vector of legends
- void generateLUT(TeLegendEntryVector& legs, unsigned int nentries, TeColor& backColor);
-
- //! Set parameters of linear transformation
- /*!
- \param vmin smallest input value
- \param vmax largest input value
- \param rmin smallest value of the output range
- \param rmax largest value of the output range
- */
- void setLinearTransfParameters(double vmin, double vmax, double rmin, double rmax)
- {
- rmin_ = rmin;
- rmax_ = rmax;
- gain_ = (double)(rmax-rmin)/(vmax-vmin);
- offset_ = -1*gain_*vmin+rmin;
- }
-
-//--- Simple contrast linear factors
- void setContrastR(double cR)
- { contrastR_ = cR; }
- void setContrastG(double cG)
- { contrastG_ = cG; }
- void setContrastB(double cB)
- { contrastB_ = cB; }
- void setContrastM(double cM)
- { contrastM_ = cM; }
-
- double getContrastR()
- { return contrastR_; }
- double getContrastG()
- { return contrastG_; }
- double getContrastB()
- { return contrastB_; }
- double getContrastM()
- { return contrastM_; }
-
-
- void setTransparency(unsigned int transp)
- { transp_ = transp; }
- unsigned int getTransparency()
- { return transp_; }
-//---
-
- //! Applies the selected transformation method
- void apply(double icol, double ilin, double ocol, double olin)
- { (this->*transfFuncPtr_)(icol,ilin,ocol,olin); }
-
- //! Returns the identifier of the transformation function currently set
- TeRasterTransfFunctions getTransfFunction();
-
- //! Sets the associated transformation function from an identifier
- void setTransfFunction(TeRasterTransfFunctions func);
-
-// --- The transformation functions available ----
- //! This transformation repeats the value of the first band in input three bands of the output
- void Mono2ThreeBand(double icol, double ilin, double ocol, double olin)
- {
- double val;
- if (rasterIn_->getElement((int)icol,(int)ilin,val,mband_))
- {
- val = (val*gain_ + offset_)*contrastM_;
- if (val < rmin_)
- val = rmin_;
- else if (val > rmax_)
- val = rmax_;
- rasterOut_->setElement((int)ocol,(int)olin, val, val, val, transp_);
- }
- }
-
- //! This transformation repeats the value of each band in input to the same band in output
- void Band2Band(double icol, double ilin, double ocol, double olin)
- {
- double val;
- int n = rasterOut_->params().nBands();
- for (int i=0; i<n; i++)
- if (rasterIn_->getElement((int)icol,(int)ilin,val,i))
- {
- val = val*gain_ + offset_;
- if (val < rmin_)
- val = rmin_;
- else if (val > rmax_)
- val = rmax_;
- rasterOut_->setElement((int)ocol,(int)olin,val,i);
- }
- }
-
- //! This transformation repeats the value of the raster LUT in input to the first 3 bands of output
- void Pallete2ThreeBand(double icol, double ilin, double ocol, double olin)
- {
- double val;
- if (rasterIn_->getElement((int)icol,(int)ilin,val))
- {
- if (val>= 0 && (unsigned int)val < rasterIn_->params().lutr_.size())
- {
- rasterOut_->setElement((int)ocol,(int)olin,rasterIn_->params().lutr_[(int)val],
- rasterIn_->params().lutg_[(int)val],
- rasterIn_->params().lutb_[(int)val], transp_);
- }
- }
- }
-
- //! This transformation repeats the value of the first band in input three bands of the output
- void ThreeBand2RGB(double icol, double ilin, double ocol, double olin)
- {
- double valR, valG, valB;
- bool flag = rasterIn_->getElement((int)icol,(int)ilin,valR,0);
- flag = rasterIn_->getElement((int)icol,(int)ilin,valG,1) || flag;
- flag = rasterIn_->getElement((int)icol,(int)ilin,valB,2) || flag;
-
- if (flag)
- rasterOut_->setElement((int)ocol,(int)olin, (valR*gain_ + offset_)*contrastR_,
- (valG*gain_ + offset_)*contrastG_,
- (valB*gain_ + offset_)*contrastB_, transp_);
- }
-
- //! This transformation repeats the value of an external LUT to the first 3 bands of output
- void LUT2ThreeBand(double icol, double ilin, double ocol, double olin)
- {
- double idx, val;
- if (rasterIn_->getElement((int)icol,(int)ilin,val,mband_))
- {
- idx = (val*gain_) + offset_;
- if (idx >= 0 && idx < lutSize_)
- {
- rasterOut_->setElement((int)ocol,(int)olin,lutr_[(int)idx]*contrastR_,
- lutg_[(int)idx]*contrastG_,
- lutb_[(int)idx]*contrastB_, transp_);
- }
- }
- }
-
- // This transformation is used to define a particular mapping from input bands to RGB channels
- void ExtractRGB(double icol, double ilin, double ocol, double olin)
- {
- double valR, valG, valB;
- bool flag = rasterIn_->getElement((int)icol,(int)ilin,valR,rgbmap_[TeREDCHANNEL]);
- flag = rasterIn_->getElement((int)icol,(int)ilin,valG,rgbmap_[TeGREENCHANNEL]) || flag;
- flag = rasterIn_->getElement((int)icol,(int)ilin,valB,rgbmap_[TeBLUECHANNEL]) || flag;
-
- if (flag)
- rasterOut_->setElement((int)ocol,(int)olin, (valR*gain_ + offset_)*contrastR_,
- (valG*gain_ + offset_)*contrastG_,
- (valB*gain_ + offset_)*contrastB_, transp_);
- }
-
- //! This transformation repeats the value of a particular band in input to a particular band of the output
- void ExtractBand(double icol, double ilin, double ocol, double olin)
- {
- double val;
- if (rasterIn_->getElement((int)icol,(int)ilin,val,mband_))
- {
- val = val*gain_ + offset_;
- if (val < rmin_)
- val = rmin_;
- else if (val > rmax_)
- val = rmax_;
- rasterOut_->setElement((int)ocol,(int)olin,val*contrastM_,mbout_);
- }
- }
-
- // This transformation extracts selected bands of the input raster and
- // writes each to a particular band of the output
- void ExtractBands(double icol, double ilin, double ocol, double olin)
- {
- double val;
- map<TeRGBChannels,short>::iterator it = rgbmap_.begin();
- while (it != rgbmap_.end())
- {
- if (rasterIn_->getElement((int)icol,(int)ilin,val,it->second))
- rasterOut_->setElement((int)ocol,(int)olin,val,it->first);
- }
- }
-
-};
-#endif
-
-
diff --git a/src/terralib/kernel/TeRedBlackTree.h b/src/terralib/kernel/TeRedBlackTree.h
deleted file mode 100644
index 4784284..0000000
--- a/src/terralib/kernel/TeRedBlackTree.h
+++ /dev/null
@@ -1,763 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeRedBlackTree.h
- \brief This file contains structures and definitions for a balanced binary search tree.
- \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
-*/
-
-#ifndef __TERRALIB_INTERNAL_RED_BLACK_TREE_H
-#define __TERRALIB_INTERNAL_RED_BLACK_TREE_H
-
-//STL's include
-#include <string>
-
-//TerraLib's include
-#include "TeUtils.h"
-
-using namespace std;
-
-#define PRINT
-
-/** @brief Contains structures and definitions necessary to deal with a balanced Binary Search Tree
-*/
-namespace TeREDBLACK
-{
-
- //! Possible values for a node color in a red-black tree
- enum TeRBNodeColor { TeREDNODE, TeBLACKNODE };
-
- //! Template class for nodes in a Red-Black tree.
- /*!
- This class contains the common attributes to a node
- used by a binary tree. Only used for commom binary trees,
- if you want a more sophisticated tree, you can continue
- using the Red-Black Tree framework defined below, it is possible
- taking care of some default attributes that a node must
- have to implement (left_, right_, parent_, data_).
- */
- template<class T>
- class TeRedBlackNode
- {
- public:
-
- //! Export node's data type.
- typedef T TeRedBlackNodeData;
-
- //! Node's data.
- T data_;
-
- //! Pointer to the left sub-tree.
- TeRedBlackNode* left_;
-
- //! Pointer to the right sub-tree.
- TeRedBlackNode* right_;
-
- //! Pointeir to the father's node.
- TeRedBlackNode* parent_;
-
- //! Node's color (RED or BLACK).
- TeRBNodeColor color_;
-
- //! Constructor.
- TeRedBlackNode(const TeRBNodeColor& color = TeREDNODE)
- : left_(0), right_(0), parent_(0), color_(color)
- {
- }
-
- //! Constructor.
- TeRedBlackNode(T& d, const TeRBNodeColor& color = TeREDNODE)
- : data_(d), left_(0), right_(0), parent_(0), color_(color)
- {
- }
-
-
- private:
-
- //! No copy allowed
- TeRedBlackNode(const TeRedBlackNode& other);
-
- // No copy allowed
- TeRedBlackNode& operator=(const TeRedBlackNode& other);
- };
-
- //! Template class for Red-Black trees.
- /*!
- This class contains the common operations in a Red-Black Tree.
- It can be used like a framework. Extend the methods like
- "Insert" and "Search" to walk and to do some usefull things.
- You will use the methods for Rotation, Insert Propagation,
- Delete Propagation, Sucessor, Predecessor, IsEmpty, Clear.
- This tree is based on the algorithm of Cormen's book. The only difference is
- when a node being deleted has two children its successor node is relinked into its place,
- rather than copied, so that the only iterators invalidated are those referring to the deleted node.
- Every data used in nodes must implements a ToString() method.
- */
- template<class NODE>
- class TeRBTree
- {
- private:
-
- //! No copy allowed.
- TeRBTree(const TeRBTree& other);
-
- //! No copy allowed.
- TeRBTree& operator=(const TeRBTree& other);
-
- protected:
-
- NODE* nil_; //!< Reference node.
- NODE* root_; //!< Tree's root.
- unsigned int nodeCount_; //!< Count the number of nodes in the tree (excluding nil_ node).
-
- public:
-
- //! Export node type.
- typedef NODE* REDBLACKNODEPOINTER;
-
- //! Export node data type.
- typedef typename NODE::TeRedBlackNodeData TeRedBlackNodeData;
-
- //! Constructor.
- TeRBTree()
- : nodeCount_(0)
- {
- nil_ = new NODE();
- nil_->color_ = TeBLACKNODE;
-
- root_ = nil_;
-
- }
-
- //! Destructor.
- virtual ~TeRBTree()
- {
- Clear();
-
- if(nil_)
- delete nil_;
- }
-
- //! Returns true if the tree is empty otherwise returns false.
- bool IsEmpty(void) const
- {
- return root_ == nil_;
- }
-
- //! Returns the number of nodes in the tree, excluding the nil_ one.
- unsigned int Size(void) const
- {
- return nodeCount_;
- }
-
- //! Removes the node from the tree and do rebalancing.
- virtual void Delete(NODE* z)
- {
- if(z)
- {
- // z has at most one non-null child. y == z.
- // x might be null.
- // z has exactly one non-null child. y == z.
- // x is not null.
- // z has two non-null children. Set y to
- // z's successor. x might be null.
- NODE* y = ((z->left_ == nil_) || (z->right_ == nil_)) ? z : Successor(z);
- NODE* x = (y->left_ != nil_) ? y->left_ : y->right_;
- NODE* x_parent = 0;
-
- if(y != z) // relink y in place of z. y is z's successor
- {
- z->left_->parent_ = y;
- y->left_ = z->left_;
- if(y != z->right_)
- {
- x_parent = y->parent_;
-
- if(x != nil_)
- x->parent_ = y->parent_;
-
- y->parent_->left_ = x; // y must be a left child
- y->right_ = z->right_;
- z->right_->parent_ = y;
- }
- else
- x_parent = y;
-
- if(root_ == z)
- root_ = y;
- else
- if(z->parent_->left_ == z)
- z->parent_->left_ = y;
- else
- z->parent_->right_ = y;
-
- y->parent_ = z->parent_;
-
- TeRBNodeColor aux_color = y->color_;
- y->color_ = z->color_;
- z->color_ = aux_color;
-
- y = z;
-
- // y now points to node to be actually deleted
- }
- else
- { // y == z
- x_parent = y->parent_;
- if(x != nil_)
- x->parent_ = y->parent_;
-
- if(root_ == z)
- root_ = x;
- else
- if(z->parent_->left_ == z)
- z->parent_->left_ = x;
- else
- z->parent_->right_ = x;
- }
-
- if(y->color_ == TeBLACKNODE)
- DeleteFixUp(x, x_parent, root_);
-
- delete y;
-
- nodeCount_--;
- }
-
- return;
- }
-
- //! Returns the sucessor of a given node or zero if not.
- virtual NODE* Successor(NODE* x) const
- {
- if(x)
- {
- if(x->right_ != nil_)
- {
- x = x->right_;
-
- while(x->left_ != nil_)
- x = x->left_;
-
- return x;
- }
-
- NODE* y = x->parent_;
-
- while((y != nil_) && (x == y->right_))
- {
- x = y;
- y = y->parent_;
- }
-
- if(y == nil_)
- return 0;
-
- return y;
- }
-
- return 0;
- }
-
- //! Returns the predecessor of a given node or zero if not.
- virtual NODE* Predecessor(NODE* x) const
- {
- if(x)
- {
- if(x->left_ != nil_)
- {
- x = x->left_;
-
- while(x->right_ != nil_)
- x = x->right_;
-
- return x;
- }
-
- NODE* y = x->parent_;
-
- while((y != nil_) && (x == y->left_))
- {
- x = y;
- y = y->parent_;
- }
-
- if(y == nil_)
- return 0;
-
- return y;
- }
-
- return 0;
- }
-
- //! Returns the leftmost node in the tree, or zero if not.
- NODE* First(void) const
- {
- if(IsEmpty())
- return 0;
-
- NODE *x = root_;
-
- while(x->left_ != nil_)
- x = x->left_;
-
- return x;
- }
-
- //! Returns the rightmost node in the tree, or zero if not.
- NODE* Last(void) const
- {
- if(IsEmpty())
- return 0;
-
- NODE *x = root_;
-
- while(x->right_ != nil_)
- x = x->right_;
-
- return x;
- }
-
- //! Return the first element in the tree and removes it.
- virtual bool GetFirst(TeRedBlackNodeData& d)
- {
- NODE *x = First();
-
- if(x)
- {
- d = x->data_;
-
- Delete(x);
-
- return true;
- }
-
- return false;
- }
-
- //! Removes all nodes from the tree (excepty the nil node). Clear memory.
- void Clear(void)
- {
- if(!IsEmpty())
- {
- Erase(root_);
-
- root_ = nil_;
- }
-
- return;
- }
-
- //! Write the node's data to a file. The data must implement a methos called: void ToString(void).
- virtual void WriteToFile(const string& fileName) const
- {
- string strRepres = "";
-
- WriteToFile(root_, strRepres);
-
- TeWriteToFile(fileName, strRepres, "w");
-
- return;
- }
-
- protected:
-
- //! Left rotation.
- virtual void LeftRotate(NODE* x, NODE*& root)
- {
- NODE* y = x->right_;
-
- x->right_ = y->left_;
-
- if(y->left_ != nil_)
- y->left_->parent_ = x;
-
- y->parent_ = x->parent_;
-
-
- if(x == root)
- root = y;
- else
- {
- if(x == x->parent_->left_)
- x->parent_->left_ = y;
- else
- x->parent_->right_ = y;
- }
-
- y->left_ = x;
- x->parent_ = y;
-
- return;
- }
-
- //! Right rotation.
- virtual void RightRotate(NODE* y, NODE*& root)
- {
- NODE* x = y->left_;
-
- y->left_ = x->right_;
-
- if(x->right_ != nil_)
- x->right_->parent_ = y;
-
- x->parent_ = y->parent_;
-
- if(y == root)
- root = x;
- else
- {
- if(y == y->parent_->right_)
- y->parent_->right_ = x;
- else
- y->parent_->left_ = x;
- }
-
- x->right_ = y;
- y->parent_ = x;
-
- return;
- }
-
- //! Must be called after an insert, to fix-up the tree.
- void InsertFixUp(NODE*& n, NODE*& root)
- {
- n->color_ = TeREDNODE;
-
- NODE* y;
-
- while ((n != root) && (n->parent_->color_ == TeREDNODE))
- {
- if(n->parent_ == n->parent_->parent_->left_)
- {
- y = n->parent_->parent_->right_;
- if(y->color_ == TeREDNODE)
- {
- n->parent_->color_ = TeBLACKNODE;
- y->color_ = TeBLACKNODE;
- n = n->parent_->parent_;
- n->color_ = TeREDNODE;
- }
- else
- {
- if(n == n->parent_->right_)
- {
- n = n->parent_;
- LeftRotate(n, root);
- }
-
- n->parent_->color_ = TeBLACKNODE;
- n->parent_->parent_->color_ = TeREDNODE;
- RightRotate(n->parent_->parent_, root);
- }
- }
- else
- {
- y = n->parent_->parent_->left_;
- if(y->color_ == TeREDNODE)
- {
- n->parent_->color_ = TeBLACKNODE;
- y->color_ = TeBLACKNODE;
- n = n->parent_->parent_;
- n->color_ = TeREDNODE;
- }
- else
- {
- if(n == n->parent_->left_)
- {
- n = n->parent_;
- RightRotate(n, root);
- }
-
- n->parent_->color_ = TeBLACKNODE;
- n->parent_->parent_->color_ = TeREDNODE;
- LeftRotate(n->parent_->parent_, root);
- }
- }
- }
-
- root->color_ = TeBLACKNODE;
-
- return;
- }
-
- //! Must be called after a deletion, to fix-up the tree.
- void DeleteFixUp(NODE* x, NODE* x_parent, NODE*& root)
- {
- while((x != root) && (x == nil_ || x->color_ == TeBLACKNODE))
- {
- if(x == x_parent->left_)
- {
- NODE *w = x_parent->right_;
-
- if(w->color_ == TeREDNODE)
- {
- w->color_ = TeBLACKNODE;
- x_parent->color_ = TeREDNODE;
- LeftRotate(x_parent, root);
- w = x_parent->right_;
- }
-
- if((w->left_ == nil_ || w->left_->color_ == TeBLACKNODE) && (w->right_ == nil_ || w->right_->color_ == TeBLACKNODE))
- {
- w->color_ = TeREDNODE;
- x = x_parent;
- x_parent = x_parent->parent_;
- }
- else
- {
- if(w->right_ == nil_ || w->right_->color_ == TeBLACKNODE)
- {
- if(w->left_ != nil_)
- w->left_->color_ = TeBLACKNODE;
-
- w->color_ = TeREDNODE;
- RightRotate(w, root);
- w = x_parent->right_;
- }
-
- w->color_ = x_parent->color_;
- x_parent->color_ = TeBLACKNODE;
-
- if(w->right_ != nil_)
- w->right_->color_ = TeBLACKNODE;
-
- LeftRotate(x_parent, root);
-
- break;
- }
- }
- else
- {
- NODE* w = x_parent->left_;
-
- if(w->color_ == TeREDNODE)
- {
- w->color_ = TeBLACKNODE;
- x_parent->color_ = TeREDNODE;
- RightRotate(x_parent, root);
- w = x_parent->left_;
- }
-
- if((w->left_ == nil_ || w->left_->color_ == TeBLACKNODE) && (w->right_ == nil_ || w->right_->color_ == TeBLACKNODE))
- {
- w->color_ = TeREDNODE;
- x = x_parent;
- x_parent = x_parent->parent_;
- }
- else
- {
- if(w->left_ == nil_ || w->left_->color_ == TeBLACKNODE)
- {
- if(w->right_ != nil_)
- w->right_->color_ = TeBLACKNODE;
-
- w->color_ = TeREDNODE;
- LeftRotate(w, root);
- w = x_parent->left_;
- }
-
- w->color_ = x_parent->color_;
- x_parent->color_ = TeBLACKNODE;
-
- if(w->left_ != nil_)
- w->left_->color_ = TeBLACKNODE;
-
- RightRotate(x_parent, root);
-
- break;
- }
- }
- }
-
- if(x != nil_)
- x->color_ = TeBLACKNODE;
- }
-
- //! Only to be used by the public method, walking on the tree.
- virtual void WriteToFile(NODE* n, string& strRepres) const
- {
- if(n != nil_)
- {
- WriteToFile(n->left_, strRepres);
-
- strRepres += n->data_.ToString();
- strRepres += '\n';
-
- WriteToFile(n->right_, strRepres);
- }
-
- return;
- }
-
- //! Removes the node and all node below it and doesn't do rebalancing. Used to free the memory.
- void Erase(NODE* n)
- {
- if(n != nil_)
- {
- Erase(n->left_);
- Erase(n->right_);
-
- delete n;
-
- nodeCount_--;
- }
-
- return;
- }
-
- public:
-
- //! Iterators class for the tree. It is used to abstract walking on the tree.
- template<class Node_i> class internal_iterator
- {
- protected:
-
- //! Pointer to the tree.
- TeRBTree<Node_i>* tree_;
-
- //! Pointer to the node.
- Node_i* node_;
-
- public:
-
- //! Makes iterator invalid
- void invalid(void)
- {
- node_ = 0;
- return;
- }
-
- //! Returns node pointer
- Node_i* getNode(void) const
- {
- return node_;
- }
-
- public:
-
- //! Constructor.
- internal_iterator()
- : node_(0), tree_(0)
- {
- }
-
- //! Constructor
- internal_iterator(TeRBTree<Node_i>* tree, Node_i* n)
- : tree_(tree), node_(n)
- {
- }
-
- //! Destructor.
- virtual ~internal_iterator()
- {
- }
-
- //! Dereference operator.
- typename Node_i::TeRedBlackNodeData* operator->() const
- {
- return &node_->data_;
- }
-
- //! Dereference operator.
- typename Node_i::TeRedBlackNodeData& operator*() const
- {
- return node_->data_;
- }
-
- //! Operator ++ pre-fixed.
- internal_iterator& operator++()
- {
- node_ = tree_->Successor(node_);
-
-
- return *this;
- }
-
- //! Operator ++ pos-fixed
- internal_iterator operator++(int)
- {
- internal_iterator temp = *this;
- ++(*this);
-
- return temp;
- }
-
- //! Operator -- pre-fixed.
- internal_iterator& operator--()
- {
- node_ = tree_->Predecessor(node_);
-
-
- return *this;
- }
-
- //! Operator -- pos-fixed
- internal_iterator operator--(int)
- {
- internal_iterator temp = *this;
- --(*this);
- return temp;
- }
-
- //! Operator ==.
- bool operator==(const internal_iterator& other) const
- {
- return (this->node_ == other.node_);
- }
-
- //! Operator !=.
- bool operator!=(const internal_iterator& other) const
- {
- return(this->node_ != other.node_);
- }
- };
-
- //! Exports iterator type.
- typedef internal_iterator<NODE> iterator;
-
- //! Returns an iterator to the leftmost node of the tree.
- iterator begin(void)
- {
- return iterator(this, First());
- }
-
- //! Returns a reference iterator indicating the end of a tree.
- iterator end(void)
- {
- return iterator(this, 0);
- }
-
- //! Erases a node pointed by an interator.
- void erase(iterator& it)
- {
- Delete(it.getNode());
-
- it.invalid();
-
- return;
- }
- };
-
-} // end namespace TeREDBLACK
-#endif // __TERRALIB_INTERNAL_RED_BLACK_TREE_H
diff --git a/src/terralib/kernel/TeRepresentation.cpp b/src/terralib/kernel/TeRepresentation.cpp
deleted file mode 100644
index b22ac06..0000000
--- a/src/terralib/kernel/TeRepresentation.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeRepresentation.h"
-
-TeRepresPointerVectorIterator
-TeFindRepresentation(TeRepresPointerVectorIterator begin, TeRepresPointerVectorIterator end, TeGeomRep rep)
-{
- return find_if(begin,end,TeRepres_eq(rep));
-}
diff --git a/src/terralib/kernel/TeRepresentation.h b/src/terralib/kernel/TeRepresentation.h
deleted file mode 100644
index cb7cb36..0000000
--- a/src/terralib/kernel/TeRepresentation.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeRepresentation.h
- \brief This file contains structures and definitions to deal with a geometrical representation
-*/
-#ifndef __TERRALIB_INTERNAL_REPRESENTATION_H
-#define __TERRALIB_INTERNAL_REPRESENTATION_H
-
-#include "TeDataTypes.h"
-#include "TeBox.h"
-
-#include <algorithm>
-#include <string>
-
-//! A class to supporting a geometrical representation
-struct TL_DLL TeRepresentation
-{
- int id_; //!< representation unique dabatase identifier
- TeGeomRep geomRep_; //!< representation type (
- std::string tableName_; //!< name of the table that stores the geometries associated to this representation
- TeBox box_; //!< representation bounding box
- std::string description_; //!< representation description
- double resX_; //!< the x resolution of the layer cell set geometry
- double resY_; //!< the y resolution of the layer cell set geometry
- int nCols_; //!< number of columns in raster geometry
- int nLins_; //!< number of columns in raster geometry
-
- //! Constructor
- TeRepresentation() :
- resX_(0.0),
- resY_(0.0),
- nCols_(0),
- nLins_(0)
- {}
-};
-
-//! A functor class to compare representations by its type
-class TL_DLL TeRepres_eq : public unary_function<TeRepresentation*,bool>
-{
- TeGeomRep r;
-public:
- explicit TeRepres_eq(TeGeomRep rr): r(rr) {}
- bool operator()(const TeRepresentation* rep) const { return rep->geomRep_ == r; }
-};
-
-//! An iterator to a std::vector of TeRepresentation
-typedef std::vector<TeRepresentation* >::iterator TeRepresPointerVectorIterator;
-
-//! A std::vector of pointers to TeRepresentation
-typedef std::vector<TeRepresentation* > TeRepresPointerVector;
-
-//! Finds the first representation of a given type in a std::vector of representations
-TL_DLL TeRepresPointerVectorIterator
-TeFindRepresentation(TeRepresPointerVectorIterator begin, TeRepresPointerVectorIterator end, TeGeomRep rep);
-
-#endif
-
-
diff --git a/src/terralib/kernel/TeSTEFunctionsDB.h b/src/terralib/kernel/TeSTEFunctionsDB.h
deleted file mode 100644
index 23d8041..0000000
--- a/src/terralib/kernel/TeSTEFunctionsDB.h
+++ /dev/null
@@ -1,432 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library p rovided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeSTEFunctionsDB.h
- \brief This file contains a set of functions to build spatio-temporal sets from a TerraLib databse
-*/
-#ifndef __TERRALIB_INTERNAL_STOFUNCTIONS_H
-#define __TERRALIB_INTERNAL_STOFUNCTIONS_H
-
-#include "TeDatabase.h"
-#include "TeProgress.h"
-#include <vector>
-#include <string>
-
-//! Builds the spatial object set from database according to the restrictions previously defined
-/*!
- \param stoset the STOSet that will be filled
- \param loadGeometries if the STOSet will be filled with the geometries
- \param loadAllAttributes if the STOSet will be filled with all attributes of the tables of the STOSet
- \param attrNames a subset of the attribute names that will be loaded, if the param loadAllAttributes is false
-*/
-template<typename elementSet>
-bool TeSTOSetBuildDB(elementSet* stoset, bool loadGeometries = false, bool loadAllAttributes = false, vector<string> attrNames = vector<string>());
-
-//! Builds the spatial object set from database according to the restrictions previously defined
-/*!
- \param stoset the STOSet that will be filled
- \param groupAttr a map from attribute name to statistic type
- \param loadGeometries if the STOSet will be filled with the geometries
-*/
-template<typename elementSet>
-bool TeSTOSetBuildDB(elementSet* stoset, TeGroupingAttr& groupAttr, bool loadGeometries = false);
-
-
-//! Updates or inserts a database table from a spatial object set
-/*!
- \param elemSet the set of spatial objects that will be inserted or updated into database
- \param tableName database table name that will be updated
- \param indexes the attribute indexes of the spatial objects that must be updated
-*/
-template<typename elementSet>
-bool TeUpdateDBFromSet (elementSet* elemSet, const string& tableName, vector<int>* indexes = 0);
-
-
-//! Auxiliary function to insert a row
-template<typename Element>
-bool insertRow (Element* elem, TeTable& table, const string& uniqueValue, TeDatabase* db, vector<int>* indexes=0);
-
-//! Auxiliary function to update a row
-template<typename Element>
-bool updateRow (Element* elem, TeTable table, const string& uniqueId, TeDatabase* db, vector<int>* indexes=0);
-
-
-//--------------- Implementation
-
-template<typename elementSet>
-bool TeSTOSetBuildDB(elementSet* stoset, bool loadGeometries, bool loadAllAttributes, vector<string> attrNames)
-{
- if(!stoset->build(loadGeometries, loadAllAttributes, attrNames))
- return false;
- return true;
-}
-
-template<typename elementSet>
-bool TeSTOSetBuildDB(elementSet* stoset, TeGroupingAttr& groupAttr, bool loadGeometries)
-{
- if(!stoset->build(groupAttr, loadGeometries))
- return false;
- return true;
-}
-
-template<typename elementSet>
-bool TeUpdateDBFromSet (elementSet* elemSet, const string& tableName, vector<int>* indexes)
-{
- TeDatabase* db = 0;
- if((elemSet->getTheme()) && (elemSet->theme()->layer()))
- db = elemSet->getTheme()->layer()->database();
- else if(elemSet->getLayer())
- db = elemSet->getLayer()->database();
-
- if(!db)
- return false;
-
- //progress bar
- int step = 0;
- int numSteps = elemSet->numSTInstance();
- if(TeProgress::instance())
- TeProgress::instance()->setTotalSteps(numSteps);
-
- try
- {
- TeAttrTableVector attrTables;
- if(elemSet->getTheme())
- elemSet->getTheme()->getAttTables(attrTables);
- else if(elemSet->getLayer())
- elemSet->getLayer()->getAttrTables(attrTables);
-
- if(attrTables.empty())
- return false;
-
- TeTable table;
- int uniqueIndex = -1;
-
- //! verify if the table is in the stoset
- for(unsigned int i=0; i<attrTables.size(); i++)
- {
- if(attrTables[i].name()==tableName)
- {
- uniqueIndex = i;
- table = attrTables[i];
- break;
- }
- }
-
- if((uniqueIndex==-1) || ((table.tableType()!=TeAttrEvent) &&
- (table.tableType()!=TeAttrStatic) &&
- (table.tableType()!=TeFixedGeomDynAttr) &&
- (table.tableType()!=TeAttrExternal)))
- return false;
-
- // get some information about the attribute table required
- string uniqueIdName = table.uniqueName();
-
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- map<string, string> uniqueIds;
- string sql = "SELECT "+ uniqueIdName +" FROM "+ table.name();
-
- if(!portal->query (sql))
- {
- delete portal;
- return false;
- }
-
- while(portal->fetchRow())
- uniqueIds[string(portal->getData(0))] = string(portal->getData(0));
-
- delete portal;
-
- //verifies if the attribute column exists in the table
- TeAttributeList attList = elemSet->getAttributeList();
- for(unsigned int i=0; i<attList.size(); ++i)
- {
- if(indexes && (find(indexes->begin(), indexes->end(),(int)i) == indexes->end()))
- continue;
-
- //verify if the table has this column
- string attrName = attList[i].rep_.name_;
- size_t pos = attrName.find(".", 0, 1);
- if (pos != string::npos)
- attList[i].rep_.name_ = attrName.substr(pos+1);
-
- if (!db->columnExist(tableName, attList[i].rep_.name_, attList[i]))
- {
- if(!db->addColumn (tableName, attList[i].rep_))
- return false;
-
- TeAttributeList attrListTable = table.attributeList();
- attrListTable.push_back (attList[i]);
- table.setAttributeList(attrListTable);
- }
- }
-
- // Update all the objects
- typename elementSet::iterator itObj = elemSet->begin();
- while (itObj != elemSet->end())
- {
- string uniqueId = (*itObj).getUniqueId(uniqueIndex);
-
- if(uniqueIds.find(uniqueId) == uniqueIds.end())
- {
- if (!insertRow (&(*itObj), table, uniqueId, db, indexes))
- return false;
-
- uniqueIds[uniqueId] = uniqueId;
- }
- else
- {
- if (!updateRow (&(*itObj), table, uniqueId, db, indexes))
- return false;
- }
-
- ++itObj;
-
- if(TeProgress::instance())
- {
- if (TeProgress::instance()->wasCancelled())
- {
- TeProgress::instance()->reset();
- return false;
- }
- else
- TeProgress::instance()->setProgress(step);
- }
- ++step;
- }
- }
- catch(...)
- {
- if (TeProgress::instance())
- TeProgress::instance()->reset();
- return false;
- }
-
- if (TeProgress::instance())
- TeProgress::instance()->reset();
-
- return true;
-}
-
-template<typename Element>
-bool insertRow (Element* elem, TeTable& table, const string& uniqueValue, TeDatabase* db, vector<int>* indexes)
-{
- vector<string> attrs;
- table.attributeNames(attrs);
-
- string ins = " INSERT INTO "+ table.name() +" (";
- string values = " VALUES ( ";
-
- TePropertyVector prop = elem->getPropertyVector();
- int count=0;
-
- for(unsigned int i=0; i<prop.size(); ++i)
- {
- if(indexes && (find(indexes->begin(), indexes->end(),(int)i) == indexes->end()))
- continue;
-
- string attrName = prop[i].attr_.rep_.name_;
- size_t pos = attrName.find(".", 0, 1);
- if (pos != string::npos)
- attrName = attrName.substr(pos+1);
-
- if( (find(attrs.begin(), attrs.end(), attrName)!=attrs.end()) &&
- (TeStringCompare(attrName, table.uniqueName()) == false) &&
- (TeStringCompare(attrName,table.linkName()) == false)&&
- (TeStringCompare(attrName,table.attInitialTime()) == false)&&
- (TeStringCompare(attrName,table.attFinalTime()) == false) )
-
- {
- if((prop[i].attr_.rep_.type_!=TeSTRING) && prop[i].value_.empty())
- continue;
-
- if(count>0)
- {
- ins += ",";
- values += ",";
- }
- ++count;
- ins += attrName;
- if(prop[i].attr_.rep_.type_==TeSTRING)
- values += "'"+ prop[i].value_ +"'";
- else if(prop[i].attr_.rep_.type_==TeREAL)
- {
- std::string strValue = prop[i].value_;
- replace (strValue.begin(), strValue.end(), ',', '.');
- values += strValue;
- }
- else if(prop[i].attr_.rep_.type_==TeDATETIME)
- {
- TeTime time(prop[i].value_, prop[i].attr_.dateChronon_, prop[i].attr_.dateTimeFormat_, prop[i].attr_.dateSeparator_, prop[i].attr_.timeSeparator_);
- values += db->getSQLTime(time);
- }
- else
- values += prop[i].value_;
- }
- }
-
- // -------- object_id, unique_id and timeInterval
-
- if(count>0)
- {
- ins += " ,";
- values += " ,";
- }
-
- ins += table.linkName();
- values += "'"+ elem->objectId() +"'";
-
- if(table.linkName() != table.uniqueName())
- {
- ins += ", "+ table.uniqueName();
- values += ", '"+ uniqueValue +"'";
- }
-
- if(!table.attInitialTime().empty())
- {
- TeTime time (elem->timeInterval().getT1());
- ins += ", "+ table.attInitialTime();
- values += ", "+ db->getSQLTime(time);
- }
-
- if((!table.attFinalTime().empty()) && (table.attInitialTime()!=table.attFinalTime()))
- {
- TeTime time (elem->timeInterval().getT2());
- ins += ", "+ table.attFinalTime();
- values += ", "+ db->getSQLTime(time);
- }
- // ----------
-
- ins += ") "+ values +" )";
-
- if(!db->execute (ins))
- return false;
-
- return true;
-}
-
-template<typename Element>
-bool updateRow (Element* elem, TeTable table, const string& uniqueId, TeDatabase* db, vector<int>* indexes)
-{
-
- vector<string> attrs;
- table.attributeNames(attrs);
-
- string ins = " UPDATE "+ table.name() +" SET ";
-
- TePropertyVector prop = elem->getPropertyVector();
- int count = 0;
- for(unsigned int i=0; i<prop.size(); ++i)
- {
- if(indexes && (find(indexes->begin(), indexes->end(),(int)i) == indexes->end()))
- continue;
-
- string attrName = prop[i].attr_.rep_.name_;
- size_t pos = attrName.find(".", 0, 1);
-
- std::string tableName;
- if (pos != string::npos)
- {
- attrName = attrName.substr(pos+1);
- tableName = attrName.substr(0, pos-1);
- if (tableName != table.name())
- continue;
- }
-
- if( (find(attrs.begin(), attrs.end(), attrName)!=attrs.end()) &&
- (TeStringCompare(attrName,table.uniqueName()) == false) &&
- (TeStringCompare(attrName,table.linkName()) == false) &&
- (TeStringCompare(attrName,table.attInitialTime()) == false) &&
- (TeStringCompare(attrName,table.attFinalTime()) == false) )
- {
-
- if((prop[i].attr_.rep_.type_!=TeSTRING) && (prop[i].value_.empty()))
- continue;
-
- if(count>0)
- ins += ",";
-
- ++count;
- ins += attrName +" = ";
-
- if(prop[i].attr_.rep_.type_==TeSTRING)
- ins += "'"+ prop[i].value_ +"'";
- else if(prop[i].attr_.rep_.type_==TeREAL)
- {
- std::string strValue = prop[i].value_;
- replace (strValue.begin(), strValue.end(), ',', '.');
- ins += strValue;
- }
- else if(prop[i].attr_.rep_.type_==TeDATETIME)
- {
- TeTime time(prop[i].value_, prop[i].attr_.dateChronon_, prop[i].attr_.dateTimeFormat_, prop[i].attr_.dateSeparator_, prop[i].attr_.timeSeparator_);
- ins += db->getSQLTime(time);
- }
- else
- ins += prop[i].value_;
- }
- }
-
- // -------- timeInterval
- if(!table.attInitialTime().empty())
- {
- TeTime time (elem->timeInterval().getT1());
- if(count>0)
- ins += ", ";
- ins += table.attInitialTime() +" = ";
- ins += db->getSQLTime(time);
- ++count;
- }
-
- if((!table.attFinalTime().empty()) && (table.attInitialTime()!=table.attFinalTime()))
- {
- TeTime time (elem->timeInterval().getT2());
- if(count>0)
- ins += ", ";
- ins += table.attFinalTime() +" = ";
- ins += db->getSQLTime(time);
- ++count;
- }
- // ----------
-
- if ( count == 0 )
- return true;
-
- ins += " WHERE "+ table.uniqueName() +" = '"+ uniqueId +"'";
-
- if(!db->execute (ins))
- return false;
-
- return true;
-}
-
-/** \example createSTElementSetFromLayer.cpp
- Shows how to create a new Spatial Temporal Element Set (STElementSet) from a layer
- */
-
-/** \example createSTElementSetFromTheme.cpp
- Shows how to create a new Spatial Temporal Element Set (STElementSet) from a theme
- */
-#endif
-
diff --git a/src/terralib/kernel/TeSTElementSet.cpp b/src/terralib/kernel/TeSTElementSet.cpp
deleted file mode 100644
index 559e571..0000000
--- a/src/terralib/kernel/TeSTElementSet.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include <TeSTElementSet.h>
-#include <TeQuerier.h>
-#include <TeQuerierParams.h>
-
-TeTimeInterval
-TeSTElementSet::totalTime()
-{
- return TeTimeInterval(this->getMinTime().getT1(),this->getMaxTime().getT2());
-}
-
-void
-TeSTElementSet::totalTime(TeTimeInterval t)
-{
- minTime_ = TeTimeInterval(t.getT1(), t.getT1());
- maxTime_ = TeTimeInterval(t.getT2(), t.getT2());
-}
-
-
-bool
-TeSTElementSet::hasElement(const string& objId)
-{
- return (numSTInstance(objId)>0);
-}
-
-bool
-TeSTElementSet::setGeometry(const string& object_id, const TePolygonSet& geomSet, TeTimeInterval time)
-{
- vector<TeSTInstance*> result;
- this->getSTInstances(result, object_id, time);
- vector<TeSTInstance*>::iterator it = result.begin();
-
- while(it!=result.end())
- {
- (*it)->setGeometry(geomSet);
- ++it;
- }
- return true;
-}
-
-bool
-TeSTElementSet::setGeometry(const string& object_id, const TeLineSet& geomSet, TeTimeInterval time)
-{
- vector<TeSTInstance*> result;
- this->getSTInstances(result, object_id, time);
- vector<TeSTInstance*>::iterator it = result.begin();
-
- while(it!=result.end())
- {
- (*it)->setGeometry(geomSet);
- ++it;
- }
- return true;
-}
-
-bool
-TeSTElementSet::setGeometry(const string& object_id, const TePointSet& geomSet, TeTimeInterval time)
-{
- vector<TeSTInstance*> result;
- this->getSTInstances(result, object_id, time);
- vector<TeSTInstance*>::iterator it = result.begin();
-
- while(it!=result.end())
- {
- (*it)->setGeometry(geomSet);
- ++it;
- }
- return true;
-}
-
-bool
-TeSTElementSet::setGeometry(const string& object_id, const TeCellSet& geomSet, TeTimeInterval time)
-{
- vector<TeSTInstance*> result;
- this->getSTInstances(result, object_id, time);
- vector<TeSTInstance*>::iterator it = result.begin();
-
- while(it!=result.end())
- {
- (*it)->setGeometry(geomSet);
- ++it;
- }
- return true;
-}
-
-bool
-TeSTElementSet::setGeometry(const string& object_id, const TeTextSet& geomSet, TeTimeInterval time)
-{
- vector<TeSTInstance*> result;
- this->getSTInstances(result, object_id, time);
- vector<TeSTInstance*>::iterator it = result.begin();
-
- while(it!=result.end())
- {
- (*it)->setGeometry(geomSet);
- ++it;
- }
- return true;
-}
-
-
-bool
-TeSTElementSet::getGeometry(const string& object_id, TePolygonSet& geomSet, TeTimeInterval time)
-{
- TeSTInstance* result = this->getSTInstance(object_id, time);
- if(!result)
- return false;
- geomSet = result->getPolygons();
- return true;
-}
-
-
-bool
-TeSTElementSet::getGeometry(const string& object_id, TeLineSet& geomSet, TeTimeInterval time)
-{
- TeSTInstance* result = this->getSTInstance(object_id, time);
- if(!result)
- return false;
- geomSet = result->getLines();
- return true;
-}
-
-
-bool
-TeSTElementSet::getGeometry(const string& object_id, TePointSet& geomSet, TeTimeInterval time)
-{
- TeSTInstance* result = this->getSTInstance(object_id, time);
- if(!result)
- return false;
- geomSet = result->getPoints();
- return true;
-}
-
-
-bool
-TeSTElementSet::getGeometry(const string& object_id, TeCellSet& geomSet, TeTimeInterval time)
-{
- TeSTInstance* result = this->getSTInstance(object_id, time);
- if(!result)
- return false;
- geomSet = result->getCells();
- return true;
-}
-
-bool
-TeSTElementSet::getGeometry(const string& object_id, TeTextSet& geomSet, TeTimeInterval time)
-{
- TeSTInstance* result = this->getSTInstance(object_id, time);
- if(!result)
- return false;
- geomSet = result->getTexts();
- return true;
-}
-
-bool
-TeSTElementSet::buildImpl(TeQuerier* querier, const int& slide)
-{
- int dt = CLOCKS_PER_SEC/4, steps = 0;
- int dt2 = CLOCKS_PER_SEC * 5;
- clock_t t0, t1, t2;
-
- t0=t1=t2=clock();
-
- if(!querier)
- return false;
-
- if(!querier->loadInstances(slide))
- return false;
-
- //clear all structures
- attrList_->clear();
- instances_.clear();
- objectIdToInstances_.clear();
- timeToInstances_.clear();
- sliceToInstances_.clear();
- if(rTree_)
- delete rTree_;
- rTree_ = 0;
-
- //Builts another rTree
- TeBox b;
- if(theme_)
- b = theme_->box();
- else if(layer_)
- b = layer_->box();
- else
- b = this->box_;
- rTree_ = new TeSAM::TeRTree<int>(b);
-
- TeAttributeList l = querier->getAttrList();
- setAttributeList(l);
-
- int tot = querier->numElemInstances();
-
- if(TeProgress::instance())
- {
- TeProgress::instance()->reset();
- string caption = "Building data";
- TeProgress::instance()->setCaption(caption.c_str());
- string msg = "Building in progress. Please, wait!";
- TeProgress::instance()->setMessage(msg);
- TeProgress::instance()->setTotalSteps(tot);
- t2 = clock();
- t0 = t1 = t2;
- }
-
- TeSTInstance obj;
- while(querier->fetchInstance(obj))
- {
- this->insertSTInstance(obj);
-
- obj.clear();
- if(TeProgress::instance())
- {
- steps++;
- t2 = clock();
- if (int(t2-t1) > dt)
- {
- t1 = t2;
- if(TeProgress::instance()->wasCancelled())
- return false;
-
- if((int)(t2-t0) > dt2)
- TeProgress::instance()->setProgress(steps);
- }
- }
- }
- if(TeProgress::instance())
- TeProgress::instance()->reset();
-
- return true;
-}
-
-
diff --git a/src/terralib/kernel/TeSTElementSet.h b/src/terralib/kernel/TeSTElementSet.h
deleted file mode 100644
index ecb9ec9..0000000
--- a/src/terralib/kernel/TeSTElementSet.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeSTElementSet.h
- \brief This file contains structures to deal with a set of spatio-temporal
- instances. These instances can belong to a specific layer or theme.
-*/
-
-#ifndef __TERRALIB_INTERNAL_STELEMENTSET_H
-#define __TERRALIB_INTERNAL_STELEMENTSET_H
-
-#include "TeBaseSTInstanceSet.h"
-#include "TeSTInstance.h"
-#include "TeTimeInterval.h"
-#include "TeMultiGeometry.h"
-
-class TeQuerier;
-class TeTheme;
-class TeLayer;
-
-
-/*! \class TeSTElementSet
- \brief A class that represents a set of spatial temporal instances.
-
- This class specializes the abstract class TeBaseSTInstanceSet representing
- each spatial temporal instance of the set as a TeSTInstance type. That is, the
- geometries of each instance in this set is represented as multi geometries
- (TeMultiGeometry class)and its valid time as a time interval (TeTimeInterval class).
-
- \sa TeBaseSTInstanceSet TeSTInstance TeMultiGeometry TeTimeInterval TeTheme TeLayer
-*/
-class TL_DLL TeSTElementSet : public TeBaseSTInstanceSet<TeMultiGeometry, TeTimeInterval, TeSTInstance>
-{
-protected:
-
- //! Builds the set using a given querier and a specific slice
- bool buildImpl(TeQuerier* querier, const int& slide = -1);
-
-public:
- //! Constructor
- TeSTElementSet() : TeBaseSTInstanceSet<TeMultiGeometry, TeTimeInterval, TeSTInstance>()
- { }
-
- //! Constructor
- TeSTElementSet(TeTheme* theme, TeAttributeList attList = TeAttributeList()) :
- TeBaseSTInstanceSet<TeMultiGeometry, TeTimeInterval, TeSTInstance>(theme, attList)
- { }
-
- //! Constructor
- TeSTElementSet(TeLayer* layer, TeAttributeList attList = TeAttributeList()) :
- TeBaseSTInstanceSet<TeMultiGeometry, TeTimeInterval, TeSTInstance>(layer, attList)
- { }
-
-
- //! Constructor
- TeSTElementSet(const TeBox& box, const TeAttributeList& attrList) :
- TeBaseSTInstanceSet<TeMultiGeometry, TeTimeInterval, TeSTInstance>(box, attrList)
- { }
-
-
- //! Returns the valid time interval for all ST instances
- TeTimeInterval totalTime();
-
- //! Sets the valid time interval for all ST instances
- void totalTime(TeTimeInterval t);
-
- //! Deprecated: Verifies if there is a specific element or object in the set
- bool hasElement(const string& objId);
-
- //! Sets a polygon set and its valid time interval to a specific object or element
- bool setGeometry(const string& object_id, const TePolygonSet& geomSet, TeTimeInterval time = TeTimeInterval());
- //! Sets a line set and its valid time interval to a specific object or element
- bool setGeometry(const string& object_id, const TeLineSet& geomSet, TeTimeInterval time = TeTimeInterval());
- //! Sets a point set and its valid time interval to a specific object or element
- bool setGeometry(const string& object_id, const TePointSet& geomSet, TeTimeInterval time = TeTimeInterval());
- //! Sets a cell set and its valid time interval to a specific object or element
- bool setGeometry(const string& object_id, const TeCellSet& geomSet, TeTimeInterval time = TeTimeInterval());
- //! Sets a text set and its valid time interval to a specific object or element
- bool setGeometry(const string& object_id, const TeTextSet& geomSet, TeTimeInterval time = TeTimeInterval());
-
- //! Gets a polygon set of an element or object and its valid time interval
- bool getGeometry(const string& object_id, TePolygonSet& geomSet, TeTimeInterval time = TeTimeInterval());
- //! Gets a line set of an element or object and its valid time interval
- bool getGeometry(const string& object_id, TeLineSet& geomSet, TeTimeInterval time = TeTimeInterval());
- //! Gets a point set of an element or object and its valid time interval
- bool getGeometry(const string& object_id, TePointSet& geomSet, TeTimeInterval time = TeTimeInterval());
- //! Gets a cell set of an element or object and its valid time interval
- bool getGeometry(const string& object_id, TeCellSet& geomSet, TeTimeInterval time = TeTimeInterval());
- //! Gets a text set of an element or object and its valid time interval
- bool getGeometry(const string& object_id, TeTextSet& geomSet, TeTimeInterval time = TeTimeInterval());
-};
-
-
-/*! \example createSTElementSetFromLayer.cpp
- Shows how to create a spatio-temporal element set from a layer.
- */
-
-/*! \example createSTElementSetFromShapeFile.cpp
- Shows how to create aspatio-temporal element set from a shapefile.
- */
-
-/*! \example createSTElementSetFromTheme.cpp
- Shows how to create aspatio-temporal element set from a theme.
- */
-#endif
-
diff --git a/src/terralib/kernel/TeSTEvent.cpp b/src/terralib/kernel/TeSTEvent.cpp
deleted file mode 100644
index 4d445ca..0000000
--- a/src/terralib/kernel/TeSTEvent.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeSTEvent.h"
-
-///------------ TeSTEvent
-void
-TeSTEvent::clear()
-{
- TeBaseSTInstance<TePoint, long>::clear();
- geometries_ = TePoint();
- time_ = -1;
-}
-
-bool
-TeSTEvent::isTimeValid()
-{
- return (time_>=0);
-}
-
-///------------ TeSTEventSet
-
-TeSTEventSet::TeSTEventSet(TeTheme* theme, const TeAttributeList& attrList) :
- TeBaseSTInstanceSet<TePoint, long, TeSTEvent>(theme, attrList)
-{
- kdTree_ = 0;
-}
-
-TeSTEventSet::~TeSTEventSet()
-{
- if(kdTree_)
- delete kdTree_;
- kdTree_ = 0;
-}
-
-bool TeSTEventSet::buildKdTree(const int& n)
-{
- if(!theme_)
- return false;
- if(kdTree_)
- delete kdTree_;
-
- vector< std::pair<TeCoord2D, TePoint> > dataSetAux; //auxiliary structure for kdTree
- TeSTEventSet::iterator it = this->begin();
- int index=0;
- while(it!=this->end())
- {
- TePoint point = it->getGeometries();
- point.geomId(index);
- dataSetAux.push_back(pair<TeCoord2D, TePoint>(point.location(), point));
- ++it;
- ++index;
- }
-
- int bucketSize;
- if(n<0)
- bucketSize= 30;
- else
- bucketSize= 2*n;
- kdTree_ = new kdTree(theme_->box(), bucketSize);
- kdTree_->build(dataSetAux);
- return true;
-}
-
-bool TeSTEventSet::search(const TeBox& b, vector<TeSTEvent* >& result)
-{
- if(!kdTree_)
- return false;
-
- vector<kdNode*> nodes;
- kdTree_->search(b, nodes);
- for(unsigned int i=0; i<nodes.size(); ++i)
- {
- for(unsigned int j=0; j<nodes[i]->getData().size(); ++j) //vector<TePoint>
- {
- int index = ((nodes[i]->getData())[j]).geomId();
- TeSTEvent* ev = dynamic_cast<TeSTEvent*> (this->getSTInstance(index));
- result.push_back(ev);
- }
- }
- return true;
-}
-
-bool TeSTEventSet::nearestNeighbourSearch(const TeCoord2D& coord, vector<TeSTEvent* >& result,
- vector<double>& distances, const unsigned int& k)
-{
- vector<TePoint> res;
- for(unsigned int n=0; n<k; ++n)
- res.push_back (TePoint(TeMAXFLOAT,TeMAXFLOAT));
- kdTree_->nearestNeighborSearch(coord, res, distances, k);
- for(unsigned int j=0; j<res.size(); ++j)
- result.push_back(dynamic_cast<TeSTEvent*>(getSTInstance(res[j].geomId())));
- return true;
-}
-
-void TeSTEventSet::clear()
-{
- TeBaseSTInstanceSet<TePoint, long, TeSTEvent>::clear();
- if(kdTree_)
- delete kdTree_;
- kdTree_ = 0;
-}
-
-bool
-TeSTEventSet::buildImpl(TeQuerier* querier, const int& slide)
-{
- int dt = CLOCKS_PER_SEC/4, steps = 0;
- int dt2 = CLOCKS_PER_SEC * 5;
- clock_t t0, t1, t2;
-
- t0=t1=t2=clock();
-
- if(!querier)
- return false;
-
- if(!querier->loadInstances(slide))
- return false;
-
- //clear all structures
- attrList_->clear();
- instances_.clear();
- objectIdToInstances_.clear();
- timeToInstances_.clear();
- sliceToInstances_.clear();
- if(rTree_)
- delete rTree_;
- rTree_ = 0;
- kdTree_->clear();
-
- //Builts another rTree
- TeBox b;
- if(theme_)
- b = theme_->box();
- else if(layer_)
- b = layer_->box();
- else
- b = this->box_;
- rTree_ = new TeSAM::TeRTree<int>(b);
-
- TeAttributeList l = querier->getAttrList();
- setAttributeList(l);
-
- int tot = querier->numElemInstances();
- if(TeProgress::instance())
- {
- string caption = "Building data";
- TeProgress::instance()->setCaption(caption.c_str());
- string msg = "Building in progress. Please, wait!";
- TeProgress::instance()->setMessage(msg);
- TeProgress::instance()->setTotalSteps(tot);
- t2 = clock();
- t0 = t1 = t2;
- }
-
- TeSTInstance obj;
- while(querier->fetchInstance(obj))
- {
- TeCoord2D p;
- obj.centroid(p);
-
- TeSTEvent event(obj.getObjectId(), TePoint(p), obj.getProperties(), 0, -1);
- this->insertSTInstance(event);
-
- if(TeProgress::instance())
- {
- steps++;
- t2 = clock();
- if (int(t2-t1) > dt)
- {
- t1 = t2;
- if(TeProgress::instance()->wasCancelled())
- return false;
-
- if((int)(t2-t0) > dt2)
- TeProgress::instance()->setProgress(steps);
- }
- }
- }
- if(TeProgress::instance())
- TeProgress::instance()->reset();
-
- return true;
-}
-
-
-
-
diff --git a/src/terralib/kernel/TeSTEvent.h b/src/terralib/kernel/TeSTEvent.h
deleted file mode 100644
index 52b1dbe..0000000
--- a/src/terralib/kernel/TeSTEvent.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeSTEvent.h
- \brief This file contains structures and definitions to deal with spatial
- temporal events.
-*/
-
-#ifndef __TERRALIB_INTERNAL_STEVENT_H
-#define __TERRALIB_INTERNAL_STEVENT_H
-
-#include "TeBaseSTInstance.h"
-#include "TeBaseSTInstanceSet.h"
-#include "TeGeometry.h"
-#include "TeKdTree.h"
-
-
-/*! \class TeSTEvent
- \brief A class that represents spatial temporal events (STEvent).
-
- A spatial temporal event is represented by a location (point),
- a time when it happened and a set of attributes. This class
- specializes the base class TeBaseSTInstance representing the geometries
- as points (TePoint) and the valid time as a integer (long).
-
- \sa TeBaseSTInstance TePoint
-*/
-class TL_DLL TeSTEvent : public TeBaseSTInstance<TePoint, long>
-{
-public:
-
- //! Empty constructor
- TeSTEvent() : TeBaseSTInstance<TePoint, long>()
- { }
-
- //! Constructor
- TeSTEvent(const string& objId, const TePoint& point, const long& time) :
- TeBaseSTInstance<TePoint, long>(objId, point, time)
- { }
-
- //! Constructor
- TeSTEvent(const string& objId, const TePoint& point, const vector<string>& attrValues,
- TeAttributeList* attList, const long& time) :
- TeBaseSTInstance<TePoint, long>(objId, attrValues, attList, point, -1, time)
- { }
-
- //! Clear
- virtual void clear();
-
- //! Verifies if the time associated to this event is valid
- virtual bool isTimeValid();
-
- //! Deprecated: Gets the event location (point)
- void getGeometry(TePoint& result)
- { result = this->geometries(); }
-
- //! Deprecated: Returns the valid time
- virtual TeTimeInterval timeInterval ()
- { TeTimeInterval t; return t; }
-};
-
-
-/*! \class TeSTEventSet
- \brief A class that represents a set of spatial temporal events.
-
- This class specializes the abstract class TeBaseSTInstanceSet representing
- each spatial temporal instance of the set as a TeSTEvent type. That is, the
- geometries of each instance or event in this set is represented as a point
- (TePoint class)and its valid time as a simple number (long type).
-
- \sa TeBaseSTInstanceSet TeSTEvent TePoint TeTheme TeLayer
-*/
-class TL_DLL TeSTEventSet : public TeBaseSTInstanceSet<TePoint, long, TeSTEvent>
-{
-protected:
-
- typedef TeSAM::TeAdaptativeKdTreeNode<TeCoord2D, vector<TePoint>, TePoint> kdNode;
- typedef TeSAM::TeAdaptativeKdTree<kdNode> kdTree;
-
- //! Index structure (KD Tree) to index the point locations
- kdTree* kdTree_;
-
- //! Build the set using querier
- bool buildImpl(TeQuerier* querier, const int& slide = -1);
-
-public:
- //! Constructor
- TeSTEventSet(TeTheme* theme=0, const TeAttributeList& attrList = TeAttributeList());
-
- //! Destructor
- ~TeSTEventSet();
-
- //! Build a index structure (kdTree) over all event points in this set
- virtual bool buildKdTree(const int& n);
-
- //! Searchs the event points inside a specific bounding box
- virtual bool search(const TeBox& b, vector<TeSTEvent* >& result);
-
- //! Searchs the k-nearest neighbours of a specific coordinate
- virtual bool nearestNeighbourSearch(const TeCoord2D& coord, vector<TeSTEvent* >& result, vector<double>& distances, const unsigned int& k);
-
- //! Clears the event set
- virtual void clear();
-};
-
-#endif
-
-
-
-
-
-
-
diff --git a/src/terralib/kernel/TeSTInstance.cpp b/src/terralib/kernel/TeSTInstance.cpp
deleted file mode 100644
index 172ebeb..0000000
--- a/src/terralib/kernel/TeSTInstance.cpp
+++ /dev/null
@@ -1,353 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-
-#include <TeSTInstance.h>
-
-
-TeSTInstance::TeSTInstance (const string& object_id, TeProperty& prop) :
- TeBaseSTInstance<TeMultiGeometry, TeTimeInterval>()
-{
- object_id_ = object_id;
- properties_.push_back(prop.value_);
-}
-
-void
-TeSTInstance::clear()
-{
- TeBaseSTInstance<TeMultiGeometry, TeTimeInterval>::clear();
- geometries_.clear();
- time_ = TeTimeInterval();
-}
-
-
-bool
-TeSTInstance::isTimeValid()
-{
- return (this->time_.isValid());
-}
-
-bool
-TeSTInstance::hasPolygons()
-{
- return (geometries_.hasPolygons());
-}
-
-bool
-TeSTInstance::hasLines()
-{
- return (geometries_.hasLines());
-}
-
-bool
-TeSTInstance::hasPoints()
-{
- return (geometries_.hasPoints());
-}
-
-bool
-TeSTInstance::hasCells()
-{
- return (geometries_.hasCells());
-}
-
-bool
-TeSTInstance::hasTexts()
-{
- return (geometries_.hasTexts());
-}
-
-bool
-TeSTInstance::getGeometry(TePolygonSet& result)
-{
- if(geometries_.getGeometry(result))
- return true;
- return false;
-}
-
-bool
-TeSTInstance::getGeometry(TeLineSet& result)
-{
- if(geometries_.getGeometry(result))
- return true;
- return false;
-}
-
-bool
-TeSTInstance::getGeometry(TePointSet& result)
-{
- if(geometries_.getGeometry(result))
- return true;
- return false;
-}
-
-bool
-TeSTInstance::getGeometry(TeCellSet& result)
-{
- if(geometries_.getGeometry(result))
- return true;
- return false;
-}
-
-bool
-TeSTInstance::getGeometry(TeTextSet& result)
-{
- if(geometries_.getGeometry(result))
- return true;
- return false;
-}
-
-bool
-TeSTInstance::getGeometry(vector<TeGeometry*>& result)
-{
- if(geometries_.getGeometry(result))
- return true;
- return false;
-}
-
-bool
-TeSTInstance::getGeometry(TeMultiGeometry& result)
-{
- if(!geometries_.empty())
- {
- result = geometries_;
- return true;
- }
-
- geometries_.getGeometry (result.polygons_);
- geometries_.getGeometry (result.lines_);
- geometries_.getGeometry (result.points_);
- geometries_.getGeometry (result.cells_);
-
- return (!result.empty());
-}
-
-TePolygonSet&
-TeSTInstance::getPolygons()
-{
- return geometries_.getPolygons();
-}
-
-TeLineSet&
-TeSTInstance::getLines()
-{
- return geometries_.getLines();
-}
-
-TePointSet&
-TeSTInstance::getPoints()
-{
- return geometries_.getPoints();
-}
-
-TeCellSet&
-TeSTInstance::getCells()
-{
- return geometries_.getCells();
-}
-
-TeTextSet&
-TeSTInstance::getTexts()
-{
- return geometries_.getTexts();
-}
-
-void
-TeSTInstance::setGeometry(const TePolygonSet& result)
-{
- geometries_.setGeometry(result);
-}
-
-void
-TeSTInstance::setGeometry(const TeLineSet& result)
-{
- geometries_.setGeometry(result);
-}
-
-void
-TeSTInstance::setGeometry(const TePointSet& result)
-{
- geometries_.setGeometry(result);
-}
-
-void
-TeSTInstance::setGeometry(const TeCellSet& result)
-{
- geometries_.setGeometry(result);
-}
-
-void
-TeSTInstance::setGeometry(const TeTextSet& result)
-{
- geometries_.setGeometry(result);
-}
-
-void
-TeSTInstance::setGeometry(const TeMultiGeometry& result)
-{
- geometries_ = result;
-}
-
-bool
-TeSTInstance::addGeometry(const TePolygon& poly)
-{
- if(poly.objectId() == objectId())
- {
- geometries_.addGeometry (poly);
- return true;
- }
- return false;
-}
-
-bool
-TeSTInstance::addGeometry(const TeLine2D& line)
-{
- if(line.objectId() == objectId())
- {
- geometries_.addGeometry (line);
- return true;
- }
- return false;
-}
-
-bool
-TeSTInstance::addGeometry(const TePoint& point)
-{
- if(point.objectId() == objectId())
- {
- geometries_.addGeometry (point);
- return true;
- }
- return false;
-}
-
-bool
-TeSTInstance::addGeometry(const TeCell& cell)
-{
- if(cell.objectId() == objectId())
- {
- geometries_.addGeometry (cell);
- return true;
- }
- return false;
-}
-
-bool
-TeSTInstance::addGeometry(const TeText& text)
-{
- if(text.objectId() == objectId())
- {
- geometries_.addGeometry (text);
- return true;
- }
- return false;
-}
-
-void
-TeSTInstance::centroid(TeCoord2D& centroid, TeGeomRep geomRep)
-{
- if(geomRep==TePOLYGONS)
- {
- TePolygonSet pols;
- if(getGeometry(pols))
- {
- centroid = TeFindCentroid(pols);
- return;
- }
- }
- if(geomRep==TeLINES)
- {
- TeLineSet lins;
- if(getGeometry(lins))
- {
- centroid = TeFindCentroid(lins);
- return;
- }
- }
- if(geomRep==TePOINTS)
- {
- TePointSet points;
- if(getGeometry(points))
- {
- centroid = TeFindCentroid(points);
- return;
- }
- }
- if(geomRep==TeCELLS)
- {
- TeCellSet cells;
- if(getGeometry(cells))
- {
- centroid = TeFindCentroid(cells);
- return;
- }
- }
- if(geomRep==TeGEOMETRYNONE)
- {
- if(hasPolygons())
- this->centroid(centroid, TePOLYGONS);
- else if(hasLines())
- this->centroid(centroid, TeLINES);
- else if (hasPoints())
- this->centroid(centroid, TePOINTS);
- else if (hasCells())
- this->centroid(centroid, TeCELLS);
- }
-
- return;
-}
-
-void
-TeSTInstance::area(double& a, TeGeomRep geomRep)
-{
- a = 0.;
- if(geomRep==TePOLYGONS)
- {
- TePolygonSet pols;
- if(getGeometry(pols))
- {
- a = TeGeometryArea(pols);
- return;
- }
- }
- if(geomRep==TeCELLS)
- {
- TeCellSet cells;
- if(getGeometry(cells))
- {
- a = TeGeometryArea(cells);
- return;
- }
- }
- if(geomRep==TeGEOMETRYNONE)
- {
- if(hasPolygons())
- this->area(a, TePOLYGONS);
- else if (hasCells())
- this->area(a, TeCELLS);
- }
-
- return;
-}
-
-
diff --git a/src/terralib/kernel/TeSTInstance.h b/src/terralib/kernel/TeSTInstance.h
deleted file mode 100644
index bd6490a..0000000
--- a/src/terralib/kernel/TeSTInstance.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeSTInstance.h
- \brief This file contains a class called TeSTInstance that represents
- an instance in time of a geographical object or element.
-*/
-
-#ifndef __TERRALIB_INTERNAL_STINSTANCE_H
-#define __TERRALIB_INTERNAL_STINSTANCE_H
-
-#include "TeTimeInterval.h"
-#include "TeMultiGeometry.h"
-#include "TeBaseSTInstance.h"
-
-#include <string>
-#include <map>
-#include <vector>
-using namespace std;
-
-/*! \class TeSTInstance
- \brief A class that represents an instance in a time of a spatial object.
-
- A spatio-temporal instance (STInstance) is composite of an attribute set and geometries
- of a spatial element or object that are valid in a specific time. This class
- specializes the base class TeBaseSTInstance representing the geometries
- as multigeometries (TeMultiGeometry) and the valid time as a time interval (TeTimeInterval).
-
- \sa TeBaseSTInstance TeMultiGeometry TeTimeInterval
-
-*/
-class TL_DLL TeSTInstance : public TeBaseSTInstance<TeMultiGeometry, TeTimeInterval>
-{
-public:
-
- //! Constructor
- TeSTInstance() :
- TeBaseSTInstance<TeMultiGeometry, TeTimeInterval>()
- { }
-
- //! Deprecated: Constructor
- TeSTInstance (const string& object_id, TeProperty& prop);
-
- //! Constructor
- TeSTInstance (const string& object_id, vector<string>& prop, TeAttributeList* attList = 0, const int& s = -1) :
- TeBaseSTInstance<TeMultiGeometry, TeTimeInterval>(object_id, prop, attList, s)
- { }
-
- //! Constructor
- TeSTInstance (const string& object_id, const TeMultiGeometry& geometries,
- const TeTimeInterval& time, const int& s = -1) :
- TeBaseSTInstance<TeMultiGeometry, TeTimeInterval>(object_id, geometries, time, s)
- { }
-
- //! Constructor
- TeSTInstance (const string& object_id, vector<string>& prop, TeAttributeList* attList,
- TeMultiGeometry& geometries, int& slice, TeTimeInterval& time ) :
- TeBaseSTInstance<TeMultiGeometry, TeTimeInterval>(object_id, prop, attList, geometries, slice, time)
- { }
-
- //! Clear
- virtual void clear();
-
- //! Verifies if the its time is valid
- virtual bool isTimeValid();
-
- //! Deprecated: Verifies if the instance has polygons
- bool hasPolygons();
- //! Deprecated: Verifies if the instance has lines
- bool hasLines();
- //! Deprecated: Verifies if the instance has points
- bool hasPoints();
- //! Deprecated: Verifies if the instance has cells
- bool hasCells();
- //! Deprecated: Return true if this has texts
- bool hasTexts();
-
- //! Deprecated: Gets a copy of the ST instance polygon set
- bool getGeometry(TePolygonSet& result);
- //! Deprecated: Gets a copy of the ST instance line set
- bool getGeometry(TeLineSet& result);
- //! Deprecated: Gets a copy of the ST instance point set
- bool getGeometry(TePointSet& result);
- //! Deprecated: Gets a copy of the ST instance cell set
- bool getGeometry(TeCellSet& result);
- //! Deprecated: Gets a copy of the ST instance text set
- bool getGeometry(TeTextSet& result);
- //! Deprecated: Gets a copy of the ST instance geometry vector
- bool getGeometry(vector<TeGeometry*>& result);
- //! Deprecated: Gets a copy of the ST instance multi geometry
- bool getGeometry(TeMultiGeometry& result);
-
- //! Deprecated: Get a reference to the ST instance polygon geometry
- TePolygonSet& getPolygons();
- //! Deprecated: Get a reference to the ST instance line geometry
- TeLineSet& getLines();
- //! Deprecated: Get a reference to the ST instance point geometry
- TePointSet& getPoints();
- //! Deprecated: Get a reference to the ST instance cell geometry
- TeCellSet& getCells();
- //! Deprecated: Get a reference to the ST instance text geometry
- TeTextSet& getTexts();
-
- //! Deprecated: Sets a polygon set to the instance
- void setGeometry(const TePolygonSet& result);
- //! Deprecated: Sets a line set to the instance
- void setGeometry(const TeLineSet& result);
- //! Deprecated: Sets a point set to the instance
- void setGeometry(const TePointSet& result);
- //! Deprecated: Sets a cell set to the instance
- void setGeometry(const TeCellSet& result);
- //! Deprecated: Sets a text set to the instance
- void setGeometry(const TeTextSet& result);
- //! Deprecated: Sets a text set to the instance
- void setGeometry(const TeMultiGeometry& result);
-
- //! Deprecated: Adds a polygon to the instance
- bool addGeometry(const TePolygon& poly);
- //! Deprecated: Adds a line to the instance
- bool addGeometry(const TeLine2D& line);
- //! Deprecated: Adds a point to the instance
- bool addGeometry(const TePoint& point);
- //! Deprecated: Adds a cell to the instance
- bool addGeometry(const TeCell& cell);
- //! Deprecated: Adds a text to the instance
- bool addGeometry(const TeText& cell);
-
- //! Returns a centroid of a geometry representation
- virtual void centroid(TeCoord2D& centroid, TeGeomRep geomRep=TeGEOMETRYNONE);
-
- //! Returns an area of a geometry representation
- virtual void area(double& a, TeGeomRep geomRep=TeGEOMETRYNONE);
-
- //! Deprecated: Returns the valid time
- virtual TeTimeInterval timeInterval ()
- { return getTime(); }
-
- //! Deprecated: Sets the valid time interval
- virtual void timeInterval (const TeTimeInterval& t)
- { setTime(t); }
-
- //! Returns the initial time (as a string) of the valid time interval
- virtual string getInitialDateTime(const string& mask="YYYYsMMsDDsHHsmmsSS")
- { return time_.getInitialDateTime(mask); }
-
- //! Returns the final time (as a string) of the valid time interval
- virtual string getFinalDateTime(const string& mask="YYYYsMMsDDsHHsmmsSS")
- { return time_.getFinalDateTime(mask); }
-
-};
-
-//! A spatial temporal element or object (TeSTElement) is composite of a set of spatial temporal instances related to it.
-typedef vector<TeSTInstance> TeSTElement;
-
-#endif
diff --git a/src/terralib/kernel/TeSharedPtr.h b/src/terralib/kernel/TeSharedPtr.h
deleted file mode 100644
index 8603644..0000000
--- a/src/terralib/kernel/TeSharedPtr.h
+++ /dev/null
@@ -1,435 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeSharedPtr.h
- \brief This file contains a class to deal with automatic dynamic memory allocation / desallocationn
-*/
-#ifndef TESHAREDPTR_H
- #define TESHAREDPTR_H
-
- #include "TeMutex.h"
- #include "TeAgnostic.h"
-
- /**
- * @brief This is the class to deal with automatic dynamic memory
- * allocation / desallocation.
- * @note This is a thread-safe class.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup Utils
- */
- template< class T >
- class TeSharedPtr {
- public :
- /**
- * @brief Default Constructor( Shared ).
- *
- * @param pointer A pointer the the active object.
- */
- explicit TeSharedPtr( T* pointer = 0 );
-
- /**
- * @brief Alternative Constructor.
- *
- * @param external External object reference.
- * @param not_shared_flag A flag indication for a static
- * assignment ( the pointed object will not be deleted at the
- * this object destruction ).
- */
- TeSharedPtr( const TeSharedPtr< T >& external );
-
- /**
- * @brief Alternative Constructor.
- *
- * @param pointer A pointer the the active object.
- * @param not_shared_flag A flag indication for a static
- * assignment ( the pointed object will not be deleted at the
- * this object destruction ).
- */
- explicit TeSharedPtr( T* pointer, bool not_shared_flag );
-
- /**
- * @brief Default Destructor
- */
- ~TeSharedPtr();
-
- /**
- * @brief Verifies if the current pointer points to an active object.
- *
- * @return true if active, false if not.
- */
- inline bool isActive() const;
-
- /**
- * @brief Verifies if the current pointer is shared.
- *
- * @return true if shared, false if not.
- */
- inline bool isShared() const;
-
- /**
- * @brief Reset the active instance the the new pointer.
- *
- * @param pointer A pointer the the active object.
- * @param not_shared_flag A flag indication for a static
- * assignment ( the pointed object will not be deleted at the
- * this object destruction ).
- */
- void reset( T* pointer = 0, bool not_shared_flag = false );
-
- /**
- * @brief Operator = overload.
- *
- * @param external External instance reference.
- * @return A reference to the current pointer.
- */
- TeSharedPtr< T >& operator=( const TeSharedPtr< T >& external );
-
- /**
- * @brief Operator * overload.
- *
- * @return The internal instance reference.
- */
- inline T& operator*() const;
-
- /**
- * @brief Operator -> overload.
- *
- * @return The internal instance pointer.
- */
- inline T* operator->() const;
-
- /**
- * @brief Operator == overload.
- *
- * @param external The external instance reference.
- * @return true if the current pointer and the external pointer
- * are pointing to the same object.
- */
- inline bool operator==( const TeSharedPtr< T >& external ) const;
-
- /**
- * @brief Operator< overload.
- *
- * @param external The external instance reference.
- * @return true if the current pointer pointed address has a lower value
- * then the external shared pointer pointed address.
- */
- inline bool operator<( const TeSharedPtr< T >& external ) const;
-
-
- /**
- * @brief Operator> overload.
- *
- * @param external The external instance reference.
- * @return true if the current pointer pointed address has a lower value
- * then the external shared pointer pointed address.
- */
- inline bool operator>( const TeSharedPtr< T >& external ) const;
-
-
- /**
- * @brief Operator != overload.
- *
- * @param external The external instance reference.
- * @return true if the current pointer and the external pointer
- * are not pointing to the same object.
- */
- inline bool operator!=( const TeSharedPtr< T >& external ) const;
-
- /**
- * @brief A Naked Pointer to the encapsulated object.
- *
- * @return The internal instance pointer.
- */
- inline T* nakedPointer() const;
-
- /**
- * @brief Builds a non-shared pointer copy from the current instance.
- *
- * @return The non-shared pointer copy.
- */
- TeSharedPtr< T > getNonSharedCopy() const;
-
- /**
- * @brief The number of current references to the pointed object.
- *
- * @return The number of current references to the pointed object.
- */
- unsigned long int getRefCount() const;
-
- protected :
-
- /**
- * @brief This instance locking mutex.
- */
- mutable TeMutex this_lock_instance_;
-
- /**
- * @brief A pointer to the shared counter locking mutex.
- */
- mutable TeMutex* counter_lock_instance_ptr_;
-
- /**
- * @brief A pointer to the current number of active users of this pointer.
- */
- mutable unsigned long int* counter_;
-
- /**
- * @brief A pointer to the current object encapsulated by this
- * shared pointer.
- */
- mutable T* reference_;
-
- /**
- * @brief A flag indicating if this shared pointer was created by a
- * dynamic assignment ( false value ) or by a static
- * assignment( true value - the encapsulated object will not
- * be destroyed at the end.
- */
- mutable bool not_shared_flag_;
-
- /**
- * @brief Set all internal variables to default values.
- *
- */
- void init();
- };
-
-
- template< class T >
- TeSharedPtr< T >::TeSharedPtr( T* pointer )
- {
- init();
- reset( pointer, not_shared_flag_ );
- }
-
-
- template< class T >
- TeSharedPtr< T >::TeSharedPtr( const TeSharedPtr< T >& external )
- {
- init();
- operator=( external );
- }
-
-
- template< class T >
- TeSharedPtr< T >::TeSharedPtr( T* pointer, bool not_shared_flag )
- {
- init();
- reset( pointer, not_shared_flag );
- }
-
-
- template< class T >
- TeSharedPtr< T >::~TeSharedPtr()
- {
- reset( 0, 0 );
- }
-
-
- template< class T >
- inline bool TeSharedPtr< T >::isActive() const
- {
- return ( ( reference_ == 0 ) ? false : true );
- }
-
-
- template< class T >
- inline bool TeSharedPtr< T >::isShared() const
- {
- return ( ! not_shared_flag_ );
- }
-
-
- template< class T >
- void TeSharedPtr< T >::reset( T* pointer, bool not_shared_flag )
- {
- this_lock_instance_.lock();
-
- /* updating the shared objects */
-
- if( ( reference_ != 0 ) && ( ! not_shared_flag_ ) ) {
- counter_lock_instance_ptr_->lock();
-
- --(*counter_);
-
- /* Cleanning the shared pointed objects if necessary */
-
- if( (*counter_) == 0 ) {
- delete counter_;
- delete reference_;
- delete counter_lock_instance_ptr_;
- } else {
- counter_lock_instance_ptr_->unLock();
- }
- }
-
- init();
-
- /* Acquiring the pointed object */
-
- if( pointer != 0 ) {
- if( ! not_shared_flag ) {
- counter_ = new unsigned long int;
- (*counter_) = 1;
- counter_lock_instance_ptr_ = new TeMutex;
- }
-
- reference_ = pointer;
- not_shared_flag_ = not_shared_flag;
- }
-
- this_lock_instance_.unLock();
- }
-
-
- template< class T >
- TeSharedPtr< T >& TeSharedPtr< T >::operator=(
- const TeSharedPtr< T >& external )
- {
- if( ( &external ) != this ) {
- reset();
-
- this_lock_instance_.lock();
-
- if( (&external) != 0 ) {
- external.this_lock_instance_.lock();
-
- if( external.isActive() ) {
- reference_ = external.reference_;
-
- if( ( ! not_shared_flag_ ) && ( ! external.not_shared_flag_ ) ) {
-
- counter_ = external.counter_;
- (*counter_) = (*counter_) + 1;
-
- counter_lock_instance_ptr_ = external.counter_lock_instance_ptr_;
- } else {
- not_shared_flag_ = true;
- }
- }
-
- external.this_lock_instance_.unLock();
- }
-
- this_lock_instance_.unLock();
- }
-
- return *this;
- }
-
-
- template< class T >
- inline T& TeSharedPtr< T >::operator*() const
- {
- TEAGN_DEBUG_CONDITION( isActive(),
- "Trying to use an inactive shared pointer instance" );
-
- return *reference_;
- }
-
-
- template< class T >
- inline T* TeSharedPtr< T >::operator->() const
- {
- TEAGN_DEBUG_CONDITION( isActive(),
- "Trying to use an inactive shared pointer instance" );
-
- return reference_;
- }
-
-
- template< class T >
- inline bool TeSharedPtr< T >::operator==(
- const TeSharedPtr< T >& external ) const
- {
- return ( ( reference_ == external.reference_ ) ? true : false );
- }
-
-
- template< class T >
- inline bool TeSharedPtr< T >::operator<(
- const TeSharedPtr< T >& external ) const
- {
- return ( ( reference_ < external.reference_ ) ? true : false );
- }
-
-
- template< class T >
- inline bool TeSharedPtr< T >::operator>(
- const TeSharedPtr< T >& external ) const
- {
- return ( ( reference_ > external.reference_ ) ? true : false );
- }
-
-
- template< class T >
- inline bool TeSharedPtr< T >::operator!=(
- const TeSharedPtr< T >& external ) const
- {
- return ( ( reference_ == external.reference_ ) ? false : true );
- }
-
-
- template< class T >
- inline T* TeSharedPtr< T >::nakedPointer() const
- {
- return reference_;
- }
-
- template< class T >
- TeSharedPtr< T > TeSharedPtr< T >::getNonSharedCopy() const
- {
- TeSharedPtr< T > outptr;
- outptr.reset( reference_, true );
- return outptr;
- }
-
- template< class T >
- unsigned long int TeSharedPtr< T >::getRefCount() const
- {
- if( reference_ ) {
- if( counter_) {
- return (*counter_);
- } else {
- return 1;
- }
- } else {
- return 0;
- }
- }
-
- template< class T >
- void TeSharedPtr< T >::init()
- {
- counter_ = 0;
- reference_ = 0;
- counter_lock_instance_ptr_ = 0;
- not_shared_flag_ = false;
- }
-
-/** @example TeSharedPtr_test.cpp
- * Shows how to use this class.
- */
-
-#endif
-
diff --git a/src/terralib/kernel/TeSingleton.h b/src/terralib/kernel/TeSingleton.h
index f7190dd..977573e 100644
--- a/src/terralib/kernel/TeSingleton.h
+++ b/src/terralib/kernel/TeSingleton.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeSingleton.h
\brief This file contains a template for the "Singleton" pattern.
*/
diff --git a/src/terralib/kernel/TeSlice.h b/src/terralib/kernel/TeSlice.h
deleted file mode 100644
index 6065fb4..0000000
--- a/src/terralib/kernel/TeSlice.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeSlice.h
- \brief This file provides support for a slice structure
-*/
-#ifndef __TERRALIB_INTERNAL_SLICE_H
-#define __TERRALIB_INTERNAL_SLICE_H
-
-#include "TeUtils.h"
-
-#include <string>
-#include <vector>
-#include <map>
-#include <iostream>
-using namespace std;
-
-/*!
-A Slice is a structure that defines an interval of values and associates a
-number of objects that have a certain property, or attribute, whithin this
-interval.
-*/
-class TL_DLL TeSlice
-{
-public:
- int count_; //! number of objects container in the interval
- string from_; //! interval lower value
- string to_; //! interval upper value
-
- //! Constructor
- TeSlice () : count_(0),from_(""),to_("") {}
-
- //! Constructor
- TeSlice(const string& from, const string& to, int count=0) :
- count_(count),
- from_(from),
- to_(to) {}
-
- TeSlice(const TeSlice& slice)
- {
- from_ = slice.from_;
- to_ = slice.to_;
- count_ = slice.count_;
- }
-
- TeSlice& operator=(const TeSlice& slice)
- {
- from_ = slice.from_;
- to_ = slice.to_;
- count_ = slice.count_;
- return *this;
- }
-};
-
-//! A vector of slices
-typedef vector<TeSlice> TeSliceVector;
-#endif
-
diff --git a/src/terralib/kernel/TeSparseMatrix.h b/src/terralib/kernel/TeSparseMatrix.h
deleted file mode 100644
index 81b04d9..0000000
--- a/src/terralib/kernel/TeSparseMatrix.h
+++ /dev/null
@@ -1,274 +0,0 @@
-// k9/a4/sparmat.h, templates for sparse matrices
-#ifndef SPARSEMATRIX_H
-#define SPARSEMATRIX_H SPARSEMATRIX_H
-
-// selection of implementation
-#ifdef STL_map // defined in main()
-#include<map>
-#include<cassert>
-#else
-#include<hmap.h>
-
-#include "TeDefines.h"
-
-/* If at this point the HMap container is chosen, a function for
- calculating the hash table addresses is needed. As opposed to the
- hash functions described up to now, not only one value, but two are
- used for the calculation. Therefore, the function operator of the
- PairHashFun class takes a pair as argument. The address calculation
- itself is simple, but sufficient for our purposes. */
-
-using namespace std;
-
-template<class IndexType> // int, long or unsigned
-class PairHashFun
-{
- public:
- PairHashFun(long prime=65537) // another prime number is possible
- // e.g. 2111 for smaller Matrizes
- : tabSize(prime)
- {}
-
- // Address calculation with two values
- long operator()(const pair<IndexType, IndexType>& p) const
- {
- return (p.first + p.second) % tabSize;
- }
-
- long tableSize() const
- {
- return tabSize;
- }
-
- private:
- long tabSize;
-};
-#endif // STL_map
-
-#ifdef _MSC_VER
-#include <utility>
-using namespace std;
-#endif
-
-template<class ValueType, class IndexType, class ContainerType>
-class MatrixElement
-{
- private:
- ContainerType& C;
- typename ContainerType::iterator I;
- IndexType row, column;
-
- public:
- typedef pair<IndexType, IndexType> IndexPair;
- typedef MatrixElement<ValueType, IndexType,
- ContainerType>& Reference;
-
- MatrixElement(ContainerType& Cont, IndexType r, IndexType c)
- : C(Cont), I(C.find(IndexPair(r,c))),
- row(r), column(c)
- {}
-
- /* The constructor initializes the private variables with all
- information that is needed. The container itself is located in
- the sparseMatrix class; here, the reference to it is entered.
- If the passed indices for row and column belong to an element
- not yet stored in the container, the iterator has the value
- C.end(). */
-
- ValueType asValue() const
- {
- if(I == C.end())
- return ValueType(0);
- else
- return (*I).second;
- }
-
- operator ValueType () const // type conversion operator
- {
- return asValue();
- }
-
- /* According to the definition of the sparse matrix, 0 is returned
- if the element is not present in the container. Otherwise, the
- result is the second part of the object of type value_type
- stored in the container. */
-
- Reference operator=(const ValueType& x)
- {
- if(x != ValueType(0)) // not equal 0?
- {
- /* If the element does not yet exist, it is put, together
- with the indices, into an object of type value_type and
- inserted with insert(): */
-
- if(I == C.end())
- {
- assert(C.size() < C.max_size());
- I = (C.insert(
-#ifndef _MSC_VER
- typename
-#endif
- ContainerType::value_type(
- IndexPair(row,column), x))
- ).first;
- }
- else (*I).second = x;
- }
-
- /* insert() returns a pair whose first part is an iterator
- pointing to the inserted object. The second part is of type
- bool and indicates whether the insertion took place because
- no element with this key existed. This is, however, not
- evaluated here because, due to the precondition (I ==
- C.end()), the second part must always have the value true.
- If, instead, the element already exists, the value is
- entered into the second part of the value_type object. If
- the value is equal 0, in order to save space the element is
- deleted if it existed. */
-
- else // x = 0
- if(I != C.end())
- {
- C.erase(I);
- I = C.end();
- }
- return *this;
- }
-
- /* An assignment operator is required which in turn requires a
- reference to an object of type MatrixElement. When both the
- left- and right-hand side are identical, nothing has to happen.
- Otherwise, as above, it has to be checked whether the value of
- the right-hand element is 0 or not. The resulting behavior is
- described together with the above assignment operator, so that
- here it is simply called: */
-
- Reference operator=(const Reference rhs)
- {
- if(this != &rhs) // not identical?
- {
- return operator=(rhs.asValue()); // see above
- }
- return *this;
- }
-
-}; // class MatrixElement
-
-template<class ValueType, class IndexType>
-class TeSparseMatrix
-{
- public:
- typedef pair<IndexType, IndexType> IndexPair;
-
- // The switch STL_map controls the compilation:
-
-#ifdef STL_map
- typedef map<IndexPair, ValueType,
- less<IndexPair> > ContainerType;
-#else
- typedef HMap<IndexPair, ValueType,
- PairHashFun<IndexType> > ContainerType;
-#endif
-
- typedef MatrixElement<ValueType, IndexType,
- ContainerType> MatrixElement;
-
- public:
- typedef IndexType size_type;
-
- /* The constructor only initializes the row and column
- information. The container is created by its standard
- constructor, where in the case of hash implementation, the size
- of the container is given by the hash function object of type
- PairHashFun (see typedef above). */
-
- private:
- size_type rows, columns;
- ContainerType C;
-
- public:
- sparseMatrix(size_type r, size_type c)
- : rows(r), columns(c)
- {}
-
- size_type Rows() const { return rows;}
- size_type Columns() const { return columns;}
-
- // usual container type definitions
- typedef typename ContainerType::iterator iterator;
- typedef typename ContainerType::const_iterator const_iterator;
-
- // usual container functions
- size_type size() const { return C.size();}
- size_type max_size() const { return C.max_size();}
-
- iterator begin() { return C.begin();}
- iterator end() { return C.end();}
-
- const_iterator begin() const { return C.begin();}
- const_iterator end() const { return C.end();}
-
- void clear()
- {
- C.clear();
-
- }
-
- class Aux // for index operator below
- {
- public:
- Aux(size_type r, size_type maxs, ContainerType& Cont)
- : Row(r), maxColumns(maxs), C(Cont)
- {}
-
- /* After checking the number of columns, the index operator of
- Aux returns a matrix element which is equipped with all
- necessary information to carry out a successful assignment.
- */
-
- MatrixElement operator[](size_type c)
- {
- assert(c >= 0 && c < maxColumns);
- return MatrixElement(C, Row, c);
- }
-
- private:
- size_type Row, maxColumns;
- ContainerType& C;
- };
-
- /* The index operator of the sparseMatrix class returns the
- auxiliary object, whose class is defined as nested inside
- sparseMatrix. */
- Aux operator[](size_type r)
- {
- assert(r >= 0 && r < rows);
- return Aux(r, columns, C);
- }
-
- /* Up to this point, from a functionality point of view, the
- sparseMatrix class is sufficiently equipped. In order, however,
- to avoid writing such horrible things as `(*I).first.first' for
- accessing the elements, some auxiliary functions follow which
- determine the indices and associated values of an iterator in a
- more readable way. */
-
- size_type Index1(iterator& I) const
- {
- return (*I).first.first;
- }
-
- size_type Index2(iterator& I) const
- {
- return (*I).first.second;
- }
-
- ValueType Value(iterator& I) const
- {
- return (*I).second;
- }
-}; // class sparseMatrix
-
-#endif // file sparmat.h
-
-
diff --git a/src/terralib/kernel/TeSpatialOperations.cpp b/src/terralib/kernel/TeSpatialOperations.cpp
deleted file mode 100644
index b53de29..0000000
--- a/src/terralib/kernel/TeSpatialOperations.cpp
+++ /dev/null
@@ -1,1660 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeSpatialOperations.h"
-#include "TeGeometryAlgorithms.h"
-#include "TeRasterRemap.h"
-#include "TeStatistics.h"
-#include "TeOverlay.h"
-#include "TeBufferRegion.h"
-#include "TeProgress.h"
-#include "TeVectorRemap.h"
-
-#include <algorithm>
-
-
-TeProjection*
-getProjectionFromGeomTable(const string& geomTable, TeDatabase* db)
-{
- TeLayerMap layerMap = db->layerMap();
- TeLayerMap::iterator it = layerMap.begin();
- while(it!=layerMap.end())
- {
- TeLayer* layer = it->second;
- TeRepresPointerVector::iterator itRep = layer->vectRepres().begin();
- while(itRep!=layer->vectRepres().end())
- {
- if(TeConvertToUpperCase((*itRep)->tableName_)==TeConvertToUpperCase(geomTable))
- return layer->projection();
- ++itRep;
- }
- ++it;
- }
- return 0;
-}
-
-
-// Return if exist or not a totpological relation between two geometries
-// Use the TerraLib topological functions
-bool TeTopologicalRelation(const TePolygon* geom1, const TePolygon* geom2, int relation)
-{
- bool result = false;
- switch (relation)
- {
- case TeDISJOINT:
- result = TeDisjoint(*geom1, *geom2);
- break;
-
- case TeINTERSECTS:
- result = TeIntersects(*geom1, *geom2);
- break;
-
- case TeTOUCHES:
- result = TeTouches(*geom1, *geom2);
- break;
-
- case TeOVERLAPS:
- result = TeOverlaps(*geom1, *geom2);
- break;
-
- case TeCOVERS:
- result = TeCovers(*geom1, *geom2);
- break;
-
- case TeCOVEREDBY:
- result = TeCoveredBy(*geom1, *geom2);
- break;
-
- case TeCONTAINS:
- result = TeContains(*geom1, *geom2);
- break;
-
- case TeWITHIN:
- result = TeWithin(*geom1, *geom2);
- break;
-
- case TeEQUALS:
- result = TeEquals(*geom1, *geom2);
- break;
-
- case (TeWITHIN | TeCOVEREDBY) :
- result = TeWithinOrCoveredByOrEquals(*geom1, *geom2);
- break;
-
- case (TeWITHIN | TeCOVEREDBY | TeOVERLAPS | TeCROSSES):
- result = ( (TeOverlaps(*geom1, *geom2)) || (TeWithinOrCoveredByOrEquals(*geom1, *geom2)));
- break;
- }
- return result;
-}
-
-
-bool TeTopologicalRelation(const TePolygon* geom1, const TeLine2D* geom2, int relation)
-{
- bool result = false;
- switch (relation)
- {
- case TeDISJOINT:
- result = TeDisjoint(*geom2, *geom1);
- break;
-
- case TeINTERSECTS:
- result = TeIntersects(*geom2, *geom1);
- break;
-
- case TeTOUCHES:
- result = TeTouches(*geom2, *geom1);
- break;
-
- case TeCOVERS:
- result = TeCovers(*geom1, *geom2);
- break;
-
- case TeCOVEREDBY:
- result = TeCoveredBy(*geom2, *geom1);
- break;
-
- case TeCONTAINS:
- result = TeContains(*geom1, *geom2);
- break;
-
- case TeWITHIN:
- result = TeWithin(*geom2, *geom1);
- break;
-
- case TeCROSSES:
- result = TeCrosses(*geom2, *geom1);
- break;
-
- case (TeWITHIN | TeCOVEREDBY):
- result = TeWithinOrCoveredByOrEquals(*geom2, *geom1);
- break;
-
- case (TeWITHIN | TeCOVEREDBY | TeOVERLAPS | TeCROSSES):
- result = ( (TeCrosses(*geom2, *geom1)) || (TeWithinOrCoveredByOrEquals(*geom2, *geom1)));
- break;
- }
- return result;
-}
-
-
-bool TeTopologicalRelation(const TePolygon* geom1, const TePoint* geom2, int relation)
-{
- bool result = false;
- switch (relation)
- {
- case TeDISJOINT:
- result = TeDisjoint(*geom2, *geom1);
- break;
-
- case TeINTERSECTS:
- result = TeIntersects(*geom2, *geom1);
- break;
-
- case TeTOUCHES:
- result = TeTouches(*geom2, *geom1);
- break;
-
- case TeCONTAINS:
- result = TeContains(*geom1, *geom2);
- break;
-
- case TeWITHIN:
- result = TeWithin(*geom2, *geom1);
- break;
-
- case (TeWITHIN | TeCOVEREDBY):
- case (TeWITHIN | TeCOVEREDBY | TeOVERLAPS | TeCROSSES):
- result = TeWithinOrCoveredByOrEquals((*geom2).location(), *geom1);
- break;
- }
- return result;
-}
-
-bool TeTopologicalRelation(const TeLine2D* geom1, const TeLine2D* geom2, int relation)
-{
- bool result = false;
- switch (relation)
- {
- case TeDISJOINT:
- result = TeDisjoint(*geom1, *geom2);
- break;
-
- case TeINTERSECTS:
- result = TeIntersects(*geom1, *geom2);
- break;
-
- case TeTOUCHES:
- result = TeTouches(*geom1, *geom2);
- break;
-
- case TeOVERLAPS:
- result = TeOverlaps(*geom1, *geom2);
- break;
-
- case TeCOVERS:
- result = TeCovers(*geom1, *geom2);
- break;
-
- case TeCOVEREDBY:
- result = TeCoveredBy(*geom1, *geom2);
- break;
-
- case TeCONTAINS:
- result = TeContains(*geom1, *geom2);
- break;
-
- case TeWITHIN:
- result = TeWithin(*geom1, *geom2);
- break;
-
- case TeEQUALS:
- result = TeEquals(*geom1, *geom2);
- break;
-
- case TeCROSSES:
- result = TeCrosses(*geom1, *geom2);
- break;
-
- case (TeWITHIN | TeCOVEREDBY | TeOVERLAPS | TeCROSSES):
- result = ( (TeCrosses(*geom1, *geom2)) || (TeWithinOrCoveredByOrEquals(*geom1, *geom2)));
- break;
- }
- return result;
-}
-
-bool TeTopologicalRelation(const TeLine2D* geom1, const TePoint* geom2, int relation)
-{
- bool result = false;
- switch (relation)
- {
- case TeDISJOINT:
- result = TeDisjoint(*geom2, *geom1);
- break;
-
- case TeINTERSECTS:
- result = TeIntersects(*geom2, *geom1);
- break;
-
- case TeTOUCHES:
- result = TeTouches(*geom2, *geom1);
- break;
-
- case TeCONTAINS:
- result = TeContains(*geom1, *geom2);
- break;
-
- case TeWITHIN:
- result = TeWithin(*geom2, *geom1);
- break;
-
- case (TeWITHIN | TeCOVEREDBY):
- case (TeWITHIN | TeCOVEREDBY | TeOVERLAPS | TeCROSSES):
- result = TeWithinOrCoveredByOrEquals((*geom2).location(), *geom1);
- break;
- }
- return result;
-}
-
-bool TeTopologicalRelation(const TePoint* geom1, const TePoint* geom2, int relation)
-{
- bool result = false;
- switch (relation)
- {
- case TeDISJOINT:
- result = TeDisjoint(*geom1, *geom2);
- break;
-
- case TeINTERSECTS:
- result = TeIntersects(*geom1, *geom2);
- break;
-
- case TeCONTAINS:
- result = TeContains(*geom1, *geom2);
- break;
-
- case TeWITHIN:
- result = TeWithin(*geom1, *geom2);
- break;
-
- case TeEQUALS:
- case (TeWITHIN | TeCOVEREDBY | TeOVERLAPS | TeCROSSES):
- result = TeEquals(*geom1, *geom2);
- break;
- }
- return result;
-}
-
-bool TeTopologicalRelation(const TeCell* geom1, const TeCell* geom2, int relation)
-{
- bool result = false;
- switch (relation)
- {
- case TeDISJOINT:
- result = TeDisjoint(*geom1, *geom2);
- break;
-
- case TeINTERSECTS:
- result = TeIntersects(*geom1, *geom2);
- break;
-
- case TeTOUCHES:
- result = TeTouches(*geom1, *geom2);
- break;
-
- case TeOVERLAPS:
- result = TeOverlaps(*geom1, *geom2);
- break;
-
- case TeCOVERS:
- result = TeCovers(*geom1, *geom2);
- break;
-
- case TeCOVEREDBY:
- result = TeCoveredBy(*geom1, *geom2);
- break;
-
- case TeCONTAINS:
- result = TeContains(*geom1, *geom2);
- break;
-
- case TeWITHIN:
- result = TeWithin(*geom1, *geom2);
- break;
-
- case TeEQUALS:
- result = TeEquals(*geom1, *geom2);
- break;
-
- case (TeWITHIN | TeCOVEREDBY):
- result = TeWithinOrCoveredByOrEquals((*geom1).box(), (*geom2).box());
- break;
-
- case (TeWITHIN | TeCOVEREDBY | TeOVERLAPS | TeCROSSES):
- result = ( (TeOverlaps(*geom1, *geom2)) || (TeWithinOrCoveredByOrEquals((*geom1).box(), (*geom2).box())));
- break;
- }
- return result;
-}
-
-bool TeTopologicalRelation(const TeCell* geom1, const TePolygon* geom2, int relation)
-{
- bool result = false;
- switch (relation)
- {
- case TeDISJOINT:
- result = TeDisjoint(*geom1, *geom2);
- break;
-
- case TeINTERSECTS:
- result = TeIntersects(*geom1, *geom2);
- break;
-
- case TeTOUCHES:
- result = TeTouches(*geom1, *geom2);
- break;
-
- case TeOVERLAPS:
- result = TeOverlaps(*geom1, *geom2);
- break;
-
- case TeCOVERS:
- result = TeCovers(*geom1, *geom2);
- break;
-
- case TeCOVEREDBY:
- result = TeCoveredBy(TeMakePolygon((*geom1).box()), *geom2);
- break;
-
- case TeCONTAINS:
- result = TeWithin(*geom2, TeMakePolygon((*geom1).box()));
- break;
-
- case TeWITHIN:
- result = TeWithin(*geom1, *geom2);
- break;
-
- case TeEQUALS:
- result = TeEquals(*geom1, *geom2);
- break;
-
- case (TeWITHIN | TeCOVEREDBY):
- result = TeWithinOrCoveredByOrEquals(TeMakePolygon((*geom1).box()), *geom2);
- break;
-
- case (TeWITHIN | TeCOVEREDBY | TeOVERLAPS | TeCROSSES):
- result = ( (TeOverlaps(*geom1, *geom2)) || (TeWithinOrCoveredByOrEquals(TeMakePolygon((*geom1).box()) , *geom2)));
- break;
- }
- return result;
-}
-
-bool TeTopologicalRelation(const TeCell* geom1, const TeLine2D* geom2, int relation)
-{
- bool result = false;
- switch (relation)
- {
- case TeDISJOINT:
- result = TeDisjoint(*geom1, *geom2);
- break;
-
- case TeINTERSECTS:
- result = TeIntersects(*geom1, *geom2);
- break;
-
- case TeTOUCHES:
- result = TeTouches(*geom2, *geom1);
- break;
-
- case TeCOVERS:
- result = TeCovers(*geom1, *geom2);
- break;
-
- case TeCOVEREDBY:
- result = TeCoveredBy(*geom2, *geom1);
- break;
-
- case TeCONTAINS:
- result = TeContains(*geom1, *geom2);
- break;
-
- case TeWITHIN:
- result = TeWithin(*geom2, *geom1);
- break;
-
- case TeCROSSES:
- result = TeCrosses(*geom2, *geom1);
- break;
-
- case (TeWITHIN | TeCOVEREDBY):
- result = TeWithinOrCoveredByOrEquals(*geom2, TeMakePolygon((*geom1).box()));
- break;
-
- case (TeWITHIN | TeCOVEREDBY | TeOVERLAPS | TeCROSSES):
- result = ( (TeCrosses(*geom2, *geom1)) || (TeWithinOrCoveredByOrEquals(*geom2, TeMakePolygon((*geom1).box()))));
- break;
- }
- return result;
-
-}
-
-bool TeTopologicalRelation(const TeCell* geom1, const TePoint* geom2, int relation)
-{
- bool result = false;
- switch (relation)
- {
- case TeDISJOINT:
- result = TeDisjoint(*geom1, *geom2);
- break;
-
- case TeINTERSECTS:
- result = TeIntersects(*geom1, *geom2);
- break;
-
- case TeTOUCHES:
- result = TeTouches(*geom2, *geom1);
- break;
-
- case TeCONTAINS:
- result = TeContains(*geom1, *geom2);
- break;
-
- case TeWITHIN:
- result = TeWithin(*geom2, *geom1);
- break;
-
- case (TeWITHIN & TeCOVEREDBY):
- case (TeWITHIN | TeCOVEREDBY | TeOVERLAPS | TeCROSSES):
- result = TeWithinOrCoveredByOrEquals((*geom2).location(), TeMakePolygon((*geom1).box()));
- break;
- }
- return result;
-
-}
-
-
-// Return a string with the identifications of the selected geometries
-string
-getStringIds(TeKeys& IdsIn)
-{
- string Ids = "";
- int cont = 0;
-
- TeKeys::iterator itIdIn = IdsIn.begin();
- while (itIdIn != IdsIn.end())
- {
- if(cont)
- Ids += ",";
- Ids += "'" + (*itIdIn) + "'";
- itIdIn++;
- cont++;
- }
-
- return Ids;
-}
-
-// fill the geometries vector from a portal
-string
-mountSelect(string geomTable, string colTable, TeGeomRep rep, TeBox& box, int relate, TeDatabasePortal *portal)
-{
-
- string sql = "SELECT * FROM "+ geomTable;
-
- if(!colTable.empty())
- sql +=", "+ colTable +" WHERE c_object_id = object_id ";
-
- //If not disjoint
- if(box.isValid() && (relate!=TeDISJOINT))
- {
- if(!colTable.empty())
- sql += " AND ";
- else
- sql += " WHERE ";
-
- sql += portal->getDatabase()->getSQLBoxWhere (box, rep);
- }
- return sql;
-}
-
-//fill the result vector of the geometries identificators
-bool
-fillSelectedGeomVector(TeGeomRep actRep, TeSelectedGeom& vetGeom, TeDatabasePortal *portal, TeProjection* projAct=0, TeProjection* projVis=0)
-{
- bool flag = true;
- bool remap = false;
-
- if((projAct!=0) && (projVis!=0) && (projAct!=projVis))
- remap = true;
-
- try
- {
- do
- {
- if(actRep == TePOLYGONS)
- {
- TePolygon poly, *pol;
- flag = portal->fetchGeometry(poly);
- pol = new TePolygon;
- if(remap)
- {
- TePolygon pout;
- TeVectorRemap (poly, projAct, pout, projVis);
- *pol = pout;
- }
- else
- *pol = poly;
- vetGeom.push_back(pol);
- }
- else if(actRep == TeLINES)
- {
- TeLine2D line, *lin;
- flag = portal->fetchGeometry(line);
- lin = new TeLine2D();
- if(remap)
- {
- TeLine2D gout;
- TeVectorRemap (line, projAct, gout, projVis);
- *lin = gout;
- }
- else
- *lin = line;
- vetGeom.push_back(lin);
- }
- else if(actRep == TePOINTS)
- {
- TePoint point, *pnt;
- flag = portal->fetchGeometry(point);
- pnt = new TePoint();
- if(remap)
- {
- TePoint gout;
- TeVectorRemap (point, projAct, gout, projVis);
- *pnt = gout;
- }
- else
- *pnt = point;
- vetGeom.push_back(pnt);
- }
- else if(actRep == TeCELLS)
- {
- TeCell cell, *cll;
- flag = portal->fetchGeometry(cell);
- cll = new TeCell();
- if(remap)
- {
- TeCell gout;
- TeVectorRemap (cell, projAct, gout, projVis);
- *cll = gout;
- }
- else
- *cll = cell;
- vetGeom.push_back(cll);
- }
- } while (flag);
- }
- catch(...)
- {
- TeSelectedGeom::iterator it;
- for(it = vetGeom.begin(); it != vetGeom.end(); it++)
- delete (*it);
- return false;
- }
-
- return true;
-}
-
-//geom: selected geometries
-//obj: portal geometries
-//basic idea: obj "relate" geom
-bool
-fillResultIdsVector(TeGeometry *geom, TeDatabasePortal *portal, TeGeomRep portalRep, int relate, TeKeys& resultIds)
-{
- bool flag = false;
- bool result = false;
- TeGeomRep geomRep = geom->elemType();
- bool isSet = false;
- int setSize = 1;
-
- if ( (dynamic_cast<TePolygonSet*> (geom)) ||
- (dynamic_cast<TeLineSet*> (geom)) ||
- (dynamic_cast<TePointSet*> (geom)) ||
- (dynamic_cast<TeCellSet*> (geom)) )
- {
- isSet = true;
- setSize = geom->size();
- }
-
- try
- {
- do
- {
- TeGeometry* obj = 0;
- if(portalRep == TePOLYGONS)
- {
- TePolygon poly, *pol;
- flag = portal->fetchGeometry (poly);
- pol = new TePolygon();
- *pol = poly;
- obj = pol;
- }
- else if(portalRep == TeLINES)
- {
- TeLine2D line, *lin;
- flag = portal->fetchGeometry (line);
- lin = new TeLine2D();
- *lin = line;
- obj = lin;
- }
- else if(portalRep == TePOINTS)
- {
- TePoint point, *pnt;
- flag = portal->fetchGeometry (point);
- pnt = new TePoint();
- *pnt = point;
- obj = pnt;
- }
- else if(portalRep == TeCELLS)
- {
- TeCell cell, *cll;
- flag = portal->fetchGeometry (cell);
- cll = new TeCell();
- *cll = cell;
- obj = cll;
- }
-
- result = false;
-
- //for each geometry
- for(int i=0; i<setSize; ++i)
- {
- TeGeometry* geomTemp = 0;
- if(isSet)
- {
- if(geomRep==TePOLYGONS)
- geomTemp = &(((TePolygonSet*)geom)->operator[](i));
- else if (geomRep==TeLINES)
- geomTemp = &(((TeLineSet*)geom)->operator[](i));
- else if (geomRep==TePOINTS)
- geomTemp = &(((TePointSet*)geom)->operator[](i));
- else if (geomRep==TeCELLS)
- geomTemp = &(((TeCellSet*)geom)->operator[](i));
- }
- else
- geomTemp = geom;
-
- switch (geomRep | portalRep) //geom: selected and obj: portal
- {
-
- case 1: //polygon with polygon
- result = TeTopologicalRelation((TePolygon*)obj, (TePolygon*)geomTemp, relate);
- break;
-
- case 2://line with line
- result = TeTopologicalRelation((TeLine2D*)obj, (TeLine2D*)geomTemp, relate);
- break;
-
- case 3://polygon with line
- if(geomRep == TePOLYGONS)
- result = TeTopologicalRelation((TePolygon*)geomTemp, (TeLine2D*)obj, relate);
- else
- result = TeTopologicalRelation((TePolygon*)obj, (TeLine2D*)geomTemp, relate);
- break;
-
- case 4://point with point
- result = TeTopologicalRelation((TePoint*)obj, (TePoint*)geomTemp, relate);
- break;
-
- case 5://polygon with point
- if(geomRep == TePOLYGONS)
- result = TeTopologicalRelation((TePolygon*)geomTemp, (TePoint*)obj, relate);
- else
- result = TeTopologicalRelation((TePolygon*)obj, (TePoint*)geomTemp, relate);
- break;
-
- case 6://line with point
- if(geomRep == TeLINES)
- result = TeTopologicalRelation((TeLine2D*)geomTemp, (TePoint*)obj, relate);
- else
- result = TeTopologicalRelation((TeLine2D*)obj, (TePoint*)geomTemp, relate);
- break;
-
- case 256://cell with cell
- result = TeTopologicalRelation((TeCell*)obj, (TeCell*)geomTemp, relate);
- break;
-
- case 257://cell with polygon
- if(geomRep == TePOLYGONS)
- result = TeTopologicalRelation((TeCell*)obj, (TePolygon*)geomTemp, relate);
- else
- result = TeTopologicalRelation((TeCell*)geomTemp, (TePolygon*)obj, relate);
- break;
-
- case 258://cell with line
- if(geomRep == TeLINES)
- result = TeTopologicalRelation((TeCell*)obj, (TeLine2D*)geomTemp, relate);
- else
- result = TeTopologicalRelation((TeCell*)geomTemp, (TeLine2D*)obj, relate);
- break;
-
- case 260://cell with point
- if(geomRep == TeCELLS)
- result = TeTopologicalRelation((TeCell*)geomTemp, (TePoint*)obj, relate);
- else
- result = TeTopologicalRelation((TeCell*)obj, (TePoint*)geomTemp, relate);
- break;
- }
-
- if(result)
- {
- string objId = obj->objectId();
- resultIds.push_back(objId);
- }
- }//for
-
- delete obj;
- } while (flag); //fetchrow
- }
- catch(...)
- {
- return false;
- }
- return true;
-}
-
-
-bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- TeDatabasePortal *portal, int relation, const string& actColTable)
-{
- TeKeys resultIds;
-
- if(!TeTopologicalRelation(actGeomTable, actRep, actIdsIn, resultIds, portal->getDatabase(), relation, actColTable))
- return false;
-
- string Ids = getStringIds(resultIds);
-
- string sql = "SELECT * FROM " + actGeomTable;
- sql += " WHERE object_id IN (" + Ids + ")";
- sql += " ORDER BY object_id ASC ";
- if(actRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- sql += ", parent_id ASC, num_holes DESC ";
-
- portal->freeResult();
-
- if(!portal->query(sql) || !portal->fetchRow())
- return false;
-
- return true;
-}
-
-bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- const string& visGeomTable, TeGeomRep visRep, TeDatabasePortal *portal,
- int relation, const string& visColTable)
-{
- TeKeys resultIds;
-
- if(!TeTopologicalRelation(actGeomTable, actRep, actIdsIn, visGeomTable, visRep, resultIds, portal->getDatabase(), relation, visColTable))
- return false;
-
- string Ids = getStringIds(resultIds);
-
- portal->freeResult ();
-
- string sql = "SELECT * FROM " + visGeomTable;
- sql += " WHERE object_id IN (" + Ids + ")";
- sql += " ORDER BY object_id ASC ";
- if(visRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql) || !portal->fetchRow())
- return false;
-
- return true;
-}
-
-bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeGeometry* geom,
- TeDatabasePortal *portal, int relation, const string& actCollTable)
-{
-
- TeKeys resultIds;
-
- if(!TeTopologicalRelation(actGeomTable, actRep, geom, resultIds, portal->getDatabase(), relation, actCollTable))
- return false;
-
- string Ids = getStringIds(resultIds);
-
- portal->freeResult();
-
- string sql = "SELECT * FROM " + actGeomTable;
- sql += " WHERE object_id IN (" + Ids + ")";
- sql += " ORDER BY object_id ASC ";
- if(actRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql) || !portal->fetchRow())
- return false;
-
- return true;
-}
-
-bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- TeKeys& actIdsOut, TeDatabase* db, int relation, const string& actCollTable)
-{
- TeSelectedGeom vetGeom;
-
- string Ids = getStringIds(actIdsIn);
-
- TeDatabasePortal* portal = db->getPortal();
-
- string sql = "SELECT * FROM " + actGeomTable;
- sql += " WHERE object_id IN (" + Ids + ")";
-
- //order by clause
- string sqlOrderBy = " ORDER BY object_id ASC ";
- if(actRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- sqlOrderBy += ", parent_id ASC, num_holes DESC ";
-
- sql += sqlOrderBy;
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- if(!fillSelectedGeomVector(actRep,vetGeom,portal))
- {
- delete portal;
- return false;
- }
-
- //iterators
- TeSelectedGeom::iterator it;
- actIdsOut.clear();
- double prec = TePrecision::instance().precision();
-
- for (it = vetGeom.begin(); it != vetGeom.end(); it++)
- {
- portal->freeResult();
- TeBox box = (**it).box();
-
- TeBox temp (box.x1()-prec, box.y1()-prec, box.x2()+prec, box.y2()+prec);
-
- sql = mountSelect(actGeomTable, actCollTable, actRep, temp, relation, portal);
- if(relation != TeEQUALS)
- sql += " AND object_id NOT IN (" + Ids + ")";
- sql += sqlOrderBy;
-
- if(!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- if(!portal->fetchRow())
- continue;
-
- fillResultIdsVector((*it), portal, actRep, relation, actIdsOut);
-
- }
-
- std::sort(actIdsOut.begin(), actIdsOut.end());
- unique(actIdsOut.begin(), actIdsOut.end());
-
- delete portal;
-
- for (it = vetGeom.begin(); it != vetGeom.end(); it++)
- delete (*it);
-
- return true;
-}
-
-bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- const string& visGeomTable, TeGeomRep visRep, TeKeys& visIdsOut,
- TeDatabase* db, int relation, const string& visCollTable, TeDatabase* dbVis)
-{
- TeSelectedGeom vetGeom;
-
- string Ids = getStringIds(actIdsIn);
- if(dbVis == 0)
- dbVis = db;
-
- //verify projection
- TeProjection* projAct = getProjectionFromGeomTable(actGeomTable, db);
- TeProjection* projVis = getProjectionFromGeomTable(visGeomTable, dbVis);
-
- TeDatabasePortal* portal = db->getPortal();
-
- string sql = "SELECT * FROM " + actGeomTable;
- sql += " WHERE object_id IN (" + Ids + ")";
- sql += " ORDER BY object_id ASC ";
- if(actRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql)|| !portal->fetchRow ())
- {
- delete portal;
- return false;
- }
-
- if(!fillSelectedGeomVector(actRep,vetGeom,portal,projAct, projVis))
- {
- delete portal;
- return false;
- }
-
- if(db != dbVis)
- {
- delete portal;
- portal = dbVis->getPortal();
- }
-
- //iterators
- TeSelectedGeom::iterator it;
- visIdsOut.clear();
- double prec = TePrecision::instance().precision();
-
- for (it = vetGeom.begin(); it != vetGeom.end(); it++)
- {
- portal->freeResult();
- TeBox box = (**it).box();
-
- TeBox temp (box.x1()-prec, box.y1()-prec, box.x2()+prec, box.y2()+prec);
-
- sql = mountSelect(visGeomTable, visCollTable, visRep, temp, relation, portal);
- sql += " ORDER BY object_id ASC ";
- if(visRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- if(!portal->fetchRow())
- continue;
-
- fillResultIdsVector((*it), portal, visRep, relation, visIdsOut);
-
- }
-
- delete portal;
-
- std::sort(visIdsOut.begin(), visIdsOut.end());
- unique(visIdsOut.begin(), visIdsOut.end());
-
- for (it = vetGeom.begin(); it != vetGeom.end(); it++)
- delete (*it);
-
- return true;
-}
-
-bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeGeometry* geom,
- TeKeys& actIdsOut, TeDatabase* db, int relation, const string& actCollTable)
-{
- TeDatabasePortal* portal = db->getPortal();
- TeBox box = geom->box();
-
- double prec = TePrecision::instance().precision();
- TeBox temp (box.x1()-prec, box.y1()-prec, box.x2()+prec, box.y2()+prec);
-
- string sql = mountSelect(actGeomTable, actCollTable, actRep, temp, relation, portal);
- sql += " ORDER BY object_id ASC ";
- if(actRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- actIdsOut.clear();
-
- fillResultIdsVector(geom, portal, actRep, relation, actIdsOut);
-
- delete portal;
-
- std::sort(actIdsOut.begin(), actIdsOut.end());
- unique(actIdsOut.begin(), actIdsOut.end());
-
- return true;
-}
-
-bool TeGetWithinDistance(const string& actGeomTable, TeGeomRep actRep, const TeCoord2D& point, TeKeysToDist& IdsDistOut,
- TeDatabase* db, const double& max_dist, const string& actCollTable)
-{
- if(!db)
- return false;
-
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- TeBox box (point.x()-max_dist, point.y()-max_dist,point.x()+max_dist, point.y()+max_dist);
-
- string sql = mountSelect(actGeomTable, actCollTable, actRep, box, TeWITHIN, portal);
- sql += " ORDER BY object_id ASC ";
- if(actRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- if(!portal->fetchRow())
- {
- delete portal;
- return true;
- }
-
- bool flag = true;
- do
- {
- TeCoord2D centroid2;
- string objId;
- if(actRep == TePOLYGONS)
- {
- TePolygon poly;
- flag = portal->fetchGeometry (poly);
- objId = poly.objectId ();
- centroid2 = TeFindCentroid(poly);
- }
- else if(actRep == TeLINES)
- {
- TeLine2D line;
- flag = portal->fetchGeometry (line);
- objId = line.objectId ();
- centroid2 = TeFindCentroid(line);
- }
- else if(actRep == TePOINTS)
- {
- TePoint point;
- flag = portal->fetchGeometry (point);
- objId = point.objectId ();
- centroid2 = TeFindCentroid(point);
- }
- else if(actRep == TeCELLS)
- {
- TeCell cell;
- flag = portal->fetchGeometry (cell);
- objId = cell.objectId ();
- centroid2 = TeFindCentroid(cell);
- }
-
- double dist = TeDistance(point, centroid2);
- if(dist<=max_dist)
- IdsDistOut[objId] = dist;
-
- } while (flag); //fetchrow
-
- //sort(IdsDistOut.begin(), IdsDistOut.end());
-
- delete portal;
- return true;
-}
-
-bool TeGetArea(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, TeDatabase* db, double& area)
-{
- if(actRep != TePOLYGONS && actRep != TeCELLS )
- return false;
-
- string Ids = getStringIds(actIdsIn);
-
- TeDatabasePortal* portal = db->getPortal();
-
- string sql = "SELECT * FROM " + actGeomTable;
- sql += " WHERE object_id IN (" + Ids + ")";
- sql += " ORDER BY object_id ASC ";
-
- if((actRep == TePOLYGONS) && (portal->getDatabase()->dbmsName() != "PostGIS"))
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = false;
- double sumArea = 0.;
- do
- {
- if(actRep == TePOLYGONS)
- {
- TePolygon poly;
- flag = portal->fetchGeometry(poly);
- sumArea+= TeGeometryArea(poly);
- }
- else if(actRep == TeCELLS)
- {
- TeCell cell;
- flag = portal->fetchGeometry(cell);
- sumArea+= TeGeometryArea(cell.box());
- }
- }while (flag);
-
- area = sumArea;
- delete portal;
- return true;
-}
-
-
-bool TeGetLength(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, TeDatabase* db, double& length)
-{
- if((actRep != TePOLYGONS) && (actRep != TeLINES) && (actRep != TeCELLS) )
- return false;
-
- string Ids = getStringIds(actIdsIn);
-
- TeDatabasePortal* portal = db->getPortal();
-
- string sql = "SELECT * FROM " + actGeomTable;
- sql += " WHERE object_id IN (" + Ids + ")";
- sql += " ORDER BY object_id ASC ";
-
- if((actRep == TePOLYGONS) && (portal->getDatabase()->dbmsName() != "PostGIS"))
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = false;
- double sumLen = 0.;
- do
- {
- if(actRep == TePOLYGONS)
- {
- TePolygon p;
- flag = portal->fetchGeometry(p);
-
- for(unsigned int i=0; i<p.size(); i++)
- sumLen += TeLength(p[i]);
- }
- else if (actRep == TeLINES)
- {
- TeLine2D l;
- flag = portal->fetchGeometry(l);
- sumLen += TeLength(l);
- }
- else if (actRep == TeCELLS)
- {
- TeCell c;
- flag = portal->fetchGeometry(c);
-
- TePolygon p = TeMakePolygon(c.box());
- sumLen += TeLength(p[0]);
- }
-
- }while (flag);
-
- length = sumLen;
- delete portal;
- return true;
-}
-
-
-bool TeGetDistance(const string& actGeomTable, TeGeomRep actRep, TeKeys& IdsIn, TeDatabase* db, double& distance)
-{
- string Ids = getStringIds(IdsIn);
-
- TeDatabasePortal* portal = db->getPortal();
-
- string sql = "SELECT * FROM " + actGeomTable;
- sql += " WHERE object_id IN (" + Ids + ")";
- sql += " ORDER BY object_id ASC ";
-
- if((actRep == TePOLYGONS) && (portal->getDatabase()->dbmsName() != "PostGIS"))
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = false;
- string lastObjId ="";
- TeCoord2D coord1, coord2;
- int step = 0;
- do
- {
- TeCoord2D coord;
- string objId;
-
- if(actRep == TePOLYGONS)
- {
- TePolygon p;
- flag = portal->fetchGeometry(p);
- objId = p.objectId();
- if(lastObjId==objId)
- continue;
- coord = TeFindCentroid(p);
- }
- else if (actRep == TeLINES)
- {
- TeLine2D l;
- flag = portal->fetchGeometry(l);
- objId = l.objectId ();
- if(lastObjId==objId)
- continue;
- coord = TeFindCentroid(l);
- }
- else if (actRep == TePOINTS)
- {
- TePoint p;
- flag = portal->fetchGeometry(p);
- coord = p.location();
- }
- else if (actRep == TeCELLS)
- {
- TeCell c;
- flag = portal->fetchGeometry(c);
- objId = c.objectId ();
- if(lastObjId==objId)
- continue;
- coord = TeFindCentroid(c);
- }
-
- if(step==0)
- coord1 = coord;
- else
- coord2 = coord;
-
- lastObjId = objId;
- ++step;
-
- }while (flag);
-
- distance = TeDistance(coord1, coord2);
- delete portal;
- return true;
-}
-
-bool TeGetConvexHull(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TeDatabase* db, TePolygonSet& convexHullSet)
-{
- if(actRep != TePOLYGONS)
- return false;
-
- TeDatabasePortal* portal = db->getPortal();
- string Ids = getStringIds(actIds);
-
- string sql = "SELECT * FROM " + actGeomTable;
- sql += " WHERE object_id IN ("+ Ids +")";
- sql += " ORDER BY object_id ASC ";
-
- if(portal->getDatabase()->dbmsName() != "PostGIS")
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- do
- {
- TePolygon poly, result;
- flag = portal->fetchGeometry(poly);
- TePolygon pol = TeConvexHull(poly);
- result.add(pol[0]);
- convexHullSet.add(result);
- } while (flag);
-
- delete portal;
- return true;
-}
-
-bool TeGetCentroid(const string& actGeomTable, TeGeomRep actRep, TeDatabase* db, TePointSet& centroidSet, TeKeys& actIds, const string& actCollTable)
-{
- TeDatabasePortal* portal = db->getPortal();
- string Ids = getStringIds(actIds);
-
- string select = " SELECT * ";
- string from = " FROM " + actGeomTable;
- string where = " WHERE 1=1 ";
-
- if(!actCollTable.empty())
- {
- select += ", "+ actCollTable;
- where += " AND object_id = c_object_id ";
- }
-
- //if empty it calculates the centroids to all geometries
- if(!Ids.empty())
- where += " AND object_id IN ("+ Ids +")";
-
- string orderBy = " ORDER BY object_id ASC ";
-
- if(actRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- orderBy += ", parent_id ASC, num_holes DESC ";
-
- // ---- progress bar
- int numSteps = 0;
- string sqlProg = " SELECT COUNT(*) "+ from + where;
- if(portal->query(sqlProg) && portal->fetchRow())
- numSteps = portal->getInt(0);
-
- portal->freeResult();
-
- if(TeProgress::instance())
- TeProgress::instance()->setTotalSteps(numSteps);
- //------
-
- string sql = select + from + where + orderBy;
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- string lastObjId ="";
- int step = 0;
- do
- {
- TeCoord2D coord;
- string objId;
-
- if(actRep == TePOLYGONS)
- {
- TePolygon p;
- flag = portal->fetchGeometry(p);
- objId = p.objectId();
- if(lastObjId==objId)
- continue;
- coord = TeFindCentroid(p);
- }
- else if (actRep == TeLINES)
- {
- TeLine2D l;
- flag = portal->fetchGeometry(l);
- objId = l.objectId ();
- if(lastObjId==objId)
- continue;
- coord = TeFindCentroid(l);
- }
- else if (actRep == TeCELLS)
- {
- TeCell c;
- flag = portal->fetchGeometry(c);
- objId = c.objectId ();
- if(lastObjId==objId)
- continue;
- coord = TeFindCentroid(c);
- }
-
- lastObjId = objId;
- TePoint point(coord);
- point.objectId (objId);
- centroidSet.add(point);
-
- if(TeProgress::instance())
- {
- if (TeProgress::instance()->wasCancelled())
- {
- TeProgress::instance()->reset();
- return false;
- }
- else
- TeProgress::instance()->setProgress(step);
- }
- ++step;
-
- } while (flag);
-
- if (TeProgress::instance())
- TeProgress::instance()->reset();
-
- delete portal;
- return true;
-}
-
-
-bool TeGetBuffer(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TeDatabase* db, TePolygonSet& bufferSet, double dist)
-{
-
- if(actIds.empty())
- return false;
-
- string Ids = getStringIds(actIds);
-
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- string sql = " SELECT * FROM " + actGeomTable;
- sql += " WHERE object_id IN ("+ Ids +")";
- sql += " ORDER BY object_id ASC ";
- if(actRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- bool res = true;
- do
- {
- TePolygonSet polSet;
-
- if(actRep == TePOINTS)
- {
- TePoint p;
- TePolygon pol;
- flag = portal->fetchGeometry(p);
- res = TeBUFFERREGION::TeBufferRegion(p.location(), dist, 16, pol);
- polSet.add (pol);
- }
-
- else if(actRep == TeLINES)
- {
- TeLine2D l;
- flag = portal->fetchGeometry(l);
- res = TeBUFFERREGION::TeBufferRegion(l, dist, 8, polSet);
- }
-
- else if(actRep == TePOLYGONS)
- {
- TePolygon p;
- flag = portal->fetchGeometry(p);
- res = TeBUFFERREGION::TeBufferRegion(p, dist, 8, polSet);
- }
-
- else if(actRep == TeCELLS)
- {
- TeCell c;
- flag = portal->fetchGeometry(c);
- res = TeBUFFERREGION::TeBufferRegion(TeMakePolygon(c.box()), dist, 8, polSet);
- }
-
- if(res)
- {
- for(unsigned int i=0; i<polSet.size(); i++)
- bufferSet.add(polSet[i]);
- }
-
- } while (flag && res);
-
- delete portal;
- return true;
-}
-
-
-bool TeGetOverlay(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TeDatabase* db, TeGeometryVect& geomVect, const short& operation)
-{
- if((actIds.empty()) || (actRep!=TePOLYGONS && actRep!=TeCELLS))
- return false;
-
- string Ids = getStringIds(actIds);
-
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- string sql = " SELECT * FROM " + actGeomTable;
- sql += " WHERE object_id IN ("+ Ids +")";
- sql += " ORDER BY object_id ASC ";
- if(actRep == TePOLYGONS && portal->getDatabase()->dbmsName() != "PostGIS")
- sql += ", parent_id ASC, num_holes DESC ";
-
- if(!portal->query(sql) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
-
- bool flag = true;
- TePolygonSet polSet1;
-
- if(actRep == TePOLYGONS)
- {
- TePolygon p;
- flag = portal->fetchGeometry(p);
- polSet1.add (p);
- }
- else if(actRep == TeCELLS)
- {
- TeCell c;
- flag = portal->fetchGeometry(c);
- polSet1.add(TeMakePolygon(c.box()));
- }
-
- while (flag)
- {
- TePolygonSet polSet2, polInter;
-
- if(actRep == TePOLYGONS)
- {
- TePolygon p;
- flag = portal->fetchGeometry(p);
- polSet2.add (p);
- }
-
- else if(actRep == TeCELLS)
- {
- TeCell c;
- flag = portal->fetchGeometry(c);
- polSet2.add(TeMakePolygon(c.box()));
- }
-
- if(operation==TeUNION)
- {
- if(!TeOVERLAY::TeUnion(polSet1, polSet2, polInter))
- return false;
- }
- else if (operation==TeINTERSECTION)
- {
- if(!TeOVERLAY::TeIntersection(polSet1, polSet2, polInter))
- return false;
- }
- else if (operation==TeDIFFERENCE)
- {
- if(!TeOVERLAY::TeDifference(polSet1, polSet2, polInter))
- return false;
- }
-
- polSet1 = polInter;
- }
-
- TeGeometry* geom;
- TePolygonSet* pol = new TePolygonSet();
- *pol = polSet1;
- geom = pol;
-
- geomVect.push_back (geom);
- delete portal;
- return true;
-}
-
-
-TeRaster*
-TeMask(TeRaster* whole, TePolygon& poly, TeStrategicIterator st)
-{
- if (!whole || (whole->params().status_ != TeRasterParams::TeReadyToRead &&
- whole->params().status_ != TeRasterParams::TeReadyToWrite))
- return 0;
-
- if (!TeIntersects(poly.box(),whole->params().boundingBox()))
- return 0;
-
- TeRasterParams par = whole->params();
- par.decoderIdentifier_ = "MEM";
- par.mode_ = 'c';
- par.setDummy(0);
-
- TeCoord2D bll = whole->coord2Index(poly.box().lowerLeft());
- TeCoord2D bur = whole->coord2Index(poly.box().upperRight());
-
- bll = whole->index2Coord(TeCoord2D(TeRoundRasterIndex(bll.x_),TeRoundRasterIndex(bll.y_)));
- bur = whole->index2Coord(TeCoord2D(TeRoundRasterIndex(bur.x_),TeRoundRasterIndex(bur.y_)));
-
- par.boxResolution(bll.x_, bll.y_, bur.x_, bur.y_,par.resx_, par.resy_);
- par.setDummy(0.0);
- par.useDummy_ = true;
-
- TeRaster* clip = new TeRaster(par);
- clip->init();
- if (clip->params().status_ != TeRasterParams::TeReadyToWrite)
- return 0;
-
- TeCoord2D cd = TeCoord2D(0,0);
- TeCoord2D ul = clip->params().index2Coord(cd);
- TeCoord2D dxdy = whole->params().coord2Index(ul);
- int j = TeRoundRasterIndex(dxdy.x_); // column delta
- int i = TeRoundRasterIndex(dxdy.y_); // line delta
-
- TeRaster::iteratorPoly it = whole->begin(poly, st);
-// int nlines = it.nLinesInPoly();
-// int ncols = it.nColsInPoly();
- while(!it.end())
- {
- int lin = it.currentLine();
- int col = it.currentColumn();
- int nbands = it.nBands();
- vector<double> vals;
- vals = (*(TeRaster::iterator)it);
- for (int b=0; b<nbands; b++)
- clip->setElement(col-j,lin-i,vals[b],b);
- ++it;
- }
- return clip;
-}
-
-
-
-
-
diff --git a/src/terralib/kernel/TeSpatialOperations.h b/src/terralib/kernel/TeSpatialOperations.h
deleted file mode 100644
index 20dedc0..0000000
--- a/src/terralib/kernel/TeSpatialOperations.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeSpatialOperations.h
- \brief This file contains functions to spatial operations with geographical objects that are in a SGBD
-*/
-
-#ifndef __TERRALIB_INTERNAL_SPATIALOPERATIONS_H
-#define __TERRALIB_INTERNAL_SPATIALOPERATIONS_H
-
-#include "TeDatabase.h"
-#include "TeRaster.h"
-
-//! Keep the selected geometries in the canvas
-typedef vector<TeGeometry*> TeSelectedGeom;
-
-//! Return a string with the identifications of the selected geometries
-TL_DLL string getStringIds(TeKeys& IdsIn);
-
-
-//! Return a portal with the geometries of a spatial table that have a topological relation with specifics geometries of this spatial table
-/*!
- Calculate the topological relation between all geometries of a spatial table and
- specifics geometries of this spatial table
- \param actGeomTable spatial table name that contains all the geometries
- \param actRep geometrical representation of the spatial table
- \param actIdsIn identifications of the specifics geometries (object_id)
- \param portal returned with the resultants geometries
- \param relation topological relation that will be computed
- \param actColTable collection table name that contains a set of geometries of the spatial table
-*/
-TL_DLL bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- TeDatabasePortal *portal, int relation, const string& actColTable="");
-
-
-//! Return a portal with the geometries of a spatial table that have a topological relation with specifics geometries of other spatial table
-/*!
- Calculate the topological relation between all geometries of a spatial table and
- specifics geometries of other spatial table
- \param actGeomTable first spatial table name that contains the specifics geometries
- \param actRep geometrical representation of the first spatial table
- \param actIdsIn identifications of specifics geometries of the first spatial table (object_id)
- \param visGeomTable second spatial table name that contains the others geometries
- \param visRep geometrical representation of the second spatial table
- \param portal returned with the resultants geometries
- \param relation topological relation that will be computed
- \param visColTable collection table name that contains a set of geometries of the second spatial table
-*/
-TL_DLL bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- const string& visGeomTable, TeGeomRep visRep, TeDatabasePortal *portal,
- int relation, const string& visColTable="");
-
-
-//! Return a portal with the geometries of a spatial table that have a topological relation with a specific geometry
-/*!
- Calculate the topological relation between all geometries of a spatial table and a specific geometry
- \param actGeomTable spatial table name that contains the geometries
- \param actRep geometrical representation of the spatial table
- \param geom a specific geometry
- \param portal returned with the resultants geometries
- \param relation topological relation that will be computed
- \param actCollTable collection table name that contains a set of geometries of the spatial table
-*/
-TL_DLL bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeGeometry* geom,
- TeDatabasePortal *portal, int relation, const string& actCollTable="");
-
-
-//! Return the identications of the geometries of a spatial table that have a topological relation with specifics geometries of this spatial table
-/*!
- Calculate the topological relation between all geometries of a spatial table and
- specifics geometries of this spatial table
- \param actGeomTable spatial table name that contains all the geometries
- \param actRep geometrical representation of the spatial table
- \param actIdsIn identifications of the specifics geometries (object_id)
- \param actIdsOut returned with the identications of the resultants geometries (object_id)
- \param db a TeDatabase pointer
- \param relation topological relation that will be computed
- \param actCollTable collection table name that contains a set of geometries of the spatial table
-*/
-TL_DLL bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- TeKeys& actIdsOut, TeDatabase* db, int relation, const string& actCollTable="");
-
-
-//! Return the identications of the geometries of a spatial table that have a topological relation with specifics geometries of other spatial table
-/*!
- Calculate the topological relation between all geometries of a spatial table and
- specifics geometries of other spatial table
- \param actGeomTable first spatial table name that contains the specifics geometries
- \param actRep geometrical representation of the first spatial table
- \param actIdsIn identifications of specifics geometries of the first spatial table (object_id)
- \param visGeomTable second spatial table name that contains the others geometries
- \param visRep geometrical representation of the second spatial table
- \param visIdsOut returned with the identications of the resultants geometries (object_id)
- \param db a TeDatabase pointer
- \param relation topological relation that will be computed
- \param visCollTable collection table name that contains a set of geometries of the second spatial table
-*/
-TL_DLL bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn,
- const string& visGeomTable, TeGeomRep visRep, TeKeys& visIdsOut,
- TeDatabase* db, int relation, const string& visCollTable="", TeDatabase* = 0);
-
-//! Return the identications of the geometries of a spatial table that have a topological relation with a specific geometry
-/*!
- Calculate the topological relation between all geometries of a spatial table and a specific geometry
- \param actGeomTable spatial table name that contains the geometries
- \param actRep geometrical representation of the spatial table
- \param geom a specific geometry
- \param actIdsOut returned with the identications of the resultants geometries (object_id)
- \param db a TeDatabase pointer
- \param relation topological relation that will be computed
- \param actCollTable collection table name that contains a set of geometries of the spatial table
-*/
-TL_DLL bool TeTopologicalRelation(const string& actGeomTable, TeGeomRep actRep, TeGeometry* geom,
- TeKeys& actIdsOut, TeDatabase* db, int relation, const string& actCollTable="");
-
-//! Return whether the specified topological relation holds between two polygon
-/*!
- \param geom1 a polygon
- \param geom2 another polygon
- \param relation topological relation to be verified
-*/
-TL_DLL bool TeTopologicalRelation(const TePolygon* geom1, const TePolygon* geom2, int relation);
-
-//! Return whether the specified topological relation holds between a polygon and a line
-/*!
- \param geom1 a polygon
- \param geom2 a line
- \param relation topological relation to be verified
-*/
-TL_DLL bool TeTopologicalRelation(const TePolygon* geom1, const TeLine2D* geom2, int relation);
-
-//! Return whether the specified topological relation holds between a polygon and a point
-/*!
- \param geom1 a polygon
- \param geom2 a point
- \param relation topological relation to be verified
-*/
-TL_DLL bool TeTopologicalRelation(const TePolygon* geom1, const TePoint* geom2, int relation);
-
-//! Return whether the specified topological relation holds between two lines
-/*!
- \param geom1 a line
- \param geom2 another line
- \param relation topological relation to be verified
-*/
-TL_DLL bool TeTopologicalRelation(const TeLine2D* geom1, const TeLine2D* geom2, int relation);
-
-//! Return whether the specified topological relation holds between a line and a point
-/*!
- \param geom1 a line
- \param geom2 a point
- \param relation topological relation to be verified
-*/
-TL_DLL bool TeTopologicalRelation(const TeLine2D* geom1, const TePoint* geom2, int relation);
-
-//! Return whether the specified topological relation holds between two points
-/*!
- \param geom1 a point
- \param geom2 another point
- \param relation topological relation to be verified
-*/
-TL_DLL bool TeTopologicalRelation(const TePoint* geom1, const TePoint* geom2, int relation);
-
-//! Return whether the specified topological relation holds between two cells
-/*!
- \param geom1 a cell
- \param geom2 another cell
- \param relation topological relation to be verified
-*/
-TL_DLL bool TeTopologicalRelation(const TeCell* geom1, const TeCell* geom2, int relation);
-
-//! Return whether the specified topological relation holds between a cell and a polygon
-/*!
- \param geom1 a cell
- \param geom2 a polygon
- \param relation topological relation to be verified
-*/
-TL_DLL bool TeTopologicalRelation(const TeCell* geom1, const TePolygon* geom2, int relation);
-
-//! Return whether the specified topological relation holds between a cell and a line
-/*!
- \param geom1 a cell
- \param geom2 a line
- \param relation topological relation to be verified
-*/
-TL_DLL bool TeTopologicalRelation(const TeCell* geom1, const TeLine2D* geom2, int relation);
-
-//! Return whether the specified topological relation holds between a cell and a point
-/*!
- \param geom1 a cell
- \param geom2 a point
- \param relation topological relation to be verified
-*/
-TL_DLL bool TeTopologicalRelation(const TeCell* geom1, const TePoint* geom2, int relation);
-
-//! Returns the geometries of a geometric table (actGeomTable) that are within a specific distance from a point in memory
-/*!
- \param actGeomTable geometric table name
- \param actRep geometric representation of the actGeomTable table
- \param point a point in memory
- \param IdsDistOut structure that will contain the identifiers of the resulted geometries and their distances
- \param db a TeDatabase pointer
- \param max_dist maximum distance
- \param actCollTable collection table name associated with the actGeomTable table
-*/
-TL_DLL bool TeGetWithinDistance(const string& actGeomTable, TeGeomRep actRep, const TeCoord2D& point, TeKeysToDist& IdsDistOut,
- TeDatabase* db, const double& max_dist, const string& actCollTable="");
-
-
-//! Return the area of some specifics geometries of a spatial table
-/*!
- \param actGeomTable spatial table name that contains the geometries
- \param actRep geometrical representation of the spatial table
- \param actIdsIn identifications of the specifics geometries (object_id)
- \param db a TeDatabase pointer
- \param area area returned
-*/
-TL_DLL bool TeGetArea(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, TeDatabase* db, double& area);
-
-
-//! Return the length of some specifics geometries of a spatial table
-TL_DLL bool TeGetLength(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIdsIn, TeDatabase* db, double& length);
-
-
-//! Return the distance between two geometries
-TL_DLL bool TeGetDistance(const string& actGeomTable, TeGeomRep actRep, TeKeys& IdsIn, TeDatabase* db, double& distance);
-
-//! Return the convexhull geometries of specifics geometries of a spatial table
-/*!
- \param actGeomTable spatial table name that contains the geometries
- \param actRep geometrical representation of the spatial table
- \param actIds identifications of the specifics geometries (object_id)
- \param db a TeDatabase pointer
- \param convexHullSet the convexhull geometries returned
-*/
-TL_DLL bool TeGetConvexHull(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TeDatabase* db,
- TePolygonSet& convexHullSet);
-
-
-//! Return the centroids of specifics geometries of a spatial table
-TL_DLL bool TeGetCentroid(const string& actGeomTable, TeGeomRep actRep, TeDatabase* db, TePointSet& centroidSet,
- TeKeys& actIds, const string& actCollTable="");
-
-
-//! Return the buffer
-TL_DLL bool TeGetBuffer(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TeDatabase* db,
- TePolygonSet& bufferSet, double dist);
-
-
-//! Return intersection
-TL_DLL bool TeGetOverlay(const string& actGeomTable, TeGeomRep actRep, TeKeys& actIds, TeDatabase* db,
- TeGeometryVect& geomVect, const short& operation);
-
-/*!
- \brief Clip a raster from a polygon. Return the clipped raster
- \param rasterIn TeRaster pointer that will be clipped
- \param poly polygon that defines the clipping
- \param st strategic to the iterator of the raster
-*/
-TL_DLL TeRaster*
-TeMask (TeRaster* rasterIn, TePolygon& poly, TeStrategicIterator st);
-
-#endif
-
diff --git a/src/terralib/kernel/TeStatistics.h b/src/terralib/kernel/TeStatistics.h
deleted file mode 100644
index a3416f2..0000000
--- a/src/terralib/kernel/TeStatistics.h
+++ /dev/null
@@ -1,664 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeStatistics.h
- \brief This file contains functions for calculate statistics
-*/
-
-#ifndef TeStatistics_H
-#define TeStatistics_H
-
-#include "TeDataTypes.h"
-
-#include <string>
-#include <map>
-
-using namespace std;
-
-/** @defgroup Stat Statistical functions
- @{
- */
-//! vector of statistics
-typedef vector<double> stats;
-
-//! Associate a statistics set for each dimension
-struct TL_DLL TeStatisticsDimension
-{
- int dimension_;
- TeStatisticValMap stat_;
-
- TeStatisticsDimension(int d, TeStatisticValMap& st):
- dimension_(d),
- stat_(st)
- {}
-};
-
-//! vector of the statistics associated with the dimensions
-typedef vector<TeStatisticsDimension> TeStatisticsDimensionVect;
-
-//! map each value to its count: histogram
-typedef map<double, int> TeHistogram;
-
-
-/** Calculates the histrogram of a set of values kept in a data structure
- \param itBegin the iterator to the begin of the data structure
- \param itEnd the iterator to the end of the data structure
- \param histOut to return the histogram
-*/
-template<typename T>
-bool TeCalculateHistogram(const T& itBegin, const T& itEnd, TeHistogram& histOut)
-{
- T it = itBegin;
-
- //initialization
- while(it!=itEnd)
- {
- double val = (*it);
- histOut[val] = 0;
- it++;
- }
-
- it= itBegin;
-
- //calcule histogram
- while(it!=itEnd)
- {
- double val = (*it);
- histOut[val]++;
- it++;
- }
-
- return true;
-}
-
-/** Calculates the statistics of a specific dimension of a data structure
- \param itBegin the iterator to the begin of the data structure
- \param itEnd the iterator to the end of the data structure
- \param stat to return the statistics
- \param dim the dimension of the data structure
-*/
-template<typename It>
-bool TeCalculateStatistics(const It& itBegin, const It& itEnd, TeStatisticValMap& stat, int dim)
-{
- double sum, mean, minValue, maxValue, variance, assim,
- curtose, stDev, coefVar, amplitude, moda, median;
- sum=mean=variance=assim=curtose=stDev=coefVar=amplitude=0.0;
-
- minValue = TeMAXFLOAT;
- maxValue = TeMINFLOAT;
-
- vector<double> values;
- int count=0;
- int countTotal = 0;
- It itt = itBegin;
- while(itt != itEnd)
- {
- double val;
- val = (*itt)[dim];
-
- if(val!=TeMAXFLOAT) // MAXFLOAT is considered invalid value
- {
- values.push_back (val);
- sum += val;
-
- if(minValue>val)
- minValue = val;
- if(maxValue<val)
- maxValue = val;
-
- ++count;
- mean = sum/count;
- }
-
- ++itt;
- ++countTotal;
- }
-
- for(int i=0; i<count; i++)
- {
- double v= values[i];
- variance += pow((v-mean),2);
- assim += pow((v-mean),3);
- curtose += pow((v-mean),4);
- }
-
- if(!count)
- return false;
-
- variance /= count;
- stDev = pow(variance,0.5);
- assim /= count;
- assim /= pow(stDev,3);
- curtose /= count;
- curtose /= pow(stDev,4);
-
- coefVar = (100*stDev)/mean;
- amplitude = maxValue-minValue;
-
- std::sort(values.begin(), values.end());
-
- //calculate median
- if((count%2)==0)
- median = (values[(count/2)]+values[(count/2-1)])/2;
- else
- median = values[(count-1)/2];
-
- //calculate the mode
- TeHistogram histog;
- TeCalculateHistogram(values.begin(),values.end(), histog);
-
- TeHistogram::iterator itHist = histog.begin();
- int nCount=0;
- while(itHist!=histog.end())
- {
- int hCount = itHist->second;
- if (hCount > nCount)
- {
- nCount = hCount;
- moda = itHist->first;
- }
- itHist++;
- }
-
- //fill results
- stat[TeCOUNT] = countTotal;
- stat[TeVALIDCOUNT] = count;
- stat[TeMINVALUE] = minValue;
- stat[TeMAXVALUE] = maxValue;
- stat[TeSUM] = sum;
- stat[TeMEAN] = mean;
- stat[TeSTANDARDDEVIATION] = stDev;
- stat[TeVARIANCE] = variance;
- stat[TeSKEWNESS] = assim;
- stat[TeKURTOSIS] = curtose;
- stat[TeAMPLITUDE] = amplitude;
- stat[TeMEDIAN] = median;
- stat[TeVARCOEFF] = coefVar;
- stat[TeMODE] = moda;
-
- return true;
-}
-
-
-/** Calculates the statistics of a string data structure
- \param itBegin the iterator to the begin of the data structure
- \param itEnd the iterator to the end of the data structure
- \param stat to return the statistics
-*/
-template<typename It>
-bool TeCalculateStatistics(const It& itBegin, const It& itEnd, TeStatisticStringValMap& stat)
-{
- string min, max, val;
- int count = 0;
-
- It it = itBegin;
- int totalCount = 0;
-
- if(it != itEnd)
- min = max = (*it);
- while(it != itEnd)
- {
- val = (*it);
- if(val.empty() == false)
- {
- count++;
- min = MIN(min, val);
- max = MAX(max, val);
- }
- ++it;
- ++totalCount;
- }
-
- stat[TeMINVALUE] = min;
- stat[TeMAXVALUE] = max;
- stat[TeCOUNT] = Te2String(totalCount);
- stat[TeVALIDCOUNT] = Te2String(count);
- return true;
-}
-
-
-/** Calculates the statistics of a data structure
- \param itBegin the iterator to the begin of the data structure
- \param itEnd the iterator to the end of the data structure
- \param stat to return the statistics
-*/
-template<typename It>
-bool TeCalculateStatistics(const It& itBegin, const It& itEnd, TeStatisticValMap& stat)
-{
- double sum, mean, minValue, maxValue, variance, assim,
- curtose, stDev, coefVar, amplitude, moda, median;
- sum=mean=variance=assim=curtose=stDev=coefVar=amplitude=moda=0.0;
-
- minValue = TeMAXFLOAT;
- maxValue = TeMINFLOAT;
-
- vector<double> values;
-
- int totalCount = 0;
- int count=0;
- It itt = itBegin;
- while(itt != itEnd)
- {
- double val = (*itt);
- if(val != TeMAXFLOAT) // MAXFLOAT is considered invalid value
- {
- values.push_back (val);
- sum += val;
- minValue = MIN(minValue, val);
- maxValue = MAX(maxValue, val);
- }
-
- ++itt;
- ++totalCount;
- }
-
- count = values.size();
- mean = sum/count;
-
- for(int i=0; i<count; i++)
- {
- double v= values[i];
- variance += pow((v-mean),2);
- assim += pow((v-mean),3);
- curtose += pow((v-mean),4);
- }
-
- if(!count)
- return false;
-
- variance /= count;
- stDev = pow(variance,0.5);
- assim /= count;
- assim /= pow(stDev,3);
- curtose /= count;
- curtose /= pow(stDev,4);
-
- coefVar = (100*stDev)/mean;
- amplitude = maxValue-minValue;
-
- std::sort(values.begin(), values.end());
-
- //calculate median
- if((count%2)==0)
- median = (values[(count/2)]+values[(count/2-1)])/2;
- else
- median = values[(count-1)/2];
-
- //calculate the mode
- TeHistogram histog;
- TeCalculateHistogram(values.begin(),values.end(), histog);
-
- TeHistogram::iterator itHist = histog.begin();
- int nCount=0;
- while(itHist!=histog.end())
- {
- int hCount = itHist->second;
- if (hCount > nCount)
- {
- nCount = hCount;
- moda = itHist->first;
- }
- itHist++;
- }
-
- //fill results
- stat[TeVALIDCOUNT] = count;
- stat[TeCOUNT] = totalCount;
- stat[TeMINVALUE] = minValue;
- stat[TeMAXVALUE] = maxValue;
- stat[TeSUM] = sum;
- stat[TeMEAN] = mean;
- stat[TeSTANDARDDEVIATION] = stDev;
- stat[TeVARIANCE] = variance;
- stat[TeSKEWNESS] = assim;
- stat[TeKURTOSIS] = curtose;
- stat[TeAMPLITUDE] = amplitude;
- stat[TeMEDIAN] = median;
- stat[TeVARCOEFF] = coefVar;
- stat[TeMODE] = moda;
-
- return true;
-}
-
-
-/** Calculates the statistics of all dimensions of a data structure
- \param itBegin the iterator to the begin of the data structure
- \param itEnd the iterator to the end of the data structure
- \param stat to return the statistics
-*/
-template<typename It>
-bool TeCalculateStatistics(It& itBegin, It& itEnd, TeStatisticsDimensionVect& stat)
-{
-
- vector<double> sum, mean, minValue, maxValue, variance, assim, curtose,
- stDev, coefVar, amplitude, moda, median;
-
- int nb = itBegin.nBands();
-
- //initialization of the vetors
- for (int i=0; i<nb; i++)
- {
- sum.push_back(0.0);
- mean.push_back(0.0);
- variance.push_back(0.0);
- assim.push_back(0.0);
- curtose.push_back(0.0);
- stDev.push_back(0.0);
- coefVar.push_back(0.0);
- amplitude.push_back(0.0);
- median.push_back (0.0);
- moda.push_back (0.0);
- minValue.push_back(TeMAXFLOAT);
- maxValue.push_back(TeMINFLOAT);
- }
-
- map<int,stats> bandValues;
-
- int count=0;
- It itt = itBegin;
-
- while(itt != itEnd)
- {
- for (int j=0; j<nb; j++)
- {
- double val = itt.operator* (j);
- bandValues[j].push_back(val);
- sum[j] += val;
-
- if(minValue[j]>val)
- minValue[j] = val;
- if(maxValue[j]<val)
- maxValue[j] = val;
-
- int size = bandValues[j].size();
- mean[j] = sum[j]/size;
- }
-
- ++itt;
- ++count;
- }
-
- if(!count)
- return false;
-
- for (int jj=0; jj<nb; jj++)
- {
- for(int i=0; i<count; i++)
- {
- double v = bandValues[jj][i];
- variance[jj] += pow((v-mean[jj]),2);
- assim[jj] += pow((v-mean[jj]),3);
- curtose[jj] += pow((v-mean[jj]),4);
- }
-
- variance[jj] /= count;
- stDev[jj] = pow(variance[jj],0.5);
- assim[jj] /= count;
- assim[jj] /= pow(stDev[jj],3);
- curtose[jj] /= count;
- curtose[jj] /= pow(stDev[jj],4);
-
- coefVar[jj] = (100*stDev[jj])/mean[jj];
- amplitude[jj] = maxValue[jj]-minValue[jj];
-
- std::sort(bandValues[jj].begin(), bandValues[jj].end());
-
- //calculate median
- if((count%2)==0)
- median[jj] = ((bandValues[jj][(count/2)])+(bandValues[jj][(count/2-1)]))/2;
- else
- median[jj] = bandValues[jj][(count-1)/2];
-
- //calculate the mode
- TeHistogram histog;
- TeCalculateHistogram(bandValues[jj].begin(),bandValues[jj].end(), histog);
-
- TeHistogram::iterator itHist = histog.begin();
- int nCount=0;
- while(itHist!=histog.end())
- {
- int hCount = itHist->second;
- if (hCount > nCount)
- {
- nCount = hCount;
- moda[jj] = itHist->first;
- }
- itHist++;
- }
-
- //fill results
- TeStatisticValMap statVal;
-
- statVal[TeCOUNT] = count;
- statVal[TeMINVALUE] = minValue[jj];
- statVal[TeMAXVALUE] = maxValue[jj];
- statVal[TeSUM] = sum[jj];
- statVal[TeMEAN] = mean[jj];
- statVal[TeSTANDARDDEVIATION] = stDev[jj];
- statVal[TeVARIANCE] = variance[jj];
- statVal[TeSKEWNESS] = assim[jj];
- statVal[TeKURTOSIS] = curtose[jj];
- statVal[TeAMPLITUDE] = amplitude[jj];
- statVal[TeMEDIAN] = median[jj];
- statVal[TeVARCOEFF] = coefVar[jj];
- statVal[TeMODE] = moda[jj];
-
- TeStatisticsDimension statBand(jj, statVal);
- stat.push_back(statBand);
- }
-
- return true;
-}
-
-
-//! Returns the sum of the elements of a specific dimension
-template <typename It>
-double TeSum (It begin, It end, int dim)
-{
- double sum = 0.;
- while ( begin != end)
- {
- if(((*begin)[dim])!= TeMAXFLOAT) // MAXFLOAT is considered invalid value
- sum += (*begin)[dim];
-
- ++begin;
- }
- return sum;
-}
-
-
-//! Return the sum of the elements
-template <typename It>
-double TeSum (It begin, It end)
-{
- double sum = 0.;
- while ( begin != end)
- {
- if((*begin)!= TeMAXFLOAT) // MAXFLOAT is considered invalid value
- sum += (*begin);
-
- ++begin;
- }
- return sum;
-}
-
-
-//! Calculates the mean (first moment) of the elements of a specific dimension
-template <typename It>
-double TeFirstMoment (It begin, It end, int dim)
-{
- int number = 0;
- double mean = 0.;
- while (begin != end)
- {
- if(((*begin)[dim])!= TeMAXFLOAT) // MAXFLOAT is considered invalid value
- {
- mean += (*begin)[dim];
- number++;
- }
- ++begin;
- }
- return mean /= number;
-}
-
-
-//! Calculates the mean (first moment) of the elements
-template <typename It>
-double TeFirstMoment (It begin, It end)
-{
- int number = 0;
- double mean = 0.;
- while (begin != end)
- {
- if((*begin)!= TeMAXFLOAT) // MAXFLOAT is considered invalid value
- {
- mean += (*begin);
- number++;
- }
- begin++;
- }
- return mean /= number;
-}
-
-
-//! Calculates the second moment
-template <typename It>
-double TeSecondMoment (It begin, It end, double mean)
-{
- int number = 0;
- double SSD = 0; //sum of squares of desviation
-
- while (begin != end)
- {
- if((*begin)!= TeMAXFLOAT) // MAXFLOAT is considered invalid value
- {
- SSD += pow(( (*begin) - mean), 2);
- number++;
- }
- begin++;
- }
- return SSD /= number;
-}
-
-
-//! Calculates the second moment
-template <typename It>
-double TeSecondMoment (It begin, It end, double mean, int dim)
-{
- int number = 0;
- double SSD = 0; //sum of squares of desviation
-
- while (begin != end)
- {
- if(((*begin)[dim])!= TeMAXFLOAT) // MAXFLOAT is considered invalid value
- {
- SSD += pow(((*begin)[dim] - mean), 2);
- number++;
- }
- ++begin;
- }
- return SSD /= number;
-}
-
-
-
-//! calculates the vector with the means of the attributs
-template <typename It, typename T>
-bool TeMeanVector ( It begin, It end, T& result)
-{
- int i = 0;
- int dim = result.size();
- T soma;
-
- for (int m = 0; m < dim ; m++)
- soma.push_back(0.);
-
- while (begin != end)
- {
- for( int j = 0; j < dim; j++)
- {
- if(((*begin)[j]) != TeMAXFLOAT) // MAXFLOAT is considered invalid value
- {
- soma[j]+= (*begin)[j];
- i++;
- }
- else
- soma[j]= TeMAXFLOAT;
- }
- begin++;
- }
-
- for (int k = 0; k < dim; k++)
- {
- if(soma[k] != TeMAXFLOAT)
- result[k] = soma[k]/i;
- else
- result[k] = TeMAXFLOAT;
- }
-
- return true;
-}
-
-//! Calculates the deviations in relation to mean
-template <typename It>
-bool TeDeviation ( It begin, It end, It result, double mean)
-{
- while (begin != end)
- {
- if((*begin) != TeMAXFLOAT) // MAXFLOAT is considered invalid value
- *result = double(*begin) - mean;
- else
- *result = TeMAXFLOAT;
-
- begin++; result++;
- }
- return true;
-}
-
-
-//! calculates the deviations in relation to mean
-template <typename iteratorSet>
-bool TeDeviation ( iteratorSet begin, iteratorSet end, double mean, int index=0)
-{
- //Adds a new attribute in the attribute list of the set
- TeAttribute attrRep;
- attrRep.rep_.name_ = "Z";
- attrRep.rep_.type_ = TeREAL;
- begin->addProperty(attrRep);
-
- while (begin != end)
- {
- double result;
-
- if(((*begin)[index]) != TeMAXFLOAT) // MAXFLOAT is considered invalid value
- result = ((*begin)[index]) - mean;
- else
- result = TeMAXFLOAT;
-
- (*begin).addPropertyValue(Te2String(result, 9));
- ++begin;
- }
- return true;
-}
-/** @} */
-#endif
-
diff --git a/src/terralib/kernel/TeStdFile.cpp b/src/terralib/kernel/TeStdFile.cpp
deleted file mode 100644
index 83d0008..0000000
--- a/src/terralib/kernel/TeStdFile.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeStdFile.h"
-#include "TeException.h"
-
-
-
-// -- Constructor
-
-TeStdFile::TeStdFile ( const string& name, const char* mode ):
- file_ ( 0 ), fileName_ ( name ), mode_ ( mode )
-{
- const char* inputFile = fileName_.c_str();
- if ( name.size() <= 1 )
- throw TeException ( EMPTY_FILE_NAME, name, false );
-
- if ( ( file_ = fopen( inputFile, mode ) ) == 0 )
- {
- bool hasErrno = true;
- throw TeException ( CANNOT_OPEN_FILE, name, hasErrno );
- }
-}
-
-TeStdFile::~TeStdFile()
-{
- if(file_ )
- fclose(file_);
-}
-
-void
-TeStdFile::rewind()
-{
- if (file_)
- fseek(file_,0,0);
-}
diff --git a/src/terralib/kernel/TeStdFile.h b/src/terralib/kernel/TeStdFile.h
deleted file mode 100644
index 8e92810..0000000
--- a/src/terralib/kernel/TeStdFile.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeStdFile.h
- \brief This file contains a class for handling "stdio" files
-*/
-#ifndef __TERRALIB_INTERNAL_STDFILE_H
-#define __TERRALIB_INTERNAL_STDFILE_H
-
-#include "TeDefines.h"
-#include <stdio.h>
-#include <string>
-using namespace std;
-
-//! A class for handling "stdio" files
-/* Provide support for using a file as a class, and
- throws exceptions if things go wrong
- \sa TeException TeAsciiFile
-*/
-class TL_DLL TeStdFile {
-public:
-
-//! Simple constructor taking the file name and the mode of oppening
- TeStdFile(const string& name, const char* mode = "r");
-
- virtual ~TeStdFile();
-
-//! Return true if the file pointer is not at the end of file
- bool isNotAtEOF()
- {
- if ( feof ( file_ ) != 0 )
- return false;
- return true;
- }
-
-// name
- string name ()
- { return fileName_; }
-
-// -- operator ()
- operator FILE*() { return file_; }
-
-// -- returns the file pointer
- FILE* FilePtr() { return file_; }
-
- void rewind();
-
-protected:
-
-// -- File pointer
-
- FILE *file_;
- string fileName_;
- string mode_;
-
-private:
-
-// No copy allowed
- TeStdFile(const TeStdFile&);
- TeStdFile& operator=(const TeStdFile&);
-
-};
-
-#endif
-
diff --git a/src/terralib/kernel/TeTable.cpp b/src/terralib/kernel/TeTable.cpp
deleted file mode 100644
index 909bed6..0000000
--- a/src/terralib/kernel/TeTable.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeTable.h"
-#include "TeUtils.h"
-#include <iostream>
-
-using namespace std;
-
-
-string tableJoin(TeAttrTableVector& vecTable, string geomTable, string attrLink)
-{
- string parClause = "";
- string fromResult = "";
- string firstTable = "";
- string cJoin = "";
-
- TeAttrTableVector::iterator it;
-
- if(geomTable.empty())
- {
- //find the first static table
- it = vecTable.begin();
- while(it!=vecTable.end())
- {
- if((*it).tableType() != TeAttrExternal)
- {
- firstTable = (*it).name();
- attrLink = (*it).linkName();
- break;
- }
- ++it;
- }
- cJoin = " LEFT "; //the first table is a attribute table
- }
- else
- {
- firstTable = geomTable;
- cJoin = " LEFT "; //the first table is a geometry table
- }
-
-
- fromResult += firstTable;
-
-
- //if don�t exist a table static or temporal
- if(firstTable.empty() || attrLink.empty())
- return "";
-
- it = vecTable.begin();
-
- while(it!=vecTable.end())
- {
- if( ((*it).name()!=firstTable) && ((*it).tableType()!=TeAttrExternal))
- {
- fromResult += " "+ cJoin +" JOIN "+ (*it).name() +" ON "+ firstTable;
- fromResult += "."+ attrLink +" = "+ (*it).name() +"."+ (*it).linkName() +")";
- parClause += "(";
- }
-
- else if ((*it).name()!=firstTable)
- {
- int idTableStatic = (*it).relatedTableId();
- string colTableStatic = (*it).relatedAttribute();
- string nameTableStatic;
-
- //verify if static table is in the vector of the attribute tables
- for(unsigned int j=0; j<vecTable.size(); j++)
- {
- if(vecTable[j].id()==idTableStatic)
- {
- nameTableStatic = vecTable[j].name();
- break;
- }
- }
-
- if(nameTableStatic.empty())
- return "";
-
- fromResult += " "+ cJoin +" JOIN "+ (*it).name() +" ON "+ nameTableStatic +"."+ colTableStatic;
- fromResult += " = " + (*it).name() +"."+ (*it).linkName() +")";
- parClause += "(";
- }
-
- ++it;
- cJoin = " LEFT ";
- }
-
- return (parClause + fromResult);
-}
-
-
-// ---- Handle class - TeTable
-
-TeTable::TeTable():
- id_(-1),
- name_(""),
- type_(TeAttrStatic),
- order_(-1),
- attLink_(""),
- attUnique_(""),
- separator_(','),
- attInitialTime_(""),
- attFinalTime_(""),
- attTimeUnit_(TeSECOND),
- relatedTableId_(-1),
- relatedAttribute_("")
-{
- pImpl_ = new TeTableImpl;
- pImpl_->refCount_ = 1;
-}
-
-TeTable::TeTable(const string& name):
- id_(-1),
- name_(name),
- type_(TeAttrStatic),
- order_(-1),
- attLink_(""),
- attUnique_(""),
- separator_(','),
- attInitialTime_(""),
- attFinalTime_(""),
- attTimeUnit_(TeSECOND),
- relatedTableId_(-1),
- relatedAttribute_("")
-{
- pImpl_ = new TeTableImpl;
- pImpl_->refCount_ = 1;
-}
-
-TeTable::TeTable(const string& name, const TeAttributeList& attList, const string& uniqueName,
- const string& linkName, TeAttrTableType tableType):
- id_(-1),
- name_(name),
- type_(tableType),
- order_(-1),
- attList_(attList),
- attLink_(linkName),
- attUnique_(uniqueName),
- separator_(','),
- attInitialTime_(""),
- attFinalTime_(""),
- attTimeUnit_(TeSECOND),
- relatedTableId_(-1),
- relatedAttribute_("")
-{
- pImpl_ = new TeTableImpl;
- pImpl_->refCount_ = 1;
-}
-
-TeTable::~TeTable()
-{
- if ( --(pImpl_->refCount_) <= 0 )
- delete pImpl_;
- attList_.clear();
-}
-
-// Copy constructor
-// copies the representation pointer
-// increments the reference counter
-
-TeTable::TeTable(const TeTable& other)
-{
- id_= other.id_;
- name_ = other.name_;
- type_ = other.type_;
- attLink_ = other.attLink_;
- attUnique_ = other.attUnique_;
- separator_ = other.separator_;
- order_ = other.order_;
- attInitialTime_ = other.attInitialTime_;
- attFinalTime_ = other.attFinalTime_;
- attTimeUnit_ = other.attTimeUnit_;
- attList_.clear();
- attList_.resize(other.attList_.size());
- attList_=other.attList_;
- relatedTableId_ = other.relatedTableId_;
- relatedTableName_ = other.relatedTableName_;
- relatedAttribute_ = other.relatedAttribute_;
- pImpl_ = other.pImpl_;
- pImpl_->refCount_++;
-}
-
-// Operator =
-// Copies the representation pointer
-// Decrements the reference counter of the current object
-// Increments the reference counter for the new object
-TeTable&
-TeTable::operator=(const TeTable& rhs)
-{
- if ( this != &rhs )
- {
- rhs.pImpl_->refCount_++;
-
- if ( --(pImpl_->refCount_) <= 0 )
- delete pImpl_;
- pImpl_ = rhs.pImpl_;
-
- separator_ = rhs.separator_;
- attLink_ = rhs.attLink_;
- attUnique_ = rhs.attUnique_;
- order_ = rhs.order_;
- attInitialTime_ = rhs.attInitialTime_;
- attFinalTime_ = rhs.attFinalTime_;
- attTimeUnit_ = rhs.attTimeUnit_;
- type_ = rhs.type_;
- name_ = rhs.name_;
- attList_.clear();
- attList_ = rhs.attList_;
- relatedTableId_ = rhs.relatedTableId_;
- relatedTableName_ = rhs.relatedTableName_;
- relatedAttribute_ = rhs.relatedAttribute_;
- id_ = rhs.id_;
- }
- return *this;
-}
-
-bool
-TeTable::setTableType( TeAttrTableType attType, int relatedTableId, const string& relatedAttribute)
-{
- type_ = attType;
- if ( attType == TeAttrExternal && relatedTableId > 0 && !relatedAttribute.empty())
- {
- relatedTableId_ = relatedTableId;
- relatedAttribute_ = relatedAttribute;
-
- return true;
- }
- return false;
-}
-
-void
-TeTable::add ( const TeTableRow& row )
-{
- pImpl_->add ( row );
-}
-
-void
-TeTable::setValue (int row, int col, string& val)
-{
- pImpl_->setValue (row,col,val);
-}
-
-unsigned int
-TeTable::size ()
-{
- return pImpl_->size();
-}
-
-void TeTable::clear ()
-{
- pImpl_->clear();
-}
-
-TeTableRow
-TeTable::operator [] (int i)
-{
- return pImpl_->operator [] ( i );
-}
-
-string
-TeTable::operator () ( int row, int col )
-{
- return pImpl_->operator () (row, col );
-}
-
-
-bool
-TeTable::attrLink(TeAttribute& att)
-{
- TeAttributeList::iterator it = attList_.begin();
- while (it != attList_.end())
- {
- if (TeConvertToUpperCase((*it).rep_.name_) == TeConvertToUpperCase(attLink_))
- {
- att = (*it);
- return true;
- }
- ++it;
- }
- return false;
-}
-
-bool
-TeTable::attrUnique(TeAttribute& attr)
-{
- TeAttributeList::iterator it = attList_.begin();
- while(it!=attList_.end())
- {
- if(TeConvertToUpperCase((*it).rep_.name_) == TeConvertToUpperCase(attUnique_))
- {
- attr = (*it);
- return true;
- }
- ++it;
- }
- return false;
-}
-
-int
-TeTable::attrLinkPosition()
-{
- int i = 0;
- TeAttributeList::iterator it = attList_.begin();
- while (it != attList_.end())
- {
- if (TeConvertToUpperCase((*it).rep_.name_) == TeConvertToUpperCase(attLink_))
- return i;
- ++it;
- ++i;
- }
- return -1;
-}
-
-int
-TeTable::attrUniquePosition()
-{
- int i = 0;
- TeAttributeList::iterator it = attList_.begin();
- while (it != attList_.end())
- {
- if (TeConvertToUpperCase((*it).rep_.name_) == TeConvertToUpperCase(attUnique_))
- return i;
- ++it;
- ++i;
- }
- return -1;
-}
-
-bool
-TeTable::attributeNames(vector<string>& attrs)
-{
- attrs.clear();
- TeAttributeList::iterator it = attList_.begin();
- while(it!=attList_.end())
- {
- attrs.push_back((*it).rep_.name_);
- ++it;
- }
- return true;
-}
-
-
-void
-TeTable::primaryKeys(vector<string>& keys)
-{
- keys.empty();
- TeAttributeList::iterator it = attList_.begin();
- while(it!=attList_.end())
- {
- if((*it).rep_.isPrimaryKey_)
- keys.push_back((*it).rep_.name_);
- ++it;
- }
- return;
-}
diff --git a/src/terralib/kernel/TeTable.h b/src/terralib/kernel/TeTable.h
deleted file mode 100644
index 19be8a1..0000000
--- a/src/terralib/kernel/TeTable.h
+++ /dev/null
@@ -1,393 +0,0 @@
- /************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeTable.h
- \brief This file contains class TeTable definitions.
-*/
-
-#ifndef __TERRALIB_INTERNAL_TABLE_H
-#define __TERRALIB_INTERNAL_TABLE_H
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include <string>
-#include <vector>
-#include "TeComposite.h"
-using namespace std;
-
-#include "TeAttribute.h"
-
-class TeTableImpl;
-
-//! A table row is a vector of strings
-typedef vector<string> TeTableRow;
-
-//! The table implementation, this is the body class, of the handle/body idiom
-/*!
- All members are private. This class is used only through the TeTable class
-*/
-class TL_DLL TeTableImpl: public TeComposite<TeTableRow>
-{
-
-friend class TeTable;
-
- int refCount_;
-
- //! Empty constructor
- TeTableImpl(): refCount_(0){}
-
- //! Returns the value of a cell in table
- string operator () ( int row, int col )
- {
- return components_[row].operator[] ( col );
- }
-
- void setValue (int row, int col, string& val)
- {
- TeTableRow tRow = components_[row];
- if (col >= (int)(tRow.size()))
- tRow.resize(col+1);
- tRow[col] = val;
- components_[row] = tRow;
- }
-
-};
-
-//! An attribute table in memory
-/*!
- Instances of this classes represent non-spatial tables, or tables
- that don�t have a spatial data as one of its columns.
- The class stores the table schema and it also can store rows of data.
-
- Rows of data are stored according to handle/hody idiom, to make
- copies optimized.
-
- \sa
- TeAttribute TeTableImpl
-*/
-class TL_DLL TeTable
-{
-public:
- //! Empty constructor
- /*!
- \note
- Instance of TeTable will be created with the following default values:
- \arg name: "" (empty)
- \arg id_: -1 (no database identifier)
- \arg type_: static attribute table
- \arg attList: empty list of attributes
- \arg attLink_: "" (no index to geometries)
- \arg attUnique_: "" (no unique values)
- \arg separator_: ',' comma separator (used to read ASCII tables from files)
- \arg attInitialTime_: "" no initial time information
- \arg attFinalTime_: "" no final time information
- \arg attTimeUnit_: TeYear
- \arg relatedTableId: -1 (no relation to other table)
- \arg relatedTableName: "" (name of the related table)
- \arg relatedAttribute: "" (attribute of the related table)
- */
- TeTable();
-
- //! Constructor by name
- /*!
- \param name table name
- \note
- Instance of TeTable will be created with the following default values:
- \arg id_: -1 (no database identifier)
- \arg tableType_: static attribute table
- \arg attList: empty list of attributes
- \arg attLink_: "" (no index to geometries)
- \arg attUnique_: "" (no unique values)
- \arg separator_: ',' comma separator (used to read ASCII tables from files)
- \arg attInitialTime_: "" no initial time information
- \arg attFinalTime_: "" no final time information
- \arg attTimeUnit_: TeYear
- \arg relatedTableId: -1 (no relation to other table)
- \arg relatedTableName: "" (name of the related table)
- \arg relatedAttribute: "" (attribute of the related table)
- */
- TeTable(const string& name);
-
- //! Constructor by name and attribute list
- /*!
- \param name table name
- \param attList list of attributes
- \param uniqueName column that unique attributes to be used as a primary key
- \param linkName column that links attributes to geometries
- \param tableType type of attribute table
- \note
- Instance of TeTable will be created with the following default values:
- \arg id_: -1 (no database identifier)
- \arg separator_: ',' comma separator (used to read ASCII tables from files)
- \arg attInitialTime_: "" no initial time information
- \arg attFinalTime_: "" no final time information
- \arg attTimeUnit_: TeYear
- \arg relatedTableId: -1 (no relation to other table)
- \arg relatedTableName: "" (name of the related table)
- \arg relatedAttribute: "" (attribute of the related table)
- */
- TeTable(const string& name, const TeAttributeList& attList, const string& uniqueName,
- const string& linkName="", TeAttrTableType tableType=TeAttrStatic);
-
- //! Destructor
- ~TeTable();
-
- //! Copy Constructor
- /*! Copies the representation pointer increments the reference counter */
- TeTable(const TeTable&);
-
- //! Operator =
- /*!
- Copies the representation pointer
- Decrements the reference counter of the current object
- Increments the reference counter for the new object
- */
- TeTable& operator=(const TeTable&);
-
-// -- Methods
-
- //! Returns the table name
- string name()
- { return name_; }
-
- //! Sets the table name
- void name(const string& n)
- { name_ = n; }
-
- //! Returns the unique id of the table in a database
- int id() { return id_; }
-
- //! Sets the id of the table
- void setId(int n) { id_ = n; }
-
- //! Set the position of the table in a join
- void setOrder(int n) { order_ = n; }
-
- //! Get the position of the table in a join
- int getOrder() { return order_;}
-
- //! Defines the list of attributes of this table
- void setAttributeList ( const TeAttributeList& attList)
- { attList_ = attList; }
-
- //! Retrieves the list of attributes of this table
- TeAttributeList& attributeList()
- { return attList_; }
-
- //! Retrieves the list of attribute names of this table
- bool attributeNames(vector<string>& attrs);
-
- //! Returns the type of this attribute table
- TeAttrTableType tableType()
- { return type_; }
-
- //! Sets the table separator
- void setSeparator ( const char& c )
- { separator_ = c ; }
-
- //! Returns the table separator
- char separator ()
- { return separator_; }
-
- //! Sets the table type
- /*!
- \param attType table type
- \note In case of external tables
- \param relatedTableId is the id of the related table
- \param relatedAttribute is column name of the related table
- */
- bool setTableType( TeAttrTableType attType, int relatedTableId=-1, const string& relatedAttribute="");
-
- //! Sets an attribute as the table index.
- /*!
- Index in this context, means an attribute that is a link between
- the attribute table and a spatial table (a table of geometrical
- representation of objects).
- */
- void setLinkName ( const string& linkName ) { attLink_ = linkName;}
-
- //! Returns the name of the column used as link between the attribute table and a spatial table
- string linkName()
- { return attLink_; }
-
- //! Sets the name of the column that has unique values
- void setUniqueName ( const string& uniqueName ) { attUnique_ = uniqueName; }
-
- //! Returns the name of the column used as primary key
- string uniqueName()
- { return attUnique_; }
-
- //! If there is one, returns the attribute used as an index
- /*!
- \param att to return the attribute used as an index
- \return TRUE if there is an index, FALSE otherwise
- */
- bool attrLink(TeAttribute& att);
-
- //! If there is one, returns the attribute used as primary key
- /*!
- \param attr to return the attribute used as primary key
- \return TRUE if there is an index, FALSE otherwise
- */
- bool attrUnique(TeAttribute& attr);
-
- //! Returns the position of the link attribute in the attribute list
- int attrLinkPosition();
-
- //! Returns the position of the unique attribute in the attribute list
- int attrUniquePosition();
-
- /** @name External tables
- The following members are used to manipulate information about tables that
- are external: don�t have a direct link to geometries, but can be linked by
- a column to another attribute table
- */
- //@{
- //! Sets the id of a table to which this is related (only for TeAttrExternal tables)
- void relatedTableId(int id)
- { relatedTableId_ = id; }
-
- //! Returns the id of a related table (only for TeAttrExternal tables)
- int relatedTableId()
- { return relatedTableId_; }
-
- //! Sets the name of a table to which this is related (only for TeAttrExternal tables)
- void relatedTableName(string tableName)
- { relatedTableName_ = tableName; }
-
- //! Returns the name of a related table (only for TeAttrExternal tables)
- string relatedTableName()
- { return relatedTableName_; }
-
- //! Set the name of a column to link to a related table (only for TeAttrExternal tables)
- void relatedAttribute(const string& columnName)
- { relatedAttribute_ = columnName; }
-
- //! Return the column that links to a related table (only for TeAttrExternal tables)
- string relatedAttribute()
- { return relatedAttribute_; }
-
- //@}
-
- /** @name Temporal Attributes
- The following members are used to manipulate the attribute tables with temporal
- information.
- \par Temporal tables contains columns to store a time interval in which the
- attributes (or a row) of an object is valid.
- */
- //@{
-
- //! Sets the name of the column that has the initial time of the validity interval
- void attInitialTime(const string& t)
- { attInitialTime_ = t; }
-
- //! Returns the name of the column that has the initial time of the validity interval
- string attInitialTime()
- { return attInitialTime_; }
-
- //! Sets the name of the column that has the final time of the validity interval
- void attFinalTime(const string& t)
- { attFinalTime_ = t; }
-
- //! Returns the name of the column that has the final time of the validity interval
- string attFinalTime()
- { return attFinalTime_; }
-
- //! Sets the time unit relative to the validity interval
- void attTimeUnit(TeChronon t)
- { attTimeUnit_ = t; }
-
- //! Returns the time unit relative to the validity interval
- TeChronon attTimeUnit()
- { return attTimeUnit_; }
- //@}
-
- /** @name Data in Memory
- The following members are used to manipulate rows of the table in memory
- */
- //@{
- //! Add a row to a table
- void add ( const TeTableRow& row );
-
- //! Returns the i-th row
- TeTableRow operator [] ( int row ) ;
-
- //! Returns the element indexed by (row,col)
- string operator () ( int row, int col );
-
- //! Sets the value of a cell indexed by row x col to value val
- void setValue (int row, int col, string& val);
-
- //! Returns the number of rows in a table
- unsigned int size ();
-
- //! Clears the table storage in memory
- void clear ();
- //@}
-
- //! Returns the primary key names of the table
- void primaryKeys(vector<string>& keys);
-
-private:
-
- int id_; // unique id from a database where this table may be stored
- string name_; // name
- TeAttrTableType type_; // type of table
- int order_; // the table position relative to others in a join
-
- TeAttributeList attList_; // list of attributes
- string attLink_; // attribute that links objects to their spatial representation
- // in case of external table it is used to link to the related table
- string attUnique_; // primary key
- char separator_; // in case of CSV table
-
-// --- The following attributes are relative to tables with temporal information
-
- string attInitialTime_; // initial time attribute
- string attFinalTime_; // final time attribute
- TeChronon attTimeUnit_; // time granularity
-
-// --- The following attributes are relative to external tables
- int relatedTableId_; // id of a table to which this is related
- string relatedTableName_; // name of a table to which this is related
- string relatedAttribute_; // column name of table which this is related
-
-// -- Table Implementation
- TeTableImpl* pImpl_; // the rows of a table
-
-};
-
-//! A vector of tables
-typedef vector<TeTable> TeAttrTableVector;
-
-//! Return the sql join related with the table vector
-TL_DLL string tableJoin(TeAttrTableVector& vecTable, string firstTable="", string attrLink="");
-
-/*! \example createTable.cpp
- Shows how to execute some operations relative to attribute tables.
- */
-
-#endif
-
-
diff --git a/src/terralib/kernel/TeTemporalSeries.cpp b/src/terralib/kernel/TeTemporalSeries.cpp
deleted file mode 100644
index 638a6fb..0000000
--- a/src/terralib/kernel/TeTemporalSeries.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeTemporalSeries.h"
-#include "TeDatabase.h"
-
-
-TeTSEntry::TeTSEntry(const double& val, TeTimeInterval& time, int timeFrame, int nItens, TeTSDataType dType)
-{
- timeFrame_= timeFrame;
- value_ = val;
- type_ = dType;
- nItens_ = nItens;
- time_ = time;
- timeInt_ = -1;
-
- if (time.intervalChronon()==TeMONTHOFYEAR)
- timeInt_ = time.getT1().month();
- else if(time.intervalChronon()==TeDAYOFMONTH)
- timeInt_ = time.getT1().day();
- else if(time.intervalChronon()==TeDAYOFWEEK)
- timeInt_ = time.getT1().weekDay();
- else if(time.intervalChronon()==TeDAYOFYEAR)
- timeInt_ = time.getT1().yearDay();
- else if(time.intervalChronon()==TeHOUROFDAY)
- timeInt_ = time.getT1().hour();
- else if(time.intervalChronon()==TeMINUTEOFHOUR)
- timeInt_ = time.getT1().minute();
- else if(time.intervalChronon()==TeSECONDOFMINUTE)
- timeInt_ = time.getT1().hour();
-}
-
-
-
-TeTSEntry&
-TeTSEntry::operator=(const TeTSEntry& other)
-{
- if ( this != &other )
- {
- timeFrame_ = other.timeFrame_;
- value_ = other.value_;
- time_ = other.time_;
- nItens_ = other.nItens_;
- type_ = other.type_;
- timeInt_ = other.timeInt_;
- }
- return (*this);
-}
-
-TeTSParams&
-TeTSParams::operator=(const TeTSParams& other)
-{
- if ( this != &other )
- {
- type_ = other.type_;
- chronon_ = other.chronon_;
- time_ = other.time_;
- timeOper_ = other.timeOper_;
- spatOper_ = other.spatOper_;
- orTheme_ = other.orTheme_;
- objectId_ = other.objectId_;
- attrTable_ = other.attrTable_;
- attrColumn_ = other.attrColumn_;
- }
- return (*this);
-}
-
-
-TeTemporalSeries&
-TeTemporalSeries::operator=(const TeTemporalSeries& other)
-{
- if ( this != &other )
- {
- TSparams_ = other.TSparams_;
- series_ = other.series_;
- }
- return (*this);
-}
-
-
-bool
-TeTemporalSeries::getTSEntry(TeTSEntry& ts, unsigned int frame)
-{
- if(frame >= (series_.size()))
- return false;
-
- ts = series_[frame];
- return true;
-}
-
-bool
-TeTemporalSeries::buildFrameIntervals()
-{
- // ----- information about temporal table
- TeTable tempTable;
- TeDatabase* db = TSparams_.orTheme_->layer()->database();
-
- if(!TSparams_.orTheme_->getTemporalTable(tempTable))
- return false;
-
- TSparams_.attrTable_ = tempTable.name();
- string initialtime = tempTable.name() +"."+ tempTable.attInitialTime();
- string finaltime = tempTable.name() +"."+ tempTable.attFinalTime();
-
- TeTime iTime, fTime;
-
- // ----- fill time interval
- // ---------------------------- you don�t know how many time frames will be generated
-
- if( (TSparams_.chronon_==TeYEAR) || (TSparams_.chronon_==TeMONTH) ||
- (TSparams_.chronon_==TeDAY) || (TSparams_.chronon_==TeHOUR) ||
- (TSparams_.chronon_==TeMINUTE) || (TSparams_.chronon_==TeSECOND) )
- {
-
- string fromClause, whereClause;
- if(!db->tableExist(TSparams_.orTheme_->collectionAuxTable()))
- {
- TeAttrTableVector atts;
- TSparams_.orTheme_->getAttTables(atts);
- if(atts.empty())
- return false;
-
- fromClause = " FROM " + tableJoin(atts);
- whereClause = TSparams_.orTheme_->sqlWhereRestrictions();
- }
- else
- {
- //fromClause = TSparams_.orTheme_->sqlGridFrom();
- string collAuxTable = TSparams_.orTheme_->collectionAuxTable();
- string uniqueIdName = tempTable.name() +"."+ tempTable.uniqueName();
- string objectIdName = tempTable.name() +"."+ tempTable.linkName();
-
- fromClause = " FROM "+ tempTable.name()+" RIGHT JOIN "+ collAuxTable;
-
- if(tempTable.tableType()==TeFixedGeomDynAttr)
- {
- fromClause += " ON "+ uniqueIdName +" = ";
- fromClause += collAuxTable +".aux0";
- }
- else
- {
- fromClause += " ON "+ objectIdName +" = ";
- fromClause += collAuxTable +".object_id";
- }
- }
-
- string sql = " SELECT min("+ initialtime +"), max("+ finaltime +") ";
- sql += fromClause;
-
- if(!whereClause.empty())
- sql += " WHERE "+ whereClause;
-
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- if((!portal->query(sql)) || (!portal->fetchRow()))
- {
- delete portal;
- return false;
- }
-
- //fill the temporal series
- TeTime date1 = portal->getDate(0);
- TeTime date2 = portal->getDate(1);
- TeTimeInterval interval(date1, date2);
- interval.intervalChronon(TSparams_.chronon_); //min/max
-
- iTime = interval.getT1();
- fTime = interval.getT2();
-
- delete (portal);
- }
-
- // ---------------------------- you know how many time frames will be generated
-
- else if (TSparams_.chronon_==TeMONTHOFYEAR)
- {
- TeTime t1("01/01/2001", TeMONTHOFYEAR, "DDsMMsYYYY");
- TeTime t2("01/12/2001", TeMONTHOFYEAR, "DDsMMsYYYY");
- iTime = t1;
- fTime = t2;
- }
- else if(TSparams_.chronon_==TeDAYOFMONTH)
- {
- TeTime t1("01/01/2001", TeDAYOFMONTH, "DDsMMsYYYY");
- TeTime t2("31/01/2001", TeDAYOFMONTH, "DDsMMsYYYY");
- iTime = t1;
- fTime = t2;
- }
- else if(TSparams_.chronon_==TeDAYOFWEEK)
- {
- TeTime t1("07/01/2001", TeDAYOFWEEK, "DDsMMsYYYY");
- TeTime t2("13/01/2001", TeDAYOFWEEK, "DDsMMsYYYY");
- iTime = t1;
- fTime = t2;
- }
- else if(TSparams_.chronon_==TeDAYOFYEAR)
- {
- TeTime t1("01/01/2001", TeDAYOFYEAR, "DDsMMsYYYY");
- TeTime t2("31/12/2001", TeDAYOFYEAR, "DDsMMsYYYY");
- iTime = t1;
- fTime = t2;
- }
- else if(TSparams_.chronon_==TeHOUROFDAY)
- {
- TeTime t1("01/01/2001 00", TeHOUROFDAY, "DDsMMsYYYYsHH");
- TeTime t2("01/01/2001 23", TeHOUROFDAY, "DDsMMsYYYYsHH");
- iTime = t1;
- fTime = t2;
- }
- else if(TSparams_.chronon_==TeMINUTEOFHOUR)
- {
- TeTime t1("01/01/2001 00:00", TeMINUTEOFHOUR, "DDsMMsYYYYsHHsmm");
- TeTime t2("01/01/2001 00:59", TeMINUTEOFHOUR, "DDsMMsYYYYsHHsmm");
- iTime = t1;
- fTime = t2;
- }
- else if(TSparams_.chronon_==TeSECONDOFMINUTE)
- {
- TeTime t1("01/01/2001 00:00:00", TeSECONDOFMINUTE, "DDsMMsYYYYsHHsmmsSS");
- TeTime t2("01/01/2001 00:00:59", TeSECONDOFMINUTE, "DDsMMsYYYYsHHsmmsSS");
- iTime = t1;
- fTime = t2;
- }
-
- int timeFrame = 0;
- while (iTime <= fTime)
- {
- TeTimeInterval inter(iTime,iTime);
- inter.intervalChronon(TSparams_.chronon_); //min/max
- TeTSEntry tsEntry(0., inter, timeFrame);
- this->series_.push_back(tsEntry);
- ++iTime;
- ++timeFrame;
- }
-
- return true;
-}
-
-bool
-TeTemporalSeries::setTSEntryValue(unsigned int frame, double val, TeTSDataType type)
-{
-
- TeTSEntry entry;
- if(!getTSEntry(entry, frame))
- return false;
-
- double val1 = entry.value_;
- double result = val1;
-
- if(TSparams_.timeOper_==TeCOUNT)
- result += 1;
- else if (TSparams_.timeOper_==TeSUM)
- result += val;
- else if ((TSparams_.timeOper_==TeMAXVALUE) && (val>val1))
- result = val;
- else if((TSparams_.timeOper_==TeMINVALUE) && (val<val1))
- result = val;
- else if(TSparams_.timeOper_==TeMEAN)
- result = (val1+val)/2;
-
- series_[frame].value_ = result;
- series_[frame].type_ = type;
- return true;
-}
-
-
-
-
diff --git a/src/terralib/kernel/TeTemporalSeries.h b/src/terralib/kernel/TeTemporalSeries.h
deleted file mode 100644
index c4630b3..0000000
--- a/src/terralib/kernel/TeTemporalSeries.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeTemporalSeries.h
- \brief This file contains structures and definitions to deal with temporal series.
-*/
-
-#ifndef __TERRALIB_INTERNAL_TS_H
-#define __TERRALIB_INTERNAL_TS_H
-
-
-#include "TeTheme.h"
-#include "TeTimeInterval.h"
-
-
-/*
- ATTR_DYN: a spatial object with a dynamic attribute
- ATTR_DYN_GROUP: some spatial objects with a dynamic attribute table
- EVENT: count of events
- ATTR_EVENT: grouping the attributes of the events
-*/
-//! type of temporal series
-enum TeTSType { TeATTRDYN, TeATTRDYNGROUP, TeEVENT, TeATTREVENT};
-
-
-//! type of the data collected in the serie temporal
-enum TeTSDataType { TeDATA, TeMISSING, TeDMISSING, TeOUTLIER, TeDOUTLIER, TePREDICTION };
-
-
-//! A class that represent each time frame of a temporal series
-class TL_DLL TeTSEntry
-{
-public:
- int timeFrame_; //the time frame of the temporal series
- double value_;
- TeTSDataType type_;
- int nItens_; //number of instances
- TeTimeInterval time_;
- int timeInt_;
-
- //! Constructor
- TeTSEntry():
- timeFrame_(-1),
- value_(0),
- type_(TeMISSING),
- nItens_(0),
- timeInt_(-1)
- {}
-
- //! Constructor
- TeTSEntry(const double& val, TeTimeInterval& time, int timeFrame=-1, int nItens=0, TeTSDataType dType=TeMISSING);
-
-
- //! Copy constructor
- TeTSEntry(const TeTSEntry& other)
- {
- timeFrame_ = other.timeFrame_;
- value_ = other.value_;
- time_ = other.time_;
- nItens_ = other.nItens_;
- type_ = other.type_;
- timeInt_ = other.timeInt_;
- }
-
- //! Operator =
- TeTSEntry& operator=(const TeTSEntry& other);
-
-};
-
-//! Parameters of a temporal series
-class TL_DLL TeTSParams
-{
-public:
- TeTSType type_; //! type of the series
- TeChronon chronon_; //! Chronon used to generated the series
- TeTimeInterval time_; //! Date/Time validy
- TeStatisticType timeOper_; //! operator to temporal grouping - to group objects in each time frame
- TeStatisticType spatOper_; //! operator to spatial grouping - to group instances to each object
-
- // Measures
- TeTheme* orTheme_; //Pointer to the origin theme
- string objectId_;
- string attrTable_; //temporal table
- string attrColumn_; //date column
-
-
- //! Empty constructor
- TeTSParams():
- chronon_(TeNOCHRONON),
- timeOper_(TeNOSTATISTIC),
- spatOper_(TeNOSTATISTIC),
- orTheme_(0),
- objectId_(""),
- attrTable_(""),
- attrColumn_("")
- { }
-
- //! Constructor - - serie type is ATTR_DYN_GROUP, EVENT, ATTR_EVENT
- TeTSParams(TeTheme* theme, TeChronon chr, const string& table, const string& col, TeStatisticType tOper, TeStatisticType sOper):
- chronon_(chr),
- timeOper_(tOper),
- spatOper_(sOper),
- orTheme_(theme),
- objectId_(""),
- attrTable_(table),
- attrColumn_(col)
- {}
-
- //! Constructor - serie type is ATTR_DYN
- TeTSParams(TeTheme* theme, const string& objId, TeChronon chr, const string& table, const string& col, TeStatisticType tOper, TeStatisticType sOper):
- chronon_(chr),
- timeOper_(tOper),
- spatOper_(sOper),
- orTheme_(theme),
- objectId_(objId),
- attrTable_(table),
- attrColumn_(col)
- {}
-
- //! Operator =
- TeTSParams& operator=(const TeTSParams& other);
-};
-
-//! A class to represent temporal series
-class TL_DLL TeTemporalSeries
-{
-public:
- TeTSParams TSparams_;
- vector<TeTSEntry> series_; //! serie
-
- //! Constructor
- TeTemporalSeries():
- TSparams_(TeTSParams())
- {}
-
- //! Constructor
- TeTemporalSeries(TeChronon chr, TeTheme* theme=0, const string& table="", const string& col="", TeStatisticType tOper=TeNOSTATISTIC, TeStatisticType sOper=TeNOSTATISTIC):
- TSparams_(TeTSParams(theme, chr, table, col, tOper, sOper))
- {}
-
- //! Constructor
- TeTemporalSeries(TeTheme* theme, const string& objId, TeChronon chr, const string& table, const string& col, TeStatisticType tOper, TeStatisticType sOper):
- TSparams_(TeTSParams(theme, objId, chr, table, col, tOper, sOper))
- {}
-
- //! Gets the time frame (0 until n-1)
- bool getTSEntry(TeTSEntry& ts, unsigned int frame);
-
- //! Operator =
- TeTemporalSeries& operator=(const TeTemporalSeries& other);
-
- //! Fills the time interval for each frame
- bool buildFrameIntervals();
-
- //! Returns the number of time frames
- int numTimeFrames() { return series_.size(); }
-
- //! Returns the time of each frame
- int timeInt(int frame) { return ((series_[frame-1]).timeInt_); }
-
- //! Sets the temporal series entry value
- bool setTSEntryValue(unsigned int frame, double val, TeTSDataType type);
-
- //! Returns the time of each frame
- TeTimeInterval time(int frame) { return ((series_[frame-1]).time_); }
-
-};
-
-#endif
-
-
-
-
diff --git a/src/terralib/kernel/TeTheme.cpp b/src/terralib/kernel/TeTheme.cpp
deleted file mode 100644
index 71ff862..0000000
--- a/src/terralib/kernel/TeTheme.cpp
+++ /dev/null
@@ -1,2493 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeTheme.h"
-#include "TeDatabase.h"
-#include "TeGroupingAlgorithms.h"
-#include "TeDatabaseUtils.h"
-#include "TeRasterTransform.h"
-#include "TeQuerier.h"
-#include "TeQuerierParams.h"
-
-extern int yyparse(string& sqlOut);
-extern int initParse(const string& strIn, TeDatabase* db);
-
-static TeThemeFactory themeFactory;
-
-TeTheme::TeTheme( const string& name, TeLayer* layer, TeViewNode* parent, const int& view, const int& id)
- : TeAbstractTheme(name, parent, view, id, TeTHEME),
- layer_(layer)
-{
- //layer id
- if(layer)
- {
- layerId_ = layer->id();
- if (layer_->database())
- themeBox_ = layer_->box();
- }
- else
- layerId_ = -1;
-}
-
-TeTheme::TeTheme(const TeViewNodeParams& params) : TeAbstractTheme(params), layer_(0), layerId_(-1)
-{ }
-
-
-// Copy constructor
-TeTheme::TeTheme (const TeTheme& other) :
- TeAbstractTheme(other.viewNodeParams_)
-{
- layerId_ = other.layerId_;
- layer_ = other.layer_; //the same layer pointer
- collectionTable_ = other.collectionTable_;
- collectionAuxTable_ = other.collectionAuxTable_;
-
- attTableVector_ = other.attTableVector_;
- sqlFrom_ = other.sqlFrom_;
- sqlJoin_ = other.sqlGridJoin_;
- sqlGridFrom_ = other.sqlGridFrom_;
- sqlGridJoin_ = other.sqlGridJoin_;
- aliasVector_ = other.aliasVector_;
- sqlAttList_ = other.sqlAttList_;
- sqlNumAttList_ = other.sqlNumAttList_;
-}
-
-
-// Destructor
-TeTheme::~TeTheme ()
-{
- clearAttTableVector();
- clearAttList();
- collectionTable_.clear();
- collectionAuxTable_.clear();
- sqlFrom_.clear();
- sqlJoin_.clear();
- sqlGridFrom_.clear();
- sqlGridJoin_.clear();
- aliasVector_.clear();
- sqlAttList_.clear();
- sqlNumAttList_.clear();
-}
-
-TeTheme&
-TeTheme::operator= (const TeTheme& other)
-{
- if ( this != &other )
- {
- TeAbstractTheme* absTheme = (TeAbstractTheme*)this;
- absTheme->operator=(other);
- layerId_ = other.layerId_;
- layer_ = other.layer_; //the same layer pointer
-
- collectionTable_ = other.collectionTable_;
- collectionAuxTable_ = other.collectionAuxTable_;
-
- attTableVector_ = other.attTableVector_;
- sqlFrom_ = other.sqlFrom_;
- sqlJoin_ = other.sqlGridJoin_;
- sqlGridFrom_ = other.sqlGridFrom_;
- sqlGridJoin_ = other.sqlGridJoin_;
- aliasVector_ = other.aliasVector_;
- sqlAttList_ = other.sqlAttList_;
- sqlNumAttList_ = other.sqlNumAttList_;
- }
- return *this;
-}
-
-
-void TeTheme::layer(TeLayer* layer)
-{
- layer_ = layer;
- if (layer)
- {
- layerId_ = layer->id();
-// themeBox_ = layer_->box();
- }
-}
-
-void
-TeTheme::setSpatialRest(TeBox& box, TeGeomRep rep, TeSpatialRelation relation)
-{
- hasSpatialRes_ = true;
- boxRest_ = box;
- spatialRelation_ = relation;
-
- if(rep==TeGEOMETRYNONE)
- geomRepRest_ = layer()->vectRepres()[0]->geomRep_;
- else
- geomRepRest_ = rep;
-
- geomRest_ = 0;
-}
-
-void
-TeTheme::setSpatialRest(TeGeometry* geom, TeGeomRep rep, TeSpatialRelation relation)
-{
- hasSpatialRes_ = true;
- geomRest_ = geom;
- spatialRelation_ = relation;
-
- if(rep==TeGEOMETRYNONE)
- geomRepRest_ = layer()->vectRepres()[0]->geomRep_;
- else
- geomRepRest_ = rep;
-
- boxRest_ = TeBox();
-}
-
-string
-TeTheme::sqlWhereRestrictions(TeRepresentation* rep)
-{
- TeKeys objs;
- string whereClause= " 1 = 1 ";
- TeDatabase* db = layer()->database();
-
- // load the first representation
- if(!rep)
- rep = (layer()->vectRepres())[0];
-
- // temporal restrictions are applied only to temporal tables
- if(hasTemporalRest())
- {
- string result = "";
-
- initParse(temporalRest(), db);
-
- if(!yyparse(result)) //0: accept 1: reject
- whereClause += " AND "+ result;
- else
- return "";
- }
-
- // we should test if the attribute restriction is valid
- if (hasAttrRest())
- whereClause += " AND "+ attributeRest();
-
- // spatial restriction with other geometry representation
- if (hasSpatialRest() && rep)
- {
- if(boxRestriction().isValid())
- {
- TeBox b = boxRestriction();
- TeGeomRep gRep = rep->geomRep_;
-// whereClause += " AND "+ db->getSQLBoxWhere(boxRestriction(), rep->geomRep_);
- whereClause += " AND "+ db->getSQLBoxWhere(b, gRep);
- }
- else if(geomRestriction())
- {
- string geomTableRest = layer()->tableName(geomRepRestriction());
- TePrecision::instance().setPrecision(TeGetPrecision(layer()->projection()));
-
- if(db->spatialRelation(geomTableRest, geomRepRestriction(), geomRestriction(),
- objs, spatialRelation()))
- {
- string obs;
- for(unsigned int i=0; i<objs.size(); i++)
- {
- if(i!=0)
- obs += ",";
- obs += "'"+ objs[i] +"'";
- }
-
- whereClause += " AND "+ rep->tableName_ +".object_id IN ("+ obs +")";
- }
- }
- }
- return whereClause;
-}
-
-void TeTheme::createRasterVisual(TeRaster* rst)
-{
- if (rasterVisual_)
- delete rasterVisual_;
-
- if (!rst)
- rst = layer_->raster();
-
- if (!rst)
- return;
-
- rasterVisual_ = new TeRasterTransform();
-
- if (rst->params().photometric_[0] == TeRasterParams::TePallete) // raster palette -> uses its palette
- {
- rasterVisual_->setTransfFunction(&TeRasterTransform::Pallete2ThreeBand);
- rasterVisual_->setLutSize(rst->params().lutr_.size());
- return;
- }
-
- if (visibleRep_ & 0x40000000 && // sliced raster -> generate the
- grouping_.groupMode_ == TeRasterSlicing) // appropriate palette
- {
- int band = atoi(grouping_.groupAttribute_.name_.c_str());
- rasterVisual_->setSrcBand(band);
- if (rst->params().dataType_[band] != TeUNSIGNEDCHAR)
- rasterVisual_->generateLUT(legend_, 1024, defaultLegend_.visual(TePOLYGONS)->color());
- else
- rasterVisual_->generateLUT(legend_, 256, defaultLegend_.visual(TePOLYGONS)->color());
- rasterVisual_->setTransfFunction(&TeRasterTransform::LUT2ThreeBand);
- return;
- }
-
- if (rst->params().dataType_[0] != TeUNSIGNEDCHAR) // non unsigned char -> generate linear transformation
- rasterVisual_->setLinearTransfParameters(rst->params().vmin_[0],rst->params().vmax_[0], 0, 255);
-
- if (rst->params().nBands() == 1)
- rasterVisual_->setTransfFunction(&TeRasterTransform::Mono2ThreeBand);
- else if (rst->params().nBands() == 3)
- rasterVisual_->setTransfFunction(&TeRasterTransform::ThreeBand2RGB);
- else
- rasterVisual_->setTransfFunction(&TeRasterTransform::Band2Band);
-}
-
-
-
-bool
-TeTheme::buildCollection(std::string objectId)
-{
- if(id()==0)
- return false;
-
- if(!populateCollection(objectId))
- return false;
-
- if(!populateCollectionAux(objectId))
- return false;
-
- return true;
-}
-
-bool
-TeTheme::buildGrouping(const TeGrouping& g, TeSelectedObjects selectedObjects,
- vector<double>* dValuesVec)
-{
- return buildGrouping(layer_->database(), g, selectedObjects, dValuesVec);
-}
-
-bool
-TeTheme::buildGrouping(TeDatabase* db, const TeGrouping& g, TeSelectedObjects selectedObjects, vector<double>* dValuesVec)
-{
- if(!db)
- return false;
- grouping_ = g;
- unsigned int i;
- vector<TeSlice> slices;
- int nullValues = 0;
- if (grouping_.groupMode_ == TeRasterSlicing)
- {
- int b = atoi(grouping_.groupAttribute_.name_.c_str());
- if (!layer_->raster() ||
- b < 0 ||
- b > layer_->raster()->params().nBands() ||
- grouping_.groupNumSlices_ <= 0)
- return false;
-
- if (grouping_.groupMaxVal_ == TeMINFLOAT)
- grouping_.groupMaxVal_ = layer_->raster()->params().vmax_[b];
-
- if (grouping_.groupMinVal_ == TeMAXFLOAT)
- grouping_.groupMinVal_ = layer_->raster()->params().vmin_[b];
-
- TeGroupByEqualStep(grouping_.groupMinVal_, grouping_.groupMaxVal_,
- grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- }
- else
- {
- if(grouping_.groupAttribute_.name_.empty())
- return false;
-
- //verify what the objects will be considered
- string input;
- if(selectedObjects == TeSelectedByPointing)
- {
- input = " WHERE (grid_status = 1 OR grid_status = 3";
- input += " OR (grid_status is null AND (c_object_status = 1 OR c_object_status = 3)))";
- }
- else if(selectedObjects == TeNotSelectedByPointing)
- {
- input = " WHERE (grid_status = 0 OR grid_status = 2";
- input += " OR (grid_status is null AND (c_object_status = 0 OR c_object_status = 2)))";
- }
- else if(selectedObjects == TeSelectedByQuery)
- {
- input = " WHERE (grid_status = 2 OR grid_status = 3";
- input += " OR (grid_status is null AND (c_object_status = 2 OR c_object_status = 3)))";
- }
- else if(selectedObjects == TeNotSelectedByQuery)
- {
- input = " WHERE (grid_status = 0 OR grid_status = 1";
- input += " OR (grid_status is null AND (c_object_status = 0 OR c_object_status = 1)))";
- }
- else if(selectedObjects == TeGrouped)
- {
- input = " WHERE c_legend_id <> 0";
- }
- else if(selectedObjects == TeNotGrouped)
- {
- input = " WHERE c_legend_id = 0";
- }
-
- TeDatabasePortal* portal = db->getPortal();
- string query;
- bool normal = false;
- string aggrFunc = "";
- if(grouping_.groupFunction_.empty())
- aggrFunc = " MIN";
- else
- aggrFunc = grouping_.groupFunction_;
-
- if(grouping_.groupNormAttribute_.empty())
- {
- query = " SELECT "+ aggrFunc +"("+ grouping_.groupAttribute_.name_ +")";
- }
- else
- {
- query = " SELECT "+ aggrFunc +"("+ grouping_.groupAttribute_.name_ +") / "+ aggrFunc +"("+ grouping_.groupNormAttribute_ + ")";
- normal = true;
- }
- query += sqlGridFrom();
-
- if(selectedObjects != TeAll)
- query += input;
- query += " GROUP BY " + collectionTable() + ".c_object_id";
- if(!portal->query(query) || !portal->fetchRow())
- {
- delete portal;
- return false;
- }
- vector<double> dValues; //inputvect
- vector<string> sValues; //svec
- double mean, sum;
- mean = sum = 0.;
- do
- {
- string val = portal->getData(0);
- string valNorm = Te2String(atof(val.c_str()), grouping_.groupPrecision_);
-
- if (!val.empty())
- {
- if(grouping_.groupMode_== TeUniqueValue)
- {
- if(normal)
- sValues.push_back(valNorm);
- else
- sValues.push_back(val);
- }
- else
- {
- dValues.push_back(atof(valNorm.c_str()));
- sum += atof(valNorm.c_str());
- }
-
- }
- else
- nullValues++;
- }while(portal->fetchRow());
-
- delete portal;
-
- if(dValues.empty() && sValues.empty())
- return false;
-
- if(grouping_.groupMode_== TeEqualSteps)
- TeGroupByEqualStep(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- else if(grouping_.groupMode_== TeQuantil)
- TeGroupByQuantil(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- else if(grouping_.groupMode_== TeStdDeviation)
- {
- string m = Te2String(mean);
- TeGroupByStdDev(dValues.begin(), dValues.end(), grouping_.groupStdDev_, slices, m, grouping_.groupPrecision_);
- }
- else if(grouping_.groupMode_== TeUniqueValue)
- {
- if(grouping_.groupFunction_ == "COUNT")
- TeGroupByUniqueValue(sValues, TeINT, slices, grouping_.groupPrecision_);
- else
- TeGroupByUniqueValue(sValues, grouping_.groupAttribute_.type_, slices, grouping_.groupPrecision_);
- }
-
- if (dValuesVec)
- {
- for (i = 0; i < dValues.size(); ++i)
- dValuesVec->push_back(dValues[i]);
- }
- }
- if(grouping_.groupNullAttr_ && nullValues > 0)
- {
- TeSlice ps;
- ps.count_ = nullValues;
- ps.from_ = "Missing Data";
- slices.push_back(ps);
- grouping_.groupNumSlices_ = slices.size() - 1;
- }
- else
- grouping_.groupNumSlices_ = slices.size();
-
- legend_.clear();
- for(i=0; i<slices.size(); ++i)
- {
- TeLegendEntry legend(slices[i]);
- legend.group(i);
- legend.theme(id());
- legend_.push_back(legend);
- }
- return true;
-}
-
-bool
-TeTheme::buildGrouping(const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec)
-{
- return buildGrouping(layer_->database(), g, chr, mapObjValVec);
-}
-
-bool
-TeTheme::buildGrouping(TeDatabase* db, const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec)
-{
- if(!db || chr == TeNOCHRONON)
- return false;
-
- grouping_ = g;
-
- unsigned int i;
- vector<TeSlice> slices;
- vector<double> dValues; //inputvect
- vector<string> sValues; //svec
- double mean, sum;
- mean = sum = 0.;
- int nullValues = 0;
- string val;
-
- if (grouping_.groupMode_ == TeRasterSlicing)
- {
- int b = atoi(grouping_.groupAttribute_.name_.c_str());
- if (!layer_->raster() ||
- b < 0 ||
- b > layer_->raster()->params().nBands() ||
- grouping_.groupNumSlices_ <= 0)
- return false;
-
- if (grouping_.groupMaxVal_ == TeMINFLOAT)
- grouping_.groupMaxVal_ = layer_->raster()->params().vmax_[b];
-
- if (grouping_.groupMinVal_ == TeMAXFLOAT)
- grouping_.groupMinVal_ = layer_->raster()->params().vmin_[b];
-
- TeGroupByEqualStep(grouping_.groupMinVal_, grouping_.groupMaxVal_,
- grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- }
- else
- {
- string func;
- TeStatisticType statType = TeNOSTATISTIC;
- if (grouping_.groupMode_ == TeUniqueValue && grouping_.groupAttribute_.type_ == TeSTRING)
- func = "MIN";
- else
- func = grouping_.groupFunction_;
-
- if (func == "MIN")
- statType = TeMINVALUE;
- else if (func == "MAX")
- statType = TeMAXVALUE;
- else if (func == "MEAN")
- statType = TeMEAN;
- else if (func == "SUM")
- statType = TeSUM;
- else if (func == "COUNT")
- statType = TeCOUNT;
-
- // Set the flag that indicates the geometries must not be loaded
- bool loadGeometries = false;
-
- // Insert the attributes in a multimap that relates the attribute
- // representation and its statistic type
- TeGroupingAttr attrMMap;
- std::pair<TeAttributeRep, TeStatisticType> attr1 (
- TeAttributeRep(grouping_.groupAttribute_), statType);
- attrMMap.push_back(attr1);
-
- // Set querier parameters
- TeQuerierParams querierParams(loadGeometries, attrMMap);
- querierParams.setParams(this, chr);
-
- TeQuerier querier(querierParams);
-
- // Load instances based on the querier parameters given
- int numFrames = querier.getNumTimeFrames();
- TeSTInstance sti;
- string objId;
- TePropertyVector vec;
- mapObjValVec.resize(numFrames);
-
- for (int frame = 0; frame < numFrames; ++frame)
- {
- if (querier.loadInstances(frame) == false)
- continue;
-
- // Traverse all the instances
- while(querier.fetchInstance(sti))
- {
- objId = sti.objectId();
- sti.getPropertyValue(val, 0);
-
- dValues.push_back(atof(val.c_str()));
- sValues.push_back(val);
- map<string, string>& objValMap = mapObjValVec[frame];
- objValMap.insert(make_pair(objId, val));
- }
- }
-
- if(grouping_.groupMode_== TeEqualSteps)
- TeGroupByEqualStep(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- else if(grouping_.groupMode_== TeQuantil)
- TeGroupByQuantil(dValues.begin(), dValues.end(), grouping_.groupNumSlices_, slices, grouping_.groupPrecision_);
- else if(grouping_.groupMode_== TeStdDeviation)
- {
- string m = Te2String(mean);
- TeGroupByStdDev(dValues.begin(), dValues.end(), grouping_.groupStdDev_, slices, m, grouping_.groupPrecision_);
- }
- else if(grouping_.groupMode_== TeUniqueValue)
- {
- if(grouping_.groupFunction_ == "COUNT")
- TeGroupByUniqueValue(sValues, TeINT, slices, grouping_.groupPrecision_);
- else
- TeGroupByUniqueValue(sValues, grouping_.groupAttribute_.type_, slices, grouping_.groupPrecision_);
- }
- }
-
- if(grouping_.groupNullAttr_ && nullValues > 0)
- {
- TeSlice ps;
- ps.count_ = nullValues;
- ps.from_ = "Missing Data";
- slices.push_back(ps);
- grouping_.groupNumSlices_ = slices.size() - 1;
- }
- else
- grouping_.groupNumSlices_ = slices.size();
-
- legend_.clear();
- for(i=0; i<slices.size(); ++i)
- {
- TeLegendEntry legend(slices[i]);
- legend.group(i);
- legend.theme(id());
- legend_.push_back(legend);
- }
-
- return true;
-}
-
-bool
-TeTheme::getAttTables(TeAttrTableVector& attrs, TeAttrTableType attType)
-{
- TeAttrTableVector::iterator it = attTableVector_.begin();
- while (it != attTableVector_.end())
- {
- if ((attType == TeAllAttrTypes) || ((*it).tableType() == attType))
- attrs.push_back((*it));
- ++it;
- }
- return (!attrs.empty());
-}
-
-bool
-TeTheme::getTable(TeTable& table, const string tableName)
-{
- unsigned int i;
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- if (attTableVector_[i].name() == tableName)
- {
- table = attTableVector_[i];
- return true;
- }
- }
- return false;
-}
-
-bool
-TeTheme::getTemporalTable(TeTable& table)
-{
- TeAttrTableVector::iterator it = attTableVector_.begin();
- while (it != attTableVector_.end())
- {
- if (((*it).tableType() == TeAttrEvent) || ((*it).tableType() == TeFixedGeomDynAttr))
- {
- table = (*it);
- return true;
- }
- ++it;
- }
- return false;
-}
-
-bool
-TeTheme::saveGrouping(TeSelectedObjects selectedObjects)
-{
- return saveGrouping(layer_->database(), selectedObjects);
-}
-
-bool
-TeTheme::saveGrouping(TeDatabase* db, TeSelectedObjects)
-{
- if(!db)
- return false;
-
- vector<TeLegendEntry> legVec = legend_;
-
- // Delete the theme grouping(if any) from the database
- if(db->deleteLegend(id()) == false)
- return false;
-
- if(grouping_.groupMode_ == TeNoGrouping)
- return true;
-
- // Insert the new grouping
- if(db->insertGrouping(id(), grouping_) == false)
- return false;
-
- legend_ = legVec;
- // Update (insert) the new legends
- if (db->updateLegend(legend_) == false)
- return false;
-
- setLegendsForObjects();
-
- if(legend_.size())
- visibleRep_ = visibleRep_ | 0x40000000;
- else
- visibleRep_ = visibleRep_ | 0xbfffffff;
- string upVis = "UPDATE te_theme SET visible_rep=" + Te2String(visibleRep_) + " WHERE theme_id=" + Te2String(id());
- return (db->execute(upVis));
-
- return true;
-}
-
-bool
-TeTheme::loadThemeTables()
-{
- clearAttTableVector();
- TeDatabase* db = this->layer()->database();
- if(!db)
- return false;
- return (db->loadThemeTable(this));
-}
-
-bool
-TeTheme::addThemeTable(TeTable& inputTable)
-{
- bool result = true;
- TeAttrTableType type = inputTable.tableType();
-
- if(inputTable.name() == collectionAuxTable_)
- {
- loadTablesJoin();
- return false;
- }
-
- if (type == TeAttrMedia)
- return false;
-
- if(type != TeAttrStatic)
- {
- bool hasTemporal = false;
- bool hasExtern = false;
-
- TeAttrTableVector::iterator it = attTableVector_.begin();
- while(it!=attTableVector_.end())
- {
- //temporal
- if( (it->tableType()==TeAttrEvent) ||
- (it->tableType()==TeFixedGeomDynAttr) ||
- (it->tableType()==TeDynGeomDynAttr))
- hasTemporal = true;
-
- //extern
- if((it->tableType())==TeAttrExternal)
- hasExtern = true;
-
- ++it;
- }
-
- if( ((type==TeAttrEvent) ||
- (type==TeFixedGeomDynAttr) ||
- (type==TeDynGeomDynAttr)) && (hasTemporal || hasExtern))
- result = false;
- else if ((type==TeAttrExternal) && hasTemporal)
- result = false;
- }
-
- if(!result)
- return false;
-
- attTableVector_.push_back(inputTable);
- loadAliasVector();
- loadAttrLists();
- loadTablesJoin();
- return true;
-}
-
-void
-TeTheme::addThemeTable(string tableName)
-{
- TeTable table(tableName);
- addThemeTable(table);
-}
-
-bool
-TeTheme::setAttTables(TeAttrTableVector& attrs)
-{
- attTableVector_.clear();
- int countTemporal = 0;
- int countExtern = 0;
- bool result = true;
-
- TeAttrTableVector::iterator it = attrs.begin();
- while(it!=attrs.end())
- {
- //temporal
- if( (it->tableType()==TeAttrEvent) ||
- (it->tableType()==TeFixedGeomDynAttr) ||
- (it->tableType()==TeDynGeomDynAttr))
- ++countTemporal;
-
- //extern
- if(it->tableType()==TeAttrExternal)
- ++countExtern;
-
- if( (it->tableType()==TeAttrMedia) ||
- (countTemporal>0 && countExtern>0) ||
- (countTemporal>1) ||
- (it->name() == collectionAuxTable_) )
- {
- result = false;
- }
- else
- {
- attTableVector_.push_back(*it);
- loadAliasVector();
- loadAttrLists();
- loadTablesJoin();
- }
- ++it;
- }
- return result;
-}
-
-bool
-TeTheme::removeThemeTable(unsigned int index)
-{
- if (index > (attTableVector_.size() - 1))
- return false;
-
- TeAttrTableVector::iterator it;
- it = attTableVector_.begin() + index;
-
- attTableVector_.erase(it);
- loadAliasVector();
- loadAttrLists();
- loadTablesJoin();
- return true;
-}
-
-string
-TeTheme::getAttribute(unsigned int pos)
-{
- unsigned int i;
- unsigned int sumCols = 0, tableCol;
- bool found = false;
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- TeAttributeList& attrList = attTableVector_[i].attributeList();
- if (pos < (sumCols + attrList.size()))
- {
- if (i == 0)
- tableCol = pos;
- else
- tableCol = pos - sumCols;
- found = true;
- break;
- }
- sumCols += attrList.size();
- }
-
- if (found == false)
- return "";
-
- TeAttributeList& attrList = attTableVector_[i].attributeList();
- string attrName = attTableVector_[i].name() + "." + attrList[tableCol].rep_.name_;
- return attrName;
-}
-
-bool
-TeTheme::isIndex(unsigned int pos)
-{
- string fullAttrName = getAttribute(pos);
- if (fullAttrName.empty() == true)
- return false;
-
- size_t idx = fullAttrName.find(".");
- string tableName = fullAttrName.substr(0, idx);
- string attrName = fullAttrName.substr(idx+1);
-
- // Get the representation of a table given an attribute name
- TeTable table;
- if (getTable(table, tableName) == false)
- return false;
-
- // Check if the attribute is index or not
- if(table.uniqueName() == attrName)
- return true;
-
- return false;
-}
-
-bool
-TeTheme::isThemeTable(int tableId)
-{
- bool isThemeTable = false;
- unsigned int i;
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- if (attTableVector_[i].id() == tableId)
- {
- isThemeTable = true;
- break;
- }
- }
- return isThemeTable;
-}
-
-bool
-TeTheme::isThemeTable(string tableName)
-{
- bool isThemeTable = false;
- for (unsigned int i = 0; i < attTableVector_.size(); ++i)
- {
- if (attTableVector_[i].name() == tableName)
- {
- isThemeTable = true;
- break;
- }
- }
- return isThemeTable;
-}
-
-string
-TeTheme::getTableName(const string& attrName)
-{
- string tableName;
- size_t pos = attrName.find(".");
-
- if (pos != string::npos)
- return tableName = attrName.substr(0, pos);
-
- for (unsigned int i = 0; i < attTableVector_.size(); ++i)
- {
- TeAttributeList& attrList = attTableVector_[i].attributeList();
- for (unsigned j = 0; j < attrList.size(); ++j)
- {
- if (attrList[j].rep_.name_ == attrName)
- {
- tableName = attTableVector_[i].name();
- return tableName;
- }
- }
- }
-
- return tableName;
-}
-
-
-bool
-TeTheme::deleteGrouping()
-{
- TeDatabase* db = layer_->database();
- if(!db)
- return false;
-
- resetGrouping();
-
- //delete te_legend table
- if(!db->deleteLegend (this->id()))
- return false;
-
- //delete te_grouping table
- string sql = "DELETE FROM te_grouping WHERE theme_id= "+ Te2String(this->id());
- db->execute (sql);
-
- return true;
-}
-
-bool
-TeTheme::createCollectionAuxTable()
-{
- return createCollectionAuxTable(layer_->database());
-}
-
-bool
-TeTheme::createCollectionAuxTable(TeDatabase* db)
-{
- unsigned int i, j;
- bool status;
- vector<string> indexes;
-
- if(!db)
- return false;
-
- if(!db->tableExist(collectionTable_))
- return false;
-
- if(db->tableExist(collectionAuxTable_))
- {
- status = db->execute("DROP TABLE " + collectionAuxTable_);
- if(db->tableExist(collectionAuxTable_))
- {
- if(!status)
- return false;
- }
- }
-
- TeAttributeList attList;
-
- TeAttribute at;
- at.rep_.type_ = TeSTRING;
- at.rep_.numChar_ = 50;
- at.rep_.name_ = "object_id";
- attList.push_back(at);
-
- j = 0;
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- if (attTableVector_[i].tableType() == TeAttrExternal ||
- attTableVector_[i].tableType() == TeFixedGeomDynAttr)
- {
- at.rep_.name_ = "aux" + Te2String(j++);
- attList.push_back(at);
- indexes.push_back(at.rep_.name_);
- }
- }
-
- at.rep_.isPrimaryKey_ = true;
- at.rep_.numChar_ = 0;
- at.rep_.name_ = "unique_id";
- at.rep_.isAutoNumber_ = true;
- at.rep_.type_ = TeINT;
- attList.push_back(at);
-
- at.rep_.name_ = "grid_status";
- at.rep_.isPrimaryKey_ = false;
- at.rep_.isAutoNumber_ = false;
- at.rep_.numChar_ = 0;
- attList.push_back(at);
-
- status = db->createTable(collectionAuxTable_,attList);
- if(!status)
- return false;
-
- string idxName = "te_idx_caux"+ Te2String(this->id());
-
- //create index to object_id
- db->createIndex(collectionAuxTable_, idxName+"_objId", "object_id");
-
- for(unsigned int i=0; i<indexes.size(); ++i)
- db->createIndex(collectionAuxTable_, idxName+"_"+indexes[i], indexes[i]);
-
- return true;
-}
-
-bool
-TeTheme::populateCollectionAux(std::string objectId)
-{
- TeDatabase* db = layer_->database();
- if((!db) || (collectionTable_.empty()) || (collectionAuxTable_.empty()))
- return false;
-
- string whereClause;
-
- whereClause = " WHERE 1=1 ";
-
- // Populate the collection auxiliary table
- string ins = "INSERT INTO " + collectionAuxTable_ + " (object_id";
- unsigned int i, j;
- j = 0;
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- if (attTableVector_[i].tableType() == TeAttrExternal ||
- attTableVector_[i].tableType() == TeFixedGeomDynAttr)
- ins += ", aux" + Te2String(j++);
- }
-
- ins += ", grid_status) SELECT c_object_id";
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- if (attTableVector_[i].tableType() == TeAttrExternal ||
- attTableVector_[i].tableType() == TeFixedGeomDynAttr)
- ins += "," + aliasVector()[i] + "." + attTableVector_[i].uniqueName();
- }
-
- ins += ",c_object_status";
-
- //attribute restriction
- if(!generateAttributeRest_.empty())
- whereClause += " AND "+ generateAttributeRest_;
-
- //temporal restriction
- if(!generateTemporalRest_.empty())
- {
- string sqlTemp;
- initParse(generateTemporalRest_, db);
-
- if(!yyparse(sqlTemp)) //0: accept 1: reject
- whereClause += " AND "+ sqlTemp;
- else
- return false;
- }
-
- //spatial restriction is already stored in the collection table
-
- bool usaTemporal = false;
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- if (attTableVector_[i].tableType() == TeFixedGeomDynAttr ||
- attTableVector_[i].tableType() == TeDynGeomDynAttr)
- usaTemporal = true;
- }
- loadThemeTablesJoin();
- string result = ins + sqlFrom() + whereClause + " ";
- if (!objectId.empty() && !whereClause.empty())
- result += " AND c_object_id = '"+objectId+"'";
- if (!db->execute(result))
- return false;
-
- if(usaTemporal) // filter collection table
- {
- string s = "DELETE FROM " + collectionTable_ + " WHERE c_object_id NOT IN";
- s += " (SELECT DISTINCT object_id FROM " + collectionAuxTable_ + ")";
- return(db->execute(s));
- }
- return true;
-}
-
-
-bool
-TeTheme::locatePolygon (TeCoord2D &pt, TePolygon &polygon, const double& tol)
-{
- if (!layer()->database() || collectionTable().empty())
- return false;
-
- string geomTable = layer()->tableName(TePOLYGONS);
- string sqlFrom = " "+ geomTable +" INNER JOIN " + collectionTable();
- sqlFrom += " ON "+ collectionTable() +".c_object_id = "+ geomTable +".object_id ";
-
- if(!layer()->database()->locatePolygon(sqlFrom, pt, polygon, tol))
- return false;
-
- return true;
-}
-
-
-bool
-TeTheme::locatePolygonSet (TeCoord2D &pt, double tol, TePolygonSet &polygons)
-{
- if (!layer()->database() || collectionTable().empty())
- return false;
-
- string geomTable = layer()->tableName(TePOLYGONS);
- string sqlFrom = " "+ geomTable +" INNER JOIN " + collectionTable();
- sqlFrom += " ON "+ collectionTable() +".c_object_id = "+ geomTable +".object_id ";
-
- if(!layer()->database()->locatePolygonSet(sqlFrom, pt, tol, polygons))
- return false;
-
- return true;
-}
-
-bool
-TeTheme::locateLine (TeCoord2D &pt, TeLine2D &line, const double& tol)
-{
- if (!layer()->database() || collectionTable().empty())
- return false;
-
- string geomTable = layer()->tableName(TeLINES);
- string sqlFrom = " "+ geomTable +" INNER JOIN " + collectionTable();
- sqlFrom += " ON "+ collectionTable() +".c_object_id = "+ geomTable +".object_id ";
-
- if(!layer()->database()->locateLine(sqlFrom, pt, line, tol))
- return false;
-
- return true;
-}
-
-bool
-TeTheme::locatePoint (TeCoord2D &pt, TePoint &point, const double& tol)
-{
- if (!layer()->database() || collectionTable().empty())
- return false;
-
- string geomTable = layer()->tableName(TePOINTS);
- string sqlFrom = " "+ geomTable +" INNER JOIN " + collectionTable();
- sqlFrom += " ON "+ collectionTable() +".c_object_id = "+ geomTable +".object_id ";
-
- if(!layer()->database()->locatePoint(sqlFrom, pt, point, tol))
- return false;
-
- return true;
-}
-
-bool
-TeTheme::locateCell (TeCoord2D &pt, TeCell &cell, const double& tol)
-{
- if (!layer()->database() || collectionTable().empty())
- return false;
-
- string geomTable = layer()->tableName(TeCELLS);
- string sqlFrom = " "+ geomTable +" INNER JOIN " + collectionTable();
- sqlFrom += " ON "+ collectionTable() +".c_object_id = "+ geomTable +".object_id ";
-
- if(!layer()->database()->locateCell(sqlFrom, pt, cell, tol))
- return false;
-
- return true;
-}
-
-//------------------------------ protected methods
-void
-TeTheme::loadAliasVector()
-{
- unsigned int i, count;
- TeTable table;
- multimap<string, int> tableMMap;
-
- aliasVector_.clear();
-
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- table = attTableVector_[i];
-
- if (table.tableType() != TeAttrExternal)
- aliasVector_.push_back(table.name());
- else
- {
- count = tableMMap.count(table.name());
- if (count == 0)
- aliasVector_.push_back(table.name());
- else
- aliasVector_.push_back(table.name() + "_" + Te2String(count));
-
- tableMMap.insert(multimap<string,int>::value_type(table.name(), ++count));
- }
- }
-}
-
-string
-TeTheme::sqlGridFrom(const string& geomTable)
-{
- if(geomTable.empty())
- return sqlGridFrom_;
-
- string result;
- loadTablesJoin(geomTable);
- result = sqlGridFrom_;
- loadTablesJoin();
- return result;
-}
-
-bool
-TeTheme::generateLabelPositions(const std::string& objectId)
-{
- TeDatabase* db = layer()->database();
- if(!db)
- return false;
-
- return (db->generateLabelPositions(this, objectId));
-}
-
-void
-TeTheme::loadTablesJoin(const string& geomTable) //sqlGridFrom and sqlGridJoin
-{
- unsigned int i, count;
- multimap<string, int> tableMMap;
- TeTable table;
- bool hasExternalTable = false;
-
- // Set the new sqlGridFrom_ clause and the new sqlGridJoin_ string
- sqlGridFrom_.clear();
- sqlGridJoin_.clear();
-
- TeAttrTableVector tableVec;
- vector<string> aliasVec;
-
- if(!geomTable.empty())
- {
- TeTable table;
- table.name(geomTable);
- table.setLinkName("object_id");
- table.setUniqueName("object_id");
- table.setTableType(TeAttrStatic);
- tableVec.push_back(table);
-
- for(i=0; i<attTableVector_.size(); ++i)
- tableVec.push_back(attTableVector_[i]);
-
- aliasVec.push_back(geomTable);
- for(i=0; i<aliasVector_.size(); ++i)
- aliasVec.push_back(aliasVector_[i]);
- }
- else
- {
- tableVec = attTableVector_;
- aliasVec = aliasVector_;
- }
-
- //verify if there is external table
- for (i = 0; i < tableVec.size(); ++i)
- {
- if (tableVec[i].tableType() == TeAttrExternal)
- {
- hasExternalTable = true;
- break;
- }
- }
-
- if(!collectionAuxTable_.empty())
- {
- sqlGridFrom_ = " FROM ";
-
- for (i = 0; i <= tableVec.size(); ++i)
- sqlGridFrom_ += "(";
-
- sqlGridFrom_ += collectionAuxTable_;
- sqlGridJoin_ = "SELECT ";
-
- if(hasExternalTable)
- sqlGridFrom_ += " RIGHT JOIN "+ collectionTable_;
- else
- sqlGridFrom_ += " LEFT JOIN "+ collectionTable_;
-
- sqlGridFrom_ += " ON "+ collectionAuxTable_ +".object_id = "+ collectionTable_ +".c_object_id )";
-
- int numAux = 0;
- for (i = 0; i < tableVec.size(); ++i)
- {
- table = tableVec[i];
- if ((table.tableType()==TeAttrStatic) || (table.tableType()==TeAttrMedia) || (table.tableType()==TeAttrEvent))
- {
- sqlGridFrom_ += " LEFT JOIN " + aliasVec[i];
- sqlGridFrom_ += " ON " + collectionTable_ +".c_object_id = " + aliasVec[i] + "." + table.linkName() +")";
- }
- else if (table.tableType() == TeAttrExternal)
- {
- count = tableMMap.count(table.name());
- if (count == 0)
- sqlGridFrom_ += " LEFT JOIN " + aliasVec[i];
- else
- sqlGridFrom_ += " LEFT JOIN " + table.name() + " AS " + aliasVec[i];
-
- tableMMap.insert(multimap<string,int>::value_type(table.name(), ++count));
- sqlGridFrom_ += " ON " + collectionAuxTable_ + ".aux" + Te2String(numAux++) +" = "+ aliasVec[i] +"."+ table.uniqueName() +")";
- }
- else
- {
- sqlGridFrom_ += " LEFT JOIN " + aliasVec[i];
- sqlGridFrom_ += " ON " + collectionAuxTable_ + ".aux" + Te2String(numAux++) +" = "+ aliasVec[i] +"."+ table.uniqueName() +")";
- }
-
- sqlGridJoin_ += aliasVec[i] + ".*,";
- }
-
- sqlGridJoin_ += collectionTable_ + ".*, " + collectionAuxTable_ + ".* " + sqlGridFrom_;
- }
-
- loadThemeTablesJoin();
- }
-
-void TeTheme::loadThemeTablesJoin() ////sqlJoin and sqlFrom
-{
- unsigned int i, count;
- multimap<string, int> tableMMap;
- TeTable table;
-
- // Set the new from clause and the new join string
- sqlFrom_.clear();
- sqlJoin_.clear();
-
- sqlFrom_ = " FROM ";
- sqlJoin_ = "SELECT ";
-
- if (collectionTable_.empty() == false)
- {
- for (i = 0; i < attTableVector_.size(); ++i)
- sqlFrom_ += "(";
- sqlFrom_ += collectionTable_;
-
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- table = attTableVector_[i];
- if (table.tableType() != TeAttrExternal)
- {
- sqlFrom_ += " LEFT JOIN " + aliasVector_[i];
- sqlFrom_ += " ON " + collectionTable_ + ".c_object_id = " + aliasVector_[i] + "." + table.linkName() + ")";
- }
- else
- {
- count = tableMMap.count(table.name());
- if (count == 0)
- sqlFrom_ += " LEFT JOIN " + aliasVector_[i];
- else
- sqlFrom_ += " LEFT JOIN " + table.name() + " AS " + aliasVector_[i];
-
- tableMMap.insert(multimap<string,int>::value_type(table.name(), ++count));
-
- sqlFrom_ += " ON " + table.relatedTableName() + "." + table.relatedAttribute() + " = ";
- sqlFrom_ += aliasVector_[i] + "." + table.linkName() + ")";
- }
-
- sqlJoin_ += aliasVector_[i] + ".*,";
- }
-
- sqlJoin_ += collectionTable_ + ".*" + sqlFrom_;
- }
- else
- {
- if (attTableVector_.size() == 1)
- {
- table = attTableVector_[0];
- sqlFrom_ += table.name();
- sqlJoin_ = "SELECT " + table.name() + ".*" + sqlFrom_;
- }
- else
- {
- for (i = 0; i < attTableVector_.size() - 1; ++i)
- sqlFrom_ += "(";
-
- TeTable firstTable = attTableVector_[0];
- sqlFrom_ += firstTable.name();
- sqlJoin_ += firstTable.name() + ".*,";
- for (i = 1; i < attTableVector_.size(); ++i)
- {
- table = attTableVector_[i];
- sqlFrom_ += " LEFT JOIN " + aliasVector_[i];
- sqlFrom_ += " ON " + firstTable.name() + "." + firstTable.linkName() + " = " + aliasVector_[i] + "." + table.linkName() + ")";
-
- if (i == attTableVector_.size() - 1)
- sqlJoin_ += aliasVector_[i] + ".*";
- else
- sqlJoin_ += aliasVector_[i] + ".*,";
- }
-
- sqlJoin_ += sqlFrom_;
- }
- }
- return;
-}
-
-void
-TeTheme::loadAttrLists()
-{
- // Set the new list of attributes of all the theme tables and its new numerical list,
- unsigned int i, j, count;
- TeTable table;
- multimap<string, int> attrMMap;
- string attrName;
-
- sqlAttList_.clear();
- sqlNumAttList_.clear();
-
- if (layer() == 0)
- return;
- TeDatabase *db = layer()->database();
-
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- table = attTableVector_[i];
- // Set the map of attribute names
- if(table.attributeList().empty())
- db->getAttributeList(table.name(), table.attributeList());
-
- for (j = 0; j < table.attributeList().size(); ++j)
- {
- attrName = table.attributeList()[j].rep_.name_;
- count = attrMMap.count(attrName);
- attrMMap.insert(multimap<string,int>::value_type(attrName, ++count));
- }
- }
-
- // Set the list of attribute names that contains all the attribute names
- // of the theme tables
- for (i = 0; i < attTableVector_.size(); ++i)
- {
- table = attTableVector_[i];
- TeAttributeList attrList=table.attributeList();
- if(attrList.empty())
- db->getAttributeList(table.name(), attrList);
- for (j = 0; j < attrList.size(); ++j)
- {
- attrName = attrList[j].rep_.name_;
- count = attrMMap.count(attrName);
- if (count == 1)
- attrList[j].rep_.name_ = attrName;
- else
- attrList[j].rep_.name_ = aliasVector_[i] + "." + attrName;
-
- sqlAttList_.push_back(attrList[j]);
- }
- }
-
- // Set the list of attribute names that contains all the numeric attribute names
- // of the theme tables
- for(i = 0; i < sqlAttList_.size(); ++i)
- {
- if(sqlAttList_[i].rep_.type_ == TeREAL || sqlAttList_[i].rep_.type_ == TeINT)
- sqlNumAttList_.push_back(sqlAttList_[i]);
- }
-}
-
-void
-TeTheme::setLegendsForObjects()
-{
- if(grouping_.groupMode_ == TeNoGrouping || attTableVector_.empty())
- return;
-
- unsigned int i, j;
- string func, query, oid, val;
-
- TeDatabase *db = layer_->database();
- TeDatabasePortal* portal = db->getPortal();
-
- TeAttrDataType type = grouping_.groupAttribute_.type_;
- string groupingAttr = grouping_.groupAttribute_.name_;
-
- vector<string> oidVec;
- vector<string> oidWithNullValVec;
- vector<string> valVec;
- map<int, set<string> > legObjSetMap;
-
- objLegendMap_.clear();
-
- if(grouping_.groupFunction_.empty())
- func = "MIN";
- else
- func = grouping_.groupFunction_;
-
- if(grouping_.groupFunction_ == "COUNT")
- type = TeINT;
-
- query = "SELECT MIN(" + attTableVector_[0].uniqueName() + ")";
- query += ", " + func + "(" + groupingAttr + ")" + sqlFrom_;
- query += " GROUP BY " + attTableVector_[0].uniqueName();
-
- if(portal->query(query) == false)
- {
- delete portal;
- return;
- }
-
- while(portal->fetchRow())
- {
- oid = portal->getData(0);
- val = portal->getData(1);
- if (val.empty() == false)
- {
- oidVec.push_back(oid);
- valVec.push_back(val);
- }
- else
- oidWithNullValVec.push_back(oid);
- }
-
- unsigned int legSize = legend_.size();
- if(grouping_.groupNullAttr_ && oidWithNullValVec.size() > 0)
- --legSize;
-
- if (grouping_.groupMode_ == TeUniqueValue)
- {
- for (i = 0; i < oidVec.size(); ++i)
- {
- oid = oidVec[i];
- val = valVec[i];
-
- if(type == TeREAL)
- val = Te2String(atof(val.c_str()), grouping_.groupPrecision_);
- else if(type == TeINT)
- val = Te2String(atoi(val.c_str()));
-
- for(j = 0; j < legSize; ++j)
- {
- TeLegendEntry& leg = legend_[j];
- if(val == leg.from())
- {
- objLegendMap_[oid] = leg.id();
- set<string>& oidSet = legObjSetMap[leg.id()];
- oidSet.insert(oid);
- break;
- }
- }
- }
- }
- else
- {
- for (i = 0; i < oidVec.size(); ++i)
- {
- double dVal, dFrom, dTo;
- oid = oidVec[i];
- val = valVec[i];
-
- if (type == TeREAL)
- val = Te2String(atof(val.c_str()), grouping_.groupPrecision_);
-
- for (j = 0; j < legSize; ++j)
- {
- TeLegendEntry& leg = legend_[j];
- if (leg.from().find("mean") != string::npos)
- continue;
-
- dVal = atof(val.c_str());
- dFrom = atof(leg.from().c_str());
- dTo = atof(leg.to().c_str());
-
- if (j < (legSize - 1))
- {
- if(dVal >= dFrom && dVal < dTo)
- {
- objLegendMap_[oid] = leg.id();
- set<string>& oidSet = legObjSetMap[leg.id()];
- oidSet.insert(oid);
- break;
- }
- }
- else
- {
- if(dVal >= dFrom && dVal <= dTo)
- {
- objLegendMap_[oid] = leg.id();
- set<string>& oidSet = legObjSetMap[leg.id()];
- oidSet.insert(oid);
- break;
- }
- }
- }
- }
- }
- delete portal;
-
- // Set the leg id for the objects with null values
- int legId = defaultLegend_.id();
- if (grouping_.groupNullAttr_)
- legId = legend_[legend_.size() - 1].id();
-
- for (i = 0; i < oidWithNullValVec.size(); ++i)
- {
- oid = oidWithNullValVec[i];
- objLegendMap_[oid] = legId;
- set<string>& oidSet = legObjSetMap[legId];
- oidSet.insert(oid);
- }
-
-/*
- // Insert the legends in the te_legend table
- map<int, set<string> >::iterator mapIt;
- set<string>::iterator setIt;
- unsigned char *data;
- string where = " theme_id = " + Te2String(id());
- for (mapIt = legObjSetMap.begin(); mapIt != legObjSetMap.end(); ++mapIt)
- {
- legId = mapIt->first;
- set<string>& oidSet = mapIt->second;
- string whereClause = where;
- whereClause += " AND legend_id = " + Te2String(legId);
- string objStr;
- for (setIt = oidSet.begin(); setIt != oidSet.end(); ++setIt)
- objStr += *setIt + ';';
- data = (unsigned char*)objStr.c_str();
- db->insertBlob("te_legend", "object_list", whereClause, data, objStr.size());
- }
-*/
-}
-
-void
-TeTheme::setOwnLegendsForObjects()
-{
-
-}
-
-bool
-TeTheme::saveLegendInCollection(TeSelectedObjects selectedObjects, std::string objectId)
-{
- return saveLegendInCollection(layer()->database(), selectedObjects, objectId);
-}
-
-bool
-TeTheme::saveLegendInCollection(TeDatabase* db, TeSelectedObjects selectedObjects, std::string objectId)
-{
- unsigned int i;
- if(!db || grouping_.groupMode_ == TeNoGrouping)
- return false;
-
- TeAttrDataType type = grouping_.groupAttribute_.type_;
- TeLegendEntryVector legVec = legend_;
- string groupingAttr = grouping_.groupAttribute_.name_;
-
- string input;
- if(selectedObjects == TeSelectedByPointing)
- {
- input = " WHERE (grid_status = 1 OR grid_status = 3";
- input += " OR (grid_status IS NULL AND (c_object_status = 1 OR c_object_status = 3)))";
- }
- else if(selectedObjects == TeNotSelectedByPointing)
- {
- input = " WHERE (grid_status = 0 OR grid_status = 2";
- input += " OR (grid_status is null AND (c_object_status = 0 OR c_object_status = 2)))";
- }
- else if(selectedObjects == TeSelectedByQuery)
- {
- input = " WHERE (grid_status = 2 OR grid_status = 3";
- input += " OR (grid_status is null AND (c_object_status = 2 OR c_object_status = 3)))";
- }
- else if(selectedObjects == TeNotSelectedByQuery)
- {
- input = " WHERE (grid_status = 0 OR grid_status = 1";
- input += " OR (grid_status is null AND (c_object_status = 0 OR c_object_status = 1)))";
- }
- else if(selectedObjects == TeGrouped)
- input = " WHERE c_legend_id <> 0";
- else if(selectedObjects == TeNotGrouped)
- input = " WHERE c_legend_id = 0";
-
-
- string func;
- if(grouping_.groupFunction_.empty())
- func = " MIN";
- else
- func = grouping_.groupFunction_;
-
- if(grouping_.groupFunction_ == "COUNT")
- type = TeINT;
-
- string query = "SELECT MIN(" + collectionTable_ + ".c_object_id)";
- if(grouping_.groupNormAttribute_.empty())
- query += ", "+ func +"(" + groupingAttr + ")" + sqlGridFrom();
- else
- query += ", "+ func +"(" + groupingAttr + ") / "+ func +"(" + grouping_.groupNormAttribute_ + ")" + sqlGridFrom();
-
- if(selectedObjects != TeAll)
- query += input;
-
- query += " GROUP BY " + collectionTable_ + ".c_object_id";
-
- map<int, vector<string> > legMap;
-
- TeDatabasePortal* portal = db->getPortal();
- if(portal->query(query) == false)
- {
- delete portal;
- return false;
- }
-
- vector<string> idVec;
- vector<string> nullIdVec;
- vector<string> valVec;
- while(portal->fetchRow())
- {
- string val = portal->getData(1);
- string oid = portal->getData(0);
- if (val.empty() == false)
- {
- idVec.push_back(oid);
- valVec.push_back(val);
- }
- else
- nullIdVec.push_back(oid);
- }
- if (grouping_.groupMode_ == TeUniqueValue)
- {
- unsigned int j = 0;
- while( j < idVec.size())
- {
- string val = valVec[j];
- string oid = idVec[j];
- if(type == TeREAL)
- {
- double a = atof(val.c_str());
- val = Te2String(a, grouping_.groupPrecision_);
- }
- else if(type == TeINT)
- {
- int a = atoi(val.c_str());
- val = Te2String(a);
- }
-
- unsigned int siz = legend_.size();
- if(grouping_.groupNullAttr_ && nullIdVec.size() > 0)
- --siz;
- for(i=0; i < siz; i++)
- {
- TeLegendEntry& leg = legend_[i];
- if(val == leg.from())
- {
- legMap[leg.id()].push_back(oid);
- break;
- }
- }
- j++;
- }
- }
- else
- {
- unsigned int j = 0;
- while(j < idVec.size())
- {
- string val = valVec[j];
- string oid = idVec[j];
- if(type == TeREAL)
- {
- double a = atof(val.c_str());
- val = Te2String(a, grouping_.groupPrecision_);
- }
-
- unsigned int siz = legend_.size();
- if(grouping_.groupNullAttr_ && !nullIdVec.empty())
- --siz;
- for(i=0; i < siz; i++)
- {
- TeLegendEntry& leg = legend_[i];
- int f = leg.from().find("mean");
- if(f >= 0)
- continue;
- double dval = atof(val.c_str());
- double dfrom = atof(leg.from().c_str());
- double dto = atof(leg.to().c_str());
- if(i < legend_.size()-1)
- {
- if(dval >= dfrom && dval < dto)
- {
- legMap[leg.id()].push_back(oid);
- break;
- }
- }
- else
- {
- if(dval >= dfrom && dval <= dto)
- {
- legMap[leg.id()].push_back(oid);
- break;
- }
- }
- }
- j++;
- }
- }
- delete portal;
-
- int legId = defaultLegend_.id();
- if (grouping_.groupNullAttr_)
- legId = legend_[legend_.size()-1].id();
- for(i = 0; i < nullIdVec.size(); ++i)
- {
- string oid = nullIdVec[i];
- legMap[legId].push_back(oid);
- }
-
- vector<string> svec;
- map<int, vector<string> > :: iterator it = legMap.begin();
- while(it != legMap.end())
- {
- // --- Generate In Clauses ----
- unsigned int i, j, k, size, chunkSize = 200, nChunks;
- string inClause;
- size = it->second.size();
- if (size % chunkSize)
- nChunks = size / chunkSize + 1;
- else
- nChunks = size / chunkSize;
-
- j = 0;
- for (k = 0; k < nChunks; ++k)
- {
- i = 0;
- inClause = "(";
- while (j < size && i < chunkSize)
- {
- inClause += "'" + db->escapeSequence(it->second[j]) + "',";
- i++;
- j++;
- }
- inClause[inClause.size() - 1] = ')';
- svec.push_back(inClause);
- }
-
- //--- generateInClause
-
- for(i=0; i<svec.size(); ++i)
- {
- string up = "UPDATE " + collectionTable_ + " SET c_legend_id = " + Te2String(it->first);
- up += " WHERE c_object_id IN " + svec[i];
- if (!objectId.empty())
- up += " AND c_object_id='"+objectId+"'";
- if(db->execute(up) == false)
- continue;
- }
- it++;
- svec.clear();
- }
- if(legend_.size())
- visibleRep_ = visibleRep_ | 0x40000000;
- else
- visibleRep_ = visibleRep_ | 0xbfffffff;
- string upVis = "UPDATE te_theme SET visible_rep=" + Te2String(visibleRep_) + " WHERE theme_id=" + Te2String(id());
- return (db->execute(upVis));
-}
-
-bool
-TeTheme::populateCollection(std::string objectId)
-{
- TeDatabase* db = layer_->database();
- if(!db || collectionTable_.empty())
- return false;
-
- if(attTableVector_.empty())
- attTableVector_ = layer_->attrTables();
-
- TeRepresPointerVector& represVec = layer_->vectRepres();
- for (unsigned int i = 0; i < represVec.size(); ++i)
- {
- TeRepresentation* rep = represVec[i];
- if(rep->geomRep_ == TeTEXT)
- continue;
-
- string geomTable = layer_->tableName(rep->geomRep_);
-
- string sqlSelect, sqlFrom, sqlWhere;
-
- sqlSelect = " SELECT DISTINCT "+ geomTable +".object_id ";
- sqlFrom = tableJoin(attTableVector_, geomTable, "object_id");
-
- sqlWhere = " WHERE NOT EXISTS (SELECT * FROM " + collectionTable_;
- sqlWhere += " WHERE "+ collectionTable_ +".c_object_id = "+ geomTable +".object_id )";
- sqlWhere += " AND " + geomTable + ".object_id IS NOT NULL ";
-
- //attribute restriction
- if(!generateAttributeRest_.empty())
- sqlWhere += " AND ("+ generateAttributeRest_ +" )";
-
- //temporal restriction
- if(!generateTemporalRest_.empty())
- {
- string sqlTemp;
- initParse(generateTemporalRest_, db);
-
- if(!yyparse(sqlTemp)) //0: accept 1: reject
- sqlWhere += " AND "+ sqlTemp;
- else
- return false;
- }
-
- TeKeys objs;
-
- //spatial restriction
- if(hasSpatialRes_)
- {
- if(boxRest_.isValid())
- {
- TeBox box = boxRest_;
- sqlWhere += " AND "+ db->getSQLBoxWhere(box, geomRepRest_);
- }
- else if (geomRest_)
- {
- TePrecision::instance().setPrecision(TeGetPrecision(layer()->projection()));
-
- if(db->spatialRelation(geomTable, geomRepRest_, geomRest_, objs, spatialRelation_))
- {
- string obs;
- for(unsigned int i=0; i<objs.size(); i++)
- {
- if(i!=0)
- obs += ",";
- obs += "'"+ objs[i] +"'";
- }
-
- sqlWhere += " AND "+ geomTable +".object_id IN ("+ obs +")";
- }
- }
- }
-
- //populate the collection table
- string popule;
- popule = " INSERT INTO "+ collectionTable_ +" (c_object_id) ";
- popule += sqlSelect +" FROM "+ sqlFrom + sqlWhere;
- if (!objectId.empty())
- {
- if (sqlWhere.length())
- popule += " AND ";
- popule += geomTable +".object_id='" +objectId+ "'";
- }
-
- if (!db->execute(popule))
- {
- //Treats an error in the MySQL database system
- //Error: 1062 SQLSTATE: 23000 (ER_DUP_ENTRY)
- //Message: Duplicate entry '%s' for key %d
- if(db->dbmsName() != "MySQL" || db->errorNum()!=1062)
- return false;
- }
- }
-
-// int defaultLegend = defaultLegend_.id();
- string popule = "UPDATE " + collectionTable_;
- popule += " SET c_legend_id=0, c_legend_own=0, c_object_status=0 ";
-
- if (!objectId.empty())
- popule += " WHERE c_object_id='"+objectId+"'";
-
- if (!db->execute(popule))
- return false;
-
- themeBox_= getThemeBox();
- return true;
-}
-
-
-bool TeTheme::hasObjectsWithoutGeometries(TeGeomRep geomRep)
-{
- if(!layer() || !layer()->database())
- return true;
-
- //get the geometry table
- string geomTable = layer()->tableName(geomRep);
- if(geomTable.empty())
- return true;
-
- TeDatabasePortal* portal = layer()->database()->getPortal();
- if(!portal)
- return true;
-
- //Verify the collection table or attribute tables
- if(layer()->database()->tableExist(collectionTable()))
- {
- string s = " SELECT COUNT(*) ";
- s+= " FROM "+ collectionTable();
- s+= " WHERE NOT EXISTS ";
- s+= " (SELECT * FROM "+ geomTable;
- s+= " WHERE "+ collectionTable() +".c_object_id ";
- s+= " = "+ geomTable +".object_id ) ";
-
- if(!portal->query(s) || !portal->fetchRow())
- {
- delete portal;
- return true;
- }
-
- int numObjs = atoi(portal->getData(0));
- if(numObjs>0)
- {
- delete portal;
- return true;
- }
- }
- else
- {
- //for each static table
- for(unsigned int i=0; i<this->attrTables().size(); ++i)
- {
- if( this->attrTables()[i].tableType() == TeAttrExternal ||
- this->attrTables()[i].tableType() == TeAttrMedia ||
- this->attrTables()[i].tableType() == TeGeocodingData)
- continue;
-
- string s = " SELECT COUNT(*) ";
- s+= " FROM "+ attrTables()[i].name();
- s+= " WHERE NOT EXISTS ";
- s+= " (SELECT * FROM "+ geomTable;
- s+= " WHERE "+ attrTables()[i].name() +"."+ attrTables()[i].linkName();
- s+= " = "+ geomTable +".object_id ) ";
-
- if(!portal->query(s) || !portal->fetchRow())
- {
- delete portal;
- return true;
- }
-
- int numObjs = atoi(portal->getData(0));
- if(numObjs>0)
- {
- delete portal;
- return true;
- }
- }
- }
-
- delete portal;
- return false;
-}
-
-bool TeTheme::removeObjectsWithoutGeometries(TeGeomRep geomRep)
-{
- if(!layer() || !layer()->database() || !layer()->database()->tableExist(collectionTable()))
- return true;
-
- //get the geometry table
- string geomTable = layer()->tableName(geomRep);
- if(geomTable.empty())
- return true;
-
- string del = " DELETE FROM "+ collectionTable();
- del += " WHERE NOT EXISTS ";
- del += " (SELECT * FROM "+ geomTable;
- del += " WHERE "+ collectionTable() +".c_object_id = ";
- del += geomTable +".object_id) ";
-
- if(!layer()->database()->execute(del))
- return false;
-
- del = " DELETE FROM "+ collectionAuxTable();
- del += " WHERE NOT EXISTS ";
- del += " (SELECT * FROM "+ geomTable;
- del += " WHERE "+ collectionAuxTable() +".object_id = ";
- del += geomTable +".object_id) ";
-
- if(!layer()->database()->execute(del))
- return false;
-
- return true;
-}
-
-bool
-TeTheme::save()
-{
- TeDatabase* db = layer()->database();
- if(!db)
- return false;
-
- //insert theme in database
- if(id()==0)
- {
- if(!db->insertTheme(this)) //updateThemeTable
- {
- db->deleteTheme(this->id());
- return false;
- }
- }
-
- //collection table
- if(collectionTable().empty())
- collectionTable("te_collection_"+ Te2String(id()));
-
- if(!db->createCollectionTable(collectionTable_))
- {
- db->deleteTheme(this->id());
- return false;
- }
-
- //collection aux table
- collectionAuxTable(collectionTable() + "_aux");
- addThemeTable(collectionAuxTable());
-
- if(!createCollectionAuxTable())
- {
- db->deleteTheme(this->id());
- return false;
- }
-
- return true;
-}
-
-set<string> TeTheme::getObjects(TeSelectedObjects selectedObjects)
-{
- if (selectedObjects == TeAll)
- {
- if (objectSet_.empty() == false)
- return objectSet_;
- else
- {
- if (attTableVector_.empty())
- return set<string>();
-
- // Set the new set of objects
- if (layer_->hasGeometry(TeRASTER) == false)
- {
- TeDatabase *db = layer_->database();
- TeDatabasePortal* portal = db->getPortal();
-
- string q = "SELECT " + attTableVector_[0].name() + "." + attTableVector_[0].uniqueName() + sqlFrom();
- if (portal->query(q) == false)
- {
- delete portal;
- return set<string>();
- }
-
- while (portal->fetchRow())
- objectSet_.insert(portal->getData(0));
-
- delete portal;
- return objectSet_;
- }
- }
- }
-
- set<string> oidSet;
- map<string, int>::iterator it;
- string oid;
-
- if (selectedObjects == TeSelectedByPointing)
- {
- for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
- {
- oid = it->first;
- if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TePOINTED_QUERIED)
- oidSet.insert(oid);
- }
- }
- else if (selectedObjects == TeNotSelectedByPointing)
- {
- oidSet = getObjects();
- for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
- {
- oid = it->first;
- if (objStatusMap_[oid] == TePOINTED || objStatusMap_[oid] == TePOINTED_QUERIED)
- oidSet.erase(oid);
- }
- }
- else if (selectedObjects == TeSelectedByQuery)
- {
- for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
- {
- oid = it->first;
- if (objStatusMap_[oid] == TeQUERIED || objStatusMap_[oid] == TePOINTED_QUERIED)
- oidSet.insert(oid);
- }
- }
- else if (selectedObjects == TeNotSelectedByQuery)
- {
- oidSet = getObjects();
- for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
- {
- oid = it->first;
- if (objStatusMap_[oid] == TeQUERIED || objStatusMap_[oid] == TePOINTED_QUERIED)
- oidSet.erase(oid);
- }
- }
- else if(selectedObjects == TeGrouped)
- {
- map<string, int>& objLegendMap = getObjLegendMap();
- for (it = objLegendMap.begin(); it != objLegendMap.end(); ++it)
- {
- string oid = it->first;
- if (objLegendMap[oid] != 0)
- oidSet.insert(oid);
- }
- }
- else if(selectedObjects == TeNotGrouped)
- {
- oidSet = getObjects();
- map<string, int>& objLegendMap = getObjLegendMap();
- for (it = objLegendMap.begin(); it != objLegendMap.end(); ++it)
- oidSet.erase(it->first);
- }
- else if(selectedObjects == TeSelectedByPointingOrQuery)
- {
- oidSet = getObjects();
- for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
- {
- oid = it->first;
- if (objStatusMap_[oid] == TeQUERIED || objStatusMap_[oid] == TePOINTED)
- oidSet.insert(oid);
- }
- }
- else if(selectedObjects == TeSelectedByPointingAndQuery )
- {
- oidSet = getObjects();
- for (it = objStatusMap_.begin(); it != objStatusMap_.end(); ++it)
- {
- oid = it->first;
- if (objStatusMap_[oid] == TePOINTED_QUERIED )
- oidSet.insert(oid);
- }
- }
-
- return oidSet;
-}
-
-vector<string> TeTheme::getItemVector(TeSelectedObjects selectedObjects)
-{
- vector<string> itemVec;
-
- //======================================================================================
- //Get all the items
- vector<string> allItemVec;
- string item;
- unsigned int i;
-
- if (selectedObjects == TeAll || selectedObjects == TeNotSelectedByPointing ||
- selectedObjects == TeNotSelectedByQuery)
- {
- vector<TeTable> tableVec;
- getAttTables(tableVec);
-
- string q = "SELECT ";
- for (i = 0; i < tableVec.size(); ++i)
- {
- if (i != 0)
- q += ",";
- q += tableVec[i].uniqueName();
- }
- q += sqlFrom();
-
- TeDatabase* db = layer()->database();
- TeDatabasePortal* portal = db->getPortal();
-
- if (portal->query(q) == false)
- {
- delete portal;
- return itemVec;
- }
-
- while(portal->fetchRow())
- {
- item = portal->getData(tableVec[0].uniqueName());
- for (i = 1; i < tableVec.size(); ++i)
- item += portal->getData(tableVec[i].uniqueName());
- allItemVec.push_back(item);
- }
-
- delete portal;
- }
-
- //======================================================================================
- // Get the items according to the selectedObjects variable
- map<string, int>& itemStatusMap = getItemStatusMap();
- map<string, int>::iterator it;
-
- if (selectedObjects == TeAll)
- return allItemVec;
- else if(selectedObjects == TeSelectedByPointing)
- {
- for (it = itemStatusMap.begin(); it != itemStatusMap.end(); ++it)
- {
- item = it->first;
- if (itemStatusMap[item] == TePOINTED || itemStatusMap[item] == TePOINTED_QUERIED)
- itemVec.push_back(item);
- }
- }
- else if(selectedObjects == TeNotSelectedByPointing)
- {
- for (i = 0; i < allItemVec.size(); ++i)
- {
- item = allItemVec[i];
- if (itemStatusMap[item] == TeDEFAULT || itemStatusMap[item] == TeQUERIED)
- itemVec.push_back(item);
-
- if (itemStatusMap[item] == TeDEFAULT)
- itemStatusMap.erase(item);
- }
- }
- else if(selectedObjects == TeSelectedByQuery)
- {
- for (it = itemStatusMap.begin(); it != itemStatusMap.end(); ++it)
- {
- item = it->first;
- if (itemStatusMap[item] == TeQUERIED || itemStatusMap[item] == TePOINTED_QUERIED)
- itemVec.push_back(item);
- }
- }
- else if(selectedObjects == TeNotSelectedByQuery)
- {
- for (i = 0; i < allItemVec.size(); ++i)
- {
- item = allItemVec[i];
- if (itemStatusMap[item] == TeDEFAULT || itemStatusMap[item] == TePOINTED)
- itemVec.push_back(item);
-
- if (itemStatusMap[item] == TeDEFAULT)
- itemStatusMap.erase(item);
- }
- }
- else if(selectedObjects == TeGrouped)
- {
- set<string> oidSet;
- map<string, int>& objLegendMap = getObjLegendMap();
- for (it = objLegendMap.begin(); it != objLegendMap.end(); ++it)
- {
- string oid = it->first;
- if (objLegendMap[oid] != 0)
- oidSet.insert(oid);
- }
-
- itemVec = getItemVector(oidSet);
- }
- else if(selectedObjects == TeNotGrouped)
- {
- set<string> oidSet = getObjects();
- map<string, int>& objLegendMap = getObjLegendMap();
- for (it = objLegendMap.begin(); it != objLegendMap.end(); ++it)
- oidSet.erase(it->first);
-
- itemVec = getItemVector(oidSet);
- }
- else if(selectedObjects == TeSelectedByPointingOrQuery )
- {
- for (it = itemStatusMap.begin(); it != itemStatusMap.end(); ++it)
- {
- item = it->first;
- if( (itemStatusMap[item] == TePOINTED ) ||
- (itemStatusMap[item] == TeQUERIED ) ) {
-
- itemVec.push_back(item);
- }
- }
- }
-
- return itemVec;
-}
-
-vector<string> TeTheme::getItemVector(const set<string>& oidSet)
-{
- vector<string> itemVec;
- vector<TeTable> tableVec = attrTables();
- set<string>::const_iterator it;
- unsigned int i;
-
- if (tableVec.size() == 1)
- {
- for (it = oidSet.begin(); it != oidSet.end(); ++it)
- itemVec.push_back(*it);
- return itemVec;
- }
-
- // Set the expression that represents the concatenation
- // of the unique names of each theme table
- string concatIndexStr;
- vector<string> indexVec;
- TeDatabase* db = layer()->database();
- for (i = 0; i < tableVec.size(); ++i)
- indexVec.push_back(tableVec[i].name() + "." + tableVec[i].uniqueName());
-
- concatIndexStr = db->getConcatFieldsExpression(indexVec);
-
- vector<string> queryVec;
- string query;
-
-
- set<string>::const_iterator itB = oidSet.begin();
- set<string>::const_iterator itE = oidSet.end();
- vector<string> inClauseVec = generateInClauses(itB, itE, db);
- for (i = 0; i < inClauseVec.size(); ++i)
- {
- query = "SELECT " + tableVec[i].name() + "." + tableVec[i].uniqueName();
- query += ", " + concatIndexStr + sqlFrom() + " WHERE ";
- query += tableVec[i].name() + "." + tableVec[i].uniqueName() + " IN " + inClauseVec[i];
- queryVec.push_back(query);
- }
-
- TeDatabasePortal* portal = db->getPortal();
- for (i = 0; i < queryVec.size(); ++i)
- {
- if (i != 0)
- portal->freeResult();
-
- if(portal->query(queryVec[i]) == false)
- {
- delete portal;
- return itemVec;
- }
-
- while(portal->fetchRow())
- itemVec.push_back(portal->getData(1));
- }
-
- delete portal;
- return itemVec;
-}
-
-
-set<string> TeTheme::getObjects(const vector<string>& itemVec)
-{
- set<string> oidSet;
-
- unsigned int i;
- TeDatabase* db = layer()->database();
-
- // Get the vector of tables of the theme
- vector<TeTable> tableVec;
- getAttTables(tableVec);
-
- vector<string> indexVec;
- for (i = 0; i < tableVec.size(); ++i)
- indexVec.push_back(tableVec[i].name() + "." + tableVec[i].uniqueName());
-
- string concatIndexStr = db->getConcatFieldsExpression(indexVec);
-
- std::vector<string>::const_iterator itemVec_it_begin( itemVec.begin() );
- std::vector<string>::const_iterator itemVec_it_end( itemVec.end() );
-
- vector<string> inClauseVec = generateInClauses( itemVec_it_begin,
- itemVec_it_end, db);
-
- vector<string> queryVec;
- string selectClause = "SELECT " + concatIndexStr + ", ";
- selectClause += tableVec[0].name() + "." + tableVec[0].uniqueName() + " " + sqlFrom();
-
- for (i = 0; i < inClauseVec.size(); ++i)
- {
- string query = selectClause + " WHERE " + concatIndexStr + " IN " + inClauseVec[i];
- queryVec.push_back(query);
- }
-
- TeDatabasePortal *portal = db->getPortal();
- for (i = 0; i < queryVec.size(); ++i)
- {
- if (i != 0)
- portal->freeResult();
-
- if (portal->query(queryVec[i]))
- {
- while (portal->fetchRow())
- oidSet.insert(portal->getData(1));
- }
- }
- delete portal;
-
- return oidSet;
-}
-
-unsigned int
-TeTheme::getNumberOfObjects()
-{
- int numRows = 0;
- string s = "SELECT COUNT(*) " + this->sqlFrom();
- TeDatabasePortal* portal = this->layer()->database()->getPortal();
- if(portal->query(s) && portal->fetchRow() )
- {
- numRows = atoi(portal->getData(0));
- }
- delete portal;
- return numRows;
-}
-
-TeProjection*
-TeTheme::getThemeProjection()
-{
- if (layer_)
- return layer_->projection();
- else
- return 0;
-}
-
diff --git a/src/terralib/kernel/TeTheme.h b/src/terralib/kernel/TeTheme.h
deleted file mode 100644
index 5d01f2a..0000000
--- a/src/terralib/kernel/TeTheme.h
+++ /dev/null
@@ -1,443 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeTheme.h
- \brief This file contains definitions about a theme in TerraLib database
-*/
-#ifndef __TERRALIB_INTERNAL_THEME_H
-#define __TERRALIB_INTERNAL_THEME_H
-
-#include "TeAbstractTheme.h"
-#include "TeLayer.h"
-
-using namespace std;
-
-//! TerraLib definition of a Theme
-/*!
-\par
-A TeTheme represents a collection of objects selected from a TeLayer. This selection is based
-on restrictions that can be non-spatial (e.g. POP > 10000), spatial (e.g. "inside box(0,0,100,100)
-or temporal. The most simple selection is "all" objects of a layer.
-\par
-A TeTheme contains the list of attribute tables of the layer used by a theme.
-\par
-A TeTheme contains the visual presentation parameters for the objects that contains, for
-all of its geometrical representations.
-\par
-A TeTheme can store the parameters associated to how to separate its objects in groups.
-\par
-A TeTheme can store parameters associated to the creation of individual graphs on its objects
-(e.g. pie bars that relate two or more of its attributes).
-\par
-A TeTheme store the range of scales within it should be visible.
-\sa TeView TeTable
-*/
-class TL_DLL TeTheme: public TeAbstractTheme
-{
-public:
- //! Constructor
- TeTheme( const string& name="", TeLayer* layer=0, TeViewNode* parent=0, const int& view=0, const int& id=0);
-
- //! Constructor
- TeTheme(const TeViewNodeParams& params);
-
- //! Copy constructor
- TeTheme (const TeTheme& other);
-
- //! Destructor
- ~TeTheme ();
-
- //! Assignment operator
- TeTheme& operator= (const TeTheme& other);
-
- /** @name Layer
- Methods related to the layer that gives origin to this theme.
- */
- //@{
- //! Returns the id of the source layer
- virtual int layerId()
- { return layerId_; }
-
- //! Sets the id of the source layer
- virtual void layerId(int i)
- { layerId_ = i; }
-
- //! Sets the layer that is the source of objects of the theme
- /*!
- \param layer a pointer to a TeLayer
- */
- virtual void layer(TeLayer* layer);
-
- //! Returns a pointer to the layer from which the theme get its objects
- virtual TeLayer* layer() { return layer_; }
-
- //! Returns a pointer to a projection that is the spatial reference for the objects of this theme: same as of its layer
- virtual TeProjection* getThemeProjection();
- //@}
-
- //! Sets the spatial restriction to be a spatial relation with a box
- virtual void setSpatialRest(TeBox& box, TeGeomRep rep = TeGEOMETRYNONE, TeSpatialRelation relation = TeWITHIN);
-
- //! Sets the spatial restriction to be a spatial relation with a geometry
- virtual void setSpatialRest(TeGeometry* geom, TeGeomRep rep = TeGEOMETRYNONE, TeSpatialRelation relation = TeWITHIN);
-
- //! Returns the clause WHERE derived from the combination of all restricitions (spatial, attribute and temporal)
- virtual string sqlWhereRestrictions(TeRepresentation* rep=0);
-
- //! Creates an appropriate visual presentation to the raster of the theme
- virtual void createRasterVisual(TeRaster* rst=0);
-
- /** @name Collection
- Methods related to the materialization in the database of the theme as a collection of objects
- */
- //@{
- //! Returns the name of a table used to store the ids of the objects belonging to the theme
- virtual string collectionTable() { return collectionTable_; }
-
- //! Sets the name of a table used to store the ids of the objects belonging to the theme
- virtual void collectionTable(const string& s) { collectionTable_ = s; }
-
- //! Returns the name of the collection auxiliary table
- virtual string collectionAuxTable() { return collectionAuxTable_; }
-
- //! Sets the name of the collection auxiliary table
- virtual void collectionAuxTable(string name) { collectionAuxTable_ = name; }
-
- //! Generates a optimized position (x,y) in the spatial extention of each object to position label ou graphs
- virtual bool generateLabelPositions(const std::string& objectId = "");
-
- //! Fills the sqlGridJoin_ and sqlGridFrom_ statements according to the status of the database
- virtual void loadTablesJoin(const string& geomTable="");
-
- /**
- Returns a SQL JOIN statement to get all the attributes of the theme objects,
- the attributes of the collection table, and the attributes of the extended
- collection table
- **/
- virtual string sqlGridJoin() { return sqlGridJoin_; }
-
- /** Returns a FROM clause of a SQL statement to get attributes of the theme objects, the attributes of the
- collection table, and the attributes of the extended collection table
- **/
- virtual string sqlGridFrom(const string& geomTable="");
-
- //! Build the theme collection: materializes the selection described in the theme in a collection table
- virtual bool buildCollection(std::string objectId = "");
-
- //! Create the auxiliar collection table used to represent objects with multiple versions in time
- virtual bool createCollectionAuxTable();
-
- //! Populate the auxiliar collection table used to represent objects with multiple versions in time
- virtual bool populateCollectionAux(std::string objectId = "");
- //@}
-
- /** @name Grouping
- Methods related to grouping of objects of the theme.
- */
- //@{
- //! Save the grouping parameters in memory when there is no chronon
- virtual bool buildGrouping(const TeGrouping& g, TeSelectedObjects selectedObjects = TeAll,
- vector<double>* dValuesVec = 0);
-
- //! Save the grouping parameters in memory when there is chronon
- virtual bool buildGrouping(const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec);
-
- //! Build the grouping and associate each object to its group in the collection table
- virtual bool saveGrouping(TeSelectedObjects selectedObjects = TeAll);
-
- //! Save the theme grouping legends in the collection table
- virtual bool saveLegendInCollection(TeSelectedObjects selectedObjects = TeAll, std::string objectId = "");
-
- //! Set the legend id for each object of the theme
- virtual void setLegendsForObjects();
-
- //! Set the own legend id for each object of the theme
- virtual void setOwnLegendsForObjects();
-
- //! Delete grouping
- virtual bool deleteGrouping();
- //@}
-
- /** @name Attribute Tables
- A theme can use one or more attribute tables of the layer that gives its data.
- These methods are related to the manipulation of these tables.
- */
- //@{
-
- //! Loads the theme tables in the database
- virtual bool loadThemeTables();
-
- //! Add a new attribute table to a theme
- virtual bool addThemeTable (TeTable& table);
-
- //! Add a new attribute table to a theme
- virtual void addThemeTable (string tableName);
-
- //! Verify if an attribute table is part of a theme
- virtual bool isThemeTable(int tableId);
-
- //! Verify if an attribute table is part of a theme
- virtual bool isThemeTable(string tableName);
-
- //! Returns the list of attribute tables used by this theme
- virtual TeAttrTableVector& attrTables()
- { return attTableVector_; }
-
- //! Sets the entire list of attribute tables used by this theme
- virtual bool setAttTables(TeAttrTableVector& attrs);
-
- //! Returns a vector of attribute tables, of a specific type, used by this theme
- virtual bool getAttTables(TeAttrTableVector& attrs, TeAttrTableType attType = TeAllAttrTypes);
-
- //! Returns a representation of an attribute table given name
- virtual bool getTable(TeTable& table, const string tableName);
-
- //! Clears the list of attribute tables used by this theme
- virtual void clearAttTableVector()
- { attTableVector_.clear(); }
-
- //! Returns the temporal attribute table of the theme (TeEvent or TeFixedGeomDynAttr)
- /*
- \note A theme supports only one temporal attribute table
- */
- virtual bool getTemporalTable(TeTable& table);
-
- //! Removes an attribute table from the list of tables of a theme
- virtual bool removeThemeTable(unsigned int index);
-
- //! Returns the the name of an attribute table that contains a given attribute
- virtual string getTableName(const string& attrName);
-
- /**
- Returns the full name of the i-th attribute resulting of the join of all attribute
- tables associated to the theme tables
- */
- virtual string getAttribute(unsigned int i);
-
- /**
- Check if the name of the i-th attribute resulting of the join of all attribute
- tables is an index or not
- */
- virtual bool isIndex(unsigned int i);
-
- //! Returns the list of attributes of theme tables
- virtual TeAttributeList sqlAttList() { return sqlAttList_;}
-
- //! Clears the list of attributes associated to the theme tables
- virtual void clearAttList() {sqlAttList_.clear();}
-
- //! Returns the list of numerical attributes of the theme tables
- virtual TeAttributeList sqlNumAttList() { return sqlNumAttList_;}
-
- //! Clears the list of numerical attributes associated to the theme tables
- virtual void clearNumAttList() {sqlNumAttList_.clear();}
-
- //! Returns a SQL JOIN statement to reach to all attribute tables used by this theme
- virtual string sqlJoin() { return sqlJoin_;}
-
- //! Returns a SQL FROM CLAUSE that gives access to all attribute tables used by this theme
- virtual string sqlFrom() { return sqlFrom_;}
-
- //! Returns the string containing the SQL WHERE clause
- virtual string& sqlWhere() { return sqlWhere_;}
-
- //! Returns the alias vector of the names of the theme tables
- virtual vector<string>& aliasVector() { return aliasVector_; }
-
- //! fill aliasVector_
- virtual void loadAliasVector();
-
- //! Refresh list of attributes of all the theme tables.
- /*
- \note All attributes are stored into sqlAttList_ and numeric attributes are stored into sqlNumAttList_.
- */
- virtual void loadAttrLists();
- //@}
-
- //! Refreshes the bounding box of a theme according to its representation
- /*
- \note This functions is being kept for compatibility reasons with derived
- classes. IT SHOULD NOT BE USED BY APPLICATION USING ONLY THE BASIC CLASS.
- */
- virtual void updateThemeBox() {}
-
- //! Updates the bounding box of a theme (in the database)
- /*
- \note This functions is being kept for compatibility reasons with derived
- classes. IT SHOULD NOT BE USED BY APPLICATION USING ONLY THE BASIC CLASS.
- */
- virtual void updateThemeBox(const TeBox& /*box*/) {}
- //@}
-
- /** @name Locate geometries
- Returns the geometry(ies) of the theme given coordinate
- */
- //@{
- virtual bool locatePolygon (TeCoord2D &pt, TePolygon &polygon, const double& tol = 0.0);
- virtual bool locatePolygonSet (TeCoord2D &pt, double tol, TePolygonSet &polygons);
- virtual bool locateLine (TeCoord2D &pt, TeLine2D &line, const double& tol = 0.0);
- virtual bool locatePoint (TeCoord2D &pt, TePoint &point, const double& tol = 0.0);
- virtual bool locateCell (TeCoord2D &pt, TeCell &c, const double& tol = 0.0);
- //@}
-
- //! Get the set of objects corresponding to the object selection criteria
- virtual set<string> getObjects(TeSelectedObjects selectedObjects = TeAll);
-
- //! Get the set of objects corresponding to the list of items
- virtual set<string> getObjects(const vector<string>& itemVec);
-
- //! Get the set of items corresponding to the object selection criteria
- virtual vector<string> getItemVector(TeSelectedObjects selectedObjects);
-
- //! Get the set of items corresponding to the set of objects
- virtual vector<string> getItemVector(const set<string>& oidSet);
-
- //! Verifies if there are objects without geometries of a specific geometry representation
- virtual bool hasObjectsWithoutGeometries(TeGeomRep geomRep);
-
- //! Removes the objects without geometries of a specific geometry representation
- virtual bool removeObjectsWithoutGeometries(TeGeomRep geomRep);
-
- //! Save the the theme parameters in the database
- virtual bool save();
-
- //! Get the number of objects acessible by this theme
- virtual unsigned int getNumberOfObjects();
-
- //! Save the theme metadata in database. In this case, this metadata is saved by TeDatabase
- virtual bool saveMetadata(TeDatabase*) { return true; }
-
-protected:
-
- //! Create the auxiliar collection table used to represent objects with multiple versions in time
- virtual bool createCollectionAuxTable(TeDatabase* db);
-
- //! Save the grouping parameters in memory when there is no chronon
- virtual bool buildGrouping(TeDatabase* db, const TeGrouping& g, TeSelectedObjects selectedObjects = TeAll,
- vector<double>* dValuesVec = 0);
-
- //! Save the grouping parameters in memory when there is chronon
- virtual bool buildGrouping(TeDatabase* db, const TeGrouping& g, TeChronon chr, vector<map<string, string> >& mapObjValVec);
-
- //! Build the grouping and associate each object to its group in the collection table
- virtual bool saveGrouping(TeDatabase* db, TeSelectedObjects selectedObjects = TeAll);
-
- //! Save the theme grouping legends in the collection table
- virtual bool saveLegendInCollection(TeDatabase* db, TeSelectedObjects selectedObjects = TeAll, std::string objectId = "");
-
- //! Fill the sqlJoin_ and sqlFrom_
- virtual void loadThemeTablesJoin();
-
- //! Populate the collection table based in the theme restrictions
- virtual bool populateCollection(std::string objectId = "");
-
- //! list of attribute tables of the theme
- TeAttrTableVector attTableVector_;
-
- //! List containing all the attributes of the theme tables
- TeAttributeList sqlAttList_;
-
- //! List containing only the numeric attributes of the theme tables
- TeAttributeList sqlNumAttList_;
-
- //! Pointer to the layer that gives origin to this theme
- TeLayer* layer_;
-
- //! Layer id
- int layerId_;
-
- // collection table name
- string collectionTable_;
- string collectionAuxTable_;
-
- // ----------------- theme tables information -----------------
-
- //! clause FROM: join with the theme tables and collection table
- string sqlFrom_;
-
- //! clause SELECT and FROM: join with the theme tables and collection table
- string sqlJoin_;
-
- //! string containing the WHERE clause
- string sqlWhere_;
-
- //! clause FROM: join with the theme tables and auxiliar collection table
- string sqlGridFrom_;
-
- //! clause SELECT and FROM: join with the theme tables and auxiliar collection table
- string sqlGridJoin_;
-
- //! vector of alias to the attribute tables that are used more than once
- vector<string> aliasVector_;
-
- //! Load the theme metadata from database. In this case, this metadata is loaded by TeDatabase
- virtual bool loadMetadata(TeDatabase* ) { return true; }
-
- //! Erase the theme metadata in database. In this case, this metadata is erased by TeDatabase
- virtual bool eraseMetadata(TeDatabase* ) { return true; }
-};
-
-
-//! This class implements a factory to create theme objects.
-/*!
- This class is a factory that create view nodes
- of the type TeTHEME, that is, theme objects.
-
- \sa
- TeViewNodeFactory TeViewNodeParams TeTheme
-*/
-class TL_DLL TeThemeFactory : public TeViewNodeFactory
-{
-public:
- //! Constructor
- TeThemeFactory() : TeViewNodeFactory((int)TeTHEME)
- {}
-
- //! Created theme objects
- TeViewNode* build(TeViewNodeParams* params)
- {
- TeViewNodeParams auxParams = *params;
- return new TeTheme(auxParams);
- }
-
- TeViewNode* build()
- {
- return new TeTheme();
- }
-};
-
-
-/*! \example createTheme.cpp
- Shows how to create themes in TerraLib.
- */
-
-/*! \example themeGrouping.cpp
- Shows how to do a grouping on the objects of a TerraLib theme.
- */
-
-/*! \example rasterSlicing.cpp
- Shows how to create a legend over a raster data, stored in a layer TerraLib.
- */
-
-
-#endif
-
diff --git a/src/terralib/kernel/TeThread.cpp b/src/terralib/kernel/TeThread.cpp
deleted file mode 100644
index f3717a3..0000000
--- a/src/terralib/kernel/TeThread.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-#include "TeThread.h"
-#include "TeAgnostic.h"
-
-TeThread::TeThread()
-{
- init();
-}
-
-TeThread::~TeThread()
-{
- TEAGN_TRUE_OR_THROW( ( threadStatus_ == TeThreadStopped ),
- "Trying to delete a running thread handler instance" )
- freeResources();
-}
-
-bool TeThread::start()
-{
- if( threadStatus_ != TeThreadStopped )
- {
- return false;
- }
- else
- {
- freeResources();
-
-#if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- threadId_ = 0;
- threadHandler_ = 0;
- threadHandler_ = CreateThread(NULL, 0,
- (LPTHREAD_START_ROUTINE)TeThread::startThread,
- (LPVOID)(this), 0, (LPDWORD) &threadId_);
-
- TEAGN_TRUE_OR_RETURN( ( threadHandler_ != 0 ),
- "Thread creation failed" )
-#elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- TEAGN_TRUE_OR_RETURN( ( pthread_attr_init(&threadAttr_) == 0 ),
- "Unable to init thread attributes" )
- TEAGN_TRUE_OR_RETURN( ( pthread_attr_setdetachstate( &threadAttr_,
- PTHREAD_CREATE_JOINABLE ) == 0 ),
- "Unable to set thread detach attribute" );
-
- TEAGN_TRUE_OR_RETURN( ( pthread_create( &threadId_, &threadAttr_,
- TeThread::startThread, (void *) this ) == 0 ),
- "Thread creation failed" )
-#else
-#error "ERROR: Unsupported platform"
-#endif
-
- threadStatus_ = TeThreadRunning;
-
- if( threadCurrPriority_ != TeThreadNormalPriority )
- {
- TEAGN_TRUE_OR_LOG( setPriority(threadCurrPriority_ ),
- "Unable to set thread priority" );
- }
-
- return true;
- }
-}
-
-
-const TeThreadStatus& TeThread::getStatus() const
-{
- return threadStatus_;
-}
-
-const TeThreadPriority& TeThread::getPriority() const
-{
- return threadCurrPriority_;
-}
-
-
-bool TeThread::setPriority( const TeThreadPriority& newPriority )
-{
- if( threadStatus_ == TeThreadRunning ) {
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- int new_prio_value = THREAD_PRIORITY_NORMAL;
-
- switch( newPriority ) {
- case TeThreadIdlePriority :
- {
- new_prio_value = THREAD_PRIORITY_IDLE;
- break;
- }
- case TeThreadBelowNormalPriority :
- {
- new_prio_value = THREAD_PRIORITY_BELOW_NORMAL;
- break;
- }
- case TeThreadNormalPriority :
- {
- new_prio_value = THREAD_PRIORITY_NORMAL;
- break;
- }
- case TeThreadAboveNormalPriority :
- {
- new_prio_value = THREAD_PRIORITY_ABOVE_NORMAL;
- break;
- }
- case TeThreadTimeCriticalPriority :
- {
- new_prio_value = THREAD_PRIORITY_TIME_CRITICAL;
- break;
- }
- default :
- {
- TEAGN_LOG_AND_THROW( "Invalid thread priority" )
- break;
- }
- }
-
- if( SetThreadPriority( threadHandler_, new_prio_value ) ) {
- threadCurrPriority_ = newPriority;
- return true;
- } else {
- return false;
- }
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- int curr_policy = 0;
- struct sched_param curr_sched_param;
-
- TEAGN_TRUE_OR_THROW( ( pthread_getschedparam( threadId_, &curr_policy,
- &curr_sched_param ) == 0 ),
- "Unable to get thread scheduler parameters" );
-
- int min_prio = sched_get_priority_min( curr_policy );
- int max_prio = sched_get_priority_max( curr_policy );
-
- switch( newPriority ) {
- case TeThreadIdlePriority :
- {
- curr_sched_param.sched_priority = min_prio;
- break;
- }
- case TeThreadBelowNormalPriority :
- {
- curr_sched_param.sched_priority = (int)
- ( ( max_prio - min_prio ) / 4 );
- break;
- }
- case TeThreadNormalPriority :
- {
- curr_sched_param.sched_priority = (int)
- ( 2 * ( max_prio - min_prio ) / 4 );
- break;
- }
- case TeThreadAboveNormalPriority :
- {
- curr_sched_param.sched_priority = (int)
- ( 3 * ( max_prio - min_prio ) / 4 );
- break;
- }
- case TeThreadTimeCriticalPriority :
- {
- curr_sched_param.sched_priority = max_prio;
- break;
- }
- default :
- {
- TEAGN_LOG_AND_THROW( "Invalid thread priority" )
- break;
- }
- }
-
- if( pthread_setschedparam( threadId_, curr_policy,
- &curr_sched_param ) == 0 ) {
-
- threadCurrPriority_ = newPriority;
- return true;
- } else {
- return false;
- }
- #else
- #error "ERROR: Unsupported platform"
- #endif
- } else {
- /* Thread not running */
-
- threadCurrPriority_ = newPriority;
-
- return true;
- }
-}
-
-bool TeThread::waitToFinish()
-{
- if( threadStatus_ != TeThreadStopped ) {
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- TEAGN_TRUE_OR_RETURN( ( WaitForSingleObjectEx(
- threadHandler_, INFINITE, false ) == WAIT_OBJECT_0 ),
- "Thread joinning failed" )
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- TEAGN_TRUE_OR_RETURN( ( pthread_join( threadId_, 0 ) == 0 ),
- "Thread joinning failed" )
- #else
- #error "ERROR: Unsupported platform"
- #endif
-
- freeResources();
- }
-
- return true;
-}
-
-void TeThread::init()
-{
- threadStatus_ = TeThreadStopped;
-
- threadCurrPriority_ = TeThreadNormalPriority;
-
-#if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- threadHandler_ = 0;
- threadId_ = 0;
-#elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- threadId_ = 0;
-#else
-#error "ERROR: Unsupported platform"
-#endif
-}
-
-void TeThread::freeResources()
-{
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- if( threadHandler_ != 0 ) {
- WaitForSingleObjectEx( threadHandler_, INFINITE, false );
-
- TEAGN_TRUE_OR_THROW( CloseHandle( threadHandler_ ),
- "Error closing thread handle" );
-
- threadHandler_ = 0;
- threadId_ = 0;
-
- }
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- if( threadId_ != 0 ) {
- pthread_join( threadId_, 0 );
-
- threadId_ = 0;
-
- TEAGN_TRUE_OR_THROW( ( pthread_attr_destroy( &threadAttr_ ) == 0 ),
- "Unable to destroy thread attributes" )
- }
- #else
- #error "ERROR: Unsupported platform"
- #endif
-}
-
-void* TeThread::startThread( void* threadPtr )
-{
- TEAGN_DEBUG_CONDITION( ( threadPtr != 0 ),
- "Invalid thread parameter pointer" )
-
- TeThread* thread = (TeThread*)threadPtr;
-
- thread->run();
- thread->threadStatus_ = TeThreadStopped;
-
- return 0;
-}
-
-
-
-
diff --git a/src/terralib/kernel/TeThread.h b/src/terralib/kernel/TeThread.h
deleted file mode 100644
index acdff2a..0000000
--- a/src/terralib/kernel/TeThread.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/** \file TeThread.h
- * \brief This file contains the base thread class.
- * \author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
- */
-
-#ifndef __TERRALIB_INTERNAL_TETRHEAD_H
-#define __TERRALIB_INTERNAL_TETRHEAD_H
-
-#include "TeThreadDatatypes.h"
-#include "TeDefines.h"
-
-#if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-#include <windows.h>
-#define TeDelayThread( seconds ) Sleep( seconds * 1000)
-#elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-#include <pthread.h>
-#include <unistd.h>
-#define TeDelayThread( seconds ) sleep( seconds )
-#else
-#error "ERROR: Unsupported platform"
-#endif
-
-
-/** \class TeThead
- * \brief xxxxx
- *
- *
- * If you are interested in using TerraLib thread
- * support in a object-oriented way, you should create
- * a subclass of TeThread in order to creata a threadable
- * class. Subclasses must implement the method "run".
- * Than in the main thread, you can call the start method,
- * it is non-blocking.<br>
- * If you have a function and want to make it a thread,
- * you should look TeThreadFunctor class.
- *
- *
- * \sa TeThreadFunctor
- * \author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
- * \ingroup Utils
- *
- */
-class TL_DLL TeThread
-{
- public :
-
-
- /** \brief Default constructor.
- */
- TeThread();
-
- /** \brief Virtual destructor
- */
- virtual ~TeThread();
-
- /** \brief Starts the current thread.
- * \return true if OK, false on errors.
- */
- bool start();
-
- /** \brief Gets the current thread status.
- * \return The current thread status.
- */
- const TeThreadStatus& getStatus() const;
-
- /** \brief Returns the current thread priority.
- * \return The current thread priority.
- */
- const TeThreadPriority& getPriority() const;
-
- /** \brief Changes the current thread priority.
- * \param newPriority The new thread priority.
- * \return true if OK, false on errors.
- */
- bool setPriority(const TeThreadPriority& newPriority);
-
- /** \brief Block the current thread until the thread
- * handled by this instance terminates.
- * \return true if OK, false if wait failed.
- */
- bool waitToFinish();
-
- protected:
-
- /** \brief Thread execution method: this method will be called when the thread starts.
- * Subclasses must reimplement it.
- */
- virtual void run() = 0;
-
- /** \brief Initialize the internal default state.
- */
- void init();
-
- /** \brief Free all thread allocated resources.
- */
- void freeResources();
-
- private:
-
- /** \brief The thread start function.
- * \param threadPtr The thread class pointer.
- */
- static void* startThread(void* threadPtr );
-
- /** \brief Copy constructor not allowed.
- * \param rhs External reference.
- */
- TeThread(const TeThread& rhs);
-
- /** \brief Assignment operator not aloowed.
- * \param rhs External reference.
- * \return A const reference.
- */
- const TeThread& operator=(const TeThread& rhs);
-
- protected:
-
-#if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- HANDLE threadHandler_; //!< Win32 thread handler.
- LPDWORD threadId_; //!< Win32 thread ID
-#elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- pthread_t threadId_; //!< Pthread thread ID.
- pthread_attr_t threadAttr_; //!< Pthread thread attributes.
-#else
-#error "ERROR: Unsupported platform"
-#endif
-
- TeThreadStatus threadStatus_; //!< The current thread status variable.
- TeThreadPriority threadCurrPriority_; //!< The current thread priority.
-};
-
-#endif // __TERRALIB_INTERNAL_TETRHEAD_H
-
diff --git a/src/terralib/kernel/TeThreadDatatypes.h b/src/terralib/kernel/TeThreadDatatypes.h
deleted file mode 100644
index 34d643c..0000000
--- a/src/terralib/kernel/TeThreadDatatypes.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/** \file TeThreadDatatypes.h
- * \brief xxxxxxx.
- * \author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
- */
-
-#ifndef __TERRALIB_INTERNAL_TETRHEADDATATYPES_H
-#define __TERRALIB_INTERNAL_TETRHEADDATATYPES_H
-
-
-/**
- * \enum TeThreadStatus
- * \brief Possible thread status.
- */
-enum TeThreadStatus
-{
- TeThreadStopped, //!< The thread is stopped: it has already finished the job or it doesn't have start it.
- TeThreadRunning //!< The thread is running.
-};
-
-
-/**
- * \enum TeThreadPriority
- * \brief Possible thread priorities.
- */
-enum TeThreadPriority
-{
- TeThreadIdlePriority, /*!< Idle priority. */
- TeThreadBelowNormalPriority, /*!< Below normal priority. */
- TeThreadNormalPriority, /*!< Normal priority. */
- TeThreadAboveNormalPriority, /*!< Above normal priority. */
- TeThreadTimeCriticalPriority /*!< Time critical priority. */
-};
-
-
-#endif // __TERRALIB_INTERNAL_TETRHEADDATATYPES_H
-
diff --git a/src/terralib/kernel/TeThreadFunctor.cpp b/src/terralib/kernel/TeThreadFunctor.cpp
deleted file mode 100644
index 969a15d..0000000
--- a/src/terralib/kernel/TeThreadFunctor.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "TeThreadFunctor.h"
-#include "TeAgnostic.h"
-
-
-TeThreadFunctor::TeThreadFunctor()
- : threadReturnValue_(false), threadStartFuncPtr_(0)
-{
-}
-
-
-TeThreadFunctor::TeThreadFunctor( TeThreadStartFunctT startFuncPtr )
- : threadReturnValue_(false)
-{
-
- setStartFunctPtr( startFuncPtr );
-}
-
-
-TeThreadFunctor::~TeThreadFunctor()
-{
-}
-
-const bool& TeThreadFunctor::getReturnValue() const
-{
- return threadReturnValue_;
-}
-
-void TeThreadFunctor::setStartFunctPtr( TeThreadStartFunctT startFuncPtr )
-{
- TEAGN_TRUE_OR_THROW( ( threadStatus_ == TeThreadStopped ),
- "Cannot change start function pointer of a running thread" )
-
- TEAGN_TRUE_OR_THROW( ( startFuncPtr != 0 ),
- "Invalid thread start function pointer" )
-
- threadStartFuncPtr_ = startFuncPtr;
-}
-
-void TeThreadFunctor::setParameters(const TeThreadParameters& params)
-{
- TEAGN_TRUE_OR_THROW( ( threadStatus_ == TeThreadStopped ),
- "Cannot change thread parameters of a running thread" )
-
- threadUserParams_ = params;
-}
-
-void TeThreadFunctor::run()
-{
- TEAGN_TRUE_OR_THROW( ( threadStartFuncPtr_ != 0 ),
- "Invalid thread start function pointer" )
-
- threadReturnValue_ = threadStartFuncPtr_(threadUserParams_);
-
- threadUserParams_.clear();
-}
-
diff --git a/src/terralib/kernel/TeThreadFunctor.h b/src/terralib/kernel/TeThreadFunctor.h
deleted file mode 100644
index ad1e027..0000000
--- a/src/terralib/kernel/TeThreadFunctor.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/** \file TeThreadFunctor.h
- * \brief This file contains a base class for thread in function style manner.
- * \author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
- */
-
-#ifndef __TERRALIB_INTERNAL_TETRHEADFUNCTOR_H
-#define __TERRALIB_INTERNAL_TETRHEADFUNCTOR_H
-
-#include "TeThread.h"
-#include "TeThreadParameters.h"
-#include "TeSharedPtr.h"
-
-/** \class TeThreadFunctor
- * \brief A base class for thread in function style manner.
- *
- *
- * If you are interested in using TerraLib thread
- * support in a function style model, you should create
- * objects of this class by specifying a function to be called by
- * the thread when it starts.<br>
- * To start the thread, call start method,
- * it is non-blocking.<br>
- * If you want to use the thread support
- * in a object oriented way, see TeThread class.
- *
- *
- * \sa TeThread
- * \author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * \author Gilberto Ribeiro de Queiroz <gribeiro at dpi.inpe.br>
- * \ingroup Utils
- *
- */
-class TL_DLL TeThreadFunctor : public TeThread
-{
- public:
-
- /** \brief Type definition for a thread start function pointer.
- * \param params The thread parameters.
- * \return true if OK, false on erros.
- */
- typedef bool (*TeThreadStartFunctT)( const TeThreadParameters& params );
-
- /** @typedef TeSharedPtr< TeThread > pointer
- * Type definition for an thread instance pointer.
- */
- typedef TeSharedPtr< TeThreadFunctor > pointer;
-
- /** \brief Default Constructor.
- */
- TeThreadFunctor();
-
- /** \brief Alternate Constructor.
- * \param startFuncPtr The thread start function pointer.
- */
- TeThreadFunctor( TeThreadStartFunctT startFuncPtr );
-
- /** \brief Default Destructor
- */
- ~TeThreadFunctor();
-
- /** \brief Returns the current thread execution return value.
- */
- const bool& getReturnValue() const;
-
- /** \brief Change the internal thread start function pointer.
- * \param startFuncPtr The new thread start function pointer.
- * \note The thread mus be stopped for calling this method.
- */
- void setStartFunctPtr( TeThreadStartFunctT startFuncPtr );
-
- /** \brief Sets the parameter that will be passed to the function after
- * the thread startup.
- * \param params The parameters to the thread function.
- * \note The thread mus be stopped for calling this method.
- */
- void setParameters(const TeThreadParameters& params);
-
- protected:
-
- /** \brief This is the implementation of the thread execution method: this method
- * will be called when the thread starts.
- */
- void run();
-
- protected:
-
- bool threadReturnValue_; //!< User function return value.
- TeThreadParameters threadUserParams_; //!< The current user parameters instance.
- TeThreadStartFunctT threadStartFuncPtr_; //!< A pointer to the current user thread start function.
-};
-
-#endif // __TERRALIB_INTERNAL_TETRHEADFUNCTOR_H
-
diff --git a/src/terralib/kernel/TeThreadParameters.h b/src/terralib/kernel/TeThreadParameters.h
deleted file mode 100644
index 42803c6..0000000
--- a/src/terralib/kernel/TeThreadParameters.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeThreadParameters.h
- \brief Thread parameters class.
-*/
-
-#ifndef TETRHEADPARAMETERS_H
- #define TETRHEADPARAMETERS_H
-
- #include "TeMultiContainer.h"
-
- /**
- * @brief Thread parameters class.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- * @ingroup Utils
- */
- class TL_DLL TeThreadParameters : public TeMultiContainer< std::string > {};
-
-#endif
-
diff --git a/src/terralib/kernel/TeThreadSignal.cpp b/src/terralib/kernel/TeThreadSignal.cpp
deleted file mode 100644
index c55d888..0000000
--- a/src/terralib/kernel/TeThreadSignal.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-#include "TeThreadSignal.h"
-
-#include "TeAgnostic.h"
-
-#if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- #include <stdio.h>
-#elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- #include <sys/time.h>
- #include <time.h>
-#else
- #error "Unsuported plataform"
-#endif
-
-TeThreadSignal::TeThreadSignal()
-{
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- waiters_count_ = 0;
- wait_generation_count_ = 0;
- release_count_ = 0;
-
- // Create a manual-reset event.
- event_ = CreateEvent (NULL, // no security
- TRUE, // manual-reset
- FALSE, // non-signaled initially
- NULL); // unnamed
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- /* Creating mutex */
-
- pthread_mutexattr_t access_attr;
- TEAGN_TRUE_OR_THROW( ( pthread_mutexattr_init( &access_attr ) == 0 ),
- "Unable to init mutex attributes" );
-
- pthread_mutexattr_settype( &access_attr, PTHREAD_MUTEX_DEFAULT );
- TEAGN_TRUE_OR_THROW(
- ( pthread_mutex_init( &m_access_, &access_attr ) == 0 ),
- "Unable to init mutex" )
-
- /* Creating condition variable */
-
- TEAGN_TRUE_OR_THROW( ( pthread_cond_init( &condition_var_, 0 ) == 0 ),
- "Unable to create a condition variable" );
-
- #else
- #error "Unsuported plataform"
- #endif
-}
-
-
-TeThreadSignal::~TeThreadSignal()
-{
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- CloseHandle( event_ );
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- pthread_cond_destroy( &condition_var_ );
-
- pthread_mutex_destroy( &m_access_ );
-
- #else
- #error "Unsuported plataform"
- #endif
-}
-
-
-void TeThreadSignal::emit()
-{
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- waiters_count_lock_.lock();
-
- if ( waiters_count_ > 0) {
- SetEvent ( event_);
- // Release all the threads in this generation.
- release_count_ = waiters_count_;
-
- // Start a new generation.
- wait_generation_count_++;
- }
-
- waiters_count_lock_.unLock();
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- TEAGN_TRUE_OR_THROW( ( pthread_cond_broadcast( &condition_var_ ) == 0 ),
- "Error emiting signal" );
-
- #else
- #error "Unsupported platform"
- #endif
-}
-
-
-bool TeThreadSignal::wait( unsigned int waiting_time )
-{
- bool return_value = true;
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- // Avoid race conditions.
- waiters_count_lock_.lock();
-
- // Increment count of waiters.
- waiters_count_++;
-
- // Store current generation in our activation record.
- int my_generation = wait_generation_count_;
-
- waiters_count_lock_.unLock();
-
- for (;;) {
- // Wait until the event is signaled.
- if( waiting_time == 0 ) {
- if( WaitForSingleObject ( event_, INFINITE ) != WAIT_OBJECT_0 ) {
- return_value = false;
- break;
- }
- } else {
- if( WaitForSingleObject ( event_, waiting_time ) != WAIT_OBJECT_0 ) {
- return_value = false;
- break;
- }
- }
-
- waiters_count_lock_.lock();
- // Exit the loop when the < event_> is signaled and
- // there are still waiting threads from this <wait_generation>
- // that haven't been released from this wait yet.
- int wait_done = release_count_ > 0
- && wait_generation_count_ != my_generation;
- waiters_count_lock_.unLock();
-
- if (wait_done)
- break;
- }
-
- waiters_count_lock_.lock();
- waiters_count_--;
- release_count_--;
- int last_waiter = release_count_ == 0;
- waiters_count_lock_.unLock();
-
- if (last_waiter)
- // We're the last waiter to be notified, so reset the manual event.
- ResetEvent ( event_);
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- TEAGN_TRUE_OR_THROW( ( pthread_mutex_lock( &m_access_ ) == 0 ),
- "Unable to lock mutex" );
-
- if( waiting_time == 0 ) {
- if( pthread_cond_wait( &condition_var_, &m_access_ ) != 0 ) {
- return_value = false;
- }
- } else {
- struct timeval timevalstr;
-
- if( gettimeofday( &timevalstr, 0 ) == 0 ) {
- struct timespec timespecstr;
-
- /* seconds */
- timespecstr.tv_sec = timevalstr.tv_sec + ( waiting_time / 1000 );
- /* nano-seconds */
- timespecstr.tv_nsec = ( timevalstr.tv_usec * 1000 ) +
- ( ( waiting_time % 1000 ) * 1000000 );
-
- if( pthread_cond_timedwait( &condition_var_, &m_access_,
- ×pecstr ) != 0 ) {
-
- return_value = false;
- }
- } else {
- TEAGN_LOGWARN( "Unable to get the current time" );
- return_value = false;
- }
- }
-
- TEAGN_TRUE_OR_THROW( ( pthread_mutex_unlock( &m_access_ ) == 0 ),
- "Unable to unlock mutex" );
-
- #else
- #error "Unsuported plataform"
- #endif
-
- return return_value;
-}
-
diff --git a/src/terralib/kernel/TeThreadSignal.h b/src/terralib/kernel/TeThreadSignal.h
deleted file mode 100644
index c30a4a4..0000000
--- a/src/terralib/kernel/TeThreadSignal.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeThreadSignal.h
- \brief This file contains definitions about a class to deal thread
- signals.
-*/
-
-
-#ifndef TETHREADSIGNAL_H
- #define TETHREADSIGNAL_H
-
- #include "TeDefines.h"
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
- #include <windows.h>
- #include "TeMutex.h"
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
- #include <pthread.h>
- #include <errno.h>
- #else
- #error "ERROR: Unsupported platform"
- #endif
-
- /**
- * @brief A class to deal with thread signals.
- * @author Emiliano F. Castejon <castejon at dpi.inpe.br>
- */
- class TL_DLL TeThreadSignal
- {
- public :
-
- /**
- * @brief Default constructor.
- */
- TeThreadSignal();
-
- /**
- * @brief Default destructor.
- */
- ~TeThreadSignal();
-
- /**
- * @brief Emit a broadcast signal unblocking all waiting threads.
- */
- void emit();
-
- /**
- * @brief Block the current thread waiting for a signal.
- * @param waiting_time The maximim waiting time in milliseconds
- * ( 0 == INFINITE ).
- * @return true if a signal was received, false if the waiting
- * time has finished or an error occurred.
- */
- bool wait( unsigned int waiting_time = 0 );
-
- protected :
-
- #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
-
- /**
- * @brief Count of the number of waiters.
- */
- int waiters_count_;
-
- /**
- * @brief Serialize access to waiters_count_.
- */
- TeMutex waiters_count_lock_;
-
- /**
- * @brief Number of threads to release via a
- * signal broadcast.
- */
- int release_count_;
-
- /**
- * @brief Keeps track of the current "generation" so that we
- * don't allow one thread to steal all the "releases" from the
- * broadcast.
- */
- int wait_generation_count_;
-
- /**
- * @brief A manual-reset event that's used to block and release
- * waiting threads.
- */
- HANDLE event_;
-
- #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX
-
- /**
- * @brief The mutex instance.
- */
- pthread_mutex_t m_access_;
-
- /**
- * @brief The condition var instance.
- */
- pthread_cond_t condition_var_;
-
-
- #else
- #error "Unsuported plataform"
- #endif
-
- private :
-
- /**
- * @brief Alternative constructor.
- */
- TeThreadSignal( const TeThreadSignal& ) {};
-
- /**
- * @brief operator= overload.
- * @return A const reference to the current instance.
- */
- const TeThreadSignal& operator=( const TeThreadSignal& ) { return *this; };
-
- };
-
-#endif
diff --git a/src/terralib/kernel/TeTime.cpp b/src/terralib/kernel/TeTime.cpp
deleted file mode 100644
index d50c7a6..0000000
--- a/src/terralib/kernel/TeTime.cpp
+++ /dev/null
@@ -1,631 +0,0 @@
- /************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include <TeTime.h>
-#include <memory.h>
-#include <TeUtils.h>
-#include <cstdlib>
-#include <iostream>
-
-//return the number of the month
-int getMonth(const std::string& month)
-{
- std::string tempM = TeConvertToUpperCase(month);
- if(tempM=="JAN")
- return 0;
- else if(tempM=="FEB")
- return 1;
- else if(tempM=="MAR")
- return 2;
- else if(tempM=="APR")
- return 3;
- else if(tempM=="MAY")
- return 4;
- else if(tempM=="JUN")
- return 5;
- else if(tempM=="JUL")
- return 6;
- else if(tempM=="AUG")
- return 7;
- else if(tempM=="SEP")
- return 8;
- else if(tempM=="OCT")
- return 9;
- else if(tempM=="NOV")
- return 10;
- else if(tempM=="DEC")
- return 11;
-
- return -1;
-}
-
-//return the month
-std::string getMonth(int i)
-{
- if(i==0)
- return "Jan";
- else if(i==1)
- return "Feb";
- else if(i==2)
- return "Mar";
- else if(i==3)
- return "Apr";
- else if(i==4)
- return "May";
- else if(i==5)
- return "Jun";
- else if(i==6)
- return "Jul";
- else if(i==7)
- return "Aug";
- else if(i==8)
- return "Sep";
- else if(i==9)
- return "Oct";
- else if(i==10)
- return "Nov";
- else if(i==11)
- return "Dec";
-
- return "";
-}
-
-
-TeTime::TeTime()
-{
- /*
- set the tm_isdst field to 0 to indicate that standard time is in effect,
- or to a value greater than 0 to indicate that daylight savings time is in effect,
- or to a value less than zero to have the C run-time library code compute whether
- standard time or daylight savings time is in effect.
- (The C run-time library assumes the United States�s rules for implementing
- the calculation of Daylight Saving Time).
- */
-
- chronon_ = TeSECOND;
- ts_.tm_sec = 0;
- ts_.tm_min = 0;
- ts_.tm_hour = 0;
- ts_.tm_isdst = -1;
- ts_.tm_mday = 1;
- ts_.tm_mon = 0;
- ts_.tm_year = 0;
-}
-
-TeTime::TeTime(const TeTime& other)
-{
- memcpy(&ts_, &other.ts_, sizeof(struct tm));
- last_ = other.last_;
- chronon_ = other.chronon_;
-}
-
-TeTime::TeTime(int h, int m, int s, TeChronon chronon)
-{
- now();
- ts_ = *localtime(&last_);
- ts_.tm_sec = s;
- ts_.tm_min = m;
- ts_.tm_hour = h;
- ts_.tm_isdst = -1;
- ts_.tm_mday = 1;
- ts_.tm_mon = 0;
- ts_.tm_year = 0;
- last_ = mktime(&ts_);
- chronon_ = chronon;
-}
-
-TeTime::TeTime(const std::string& ds, TeChronon chronon, const std::string& mask, const std::string& dateS, const std::string& timeS, const std::string& indPM)
-{
- chronon_ = chronon;
- ts_.tm_sec = 0;
- ts_.tm_min = 0;
- ts_.tm_hour = 0;
- ts_.tm_isdst = -1;
- ts_.tm_mday = 1;
- ts_.tm_mon = 0;
- ts_.tm_year = 0;
-
- bool flag = true;
- std::string tempDT, tempM;
- std::string maskTemp = mask;
-
- int posBeginMask = 0;
- int posBeginDate = 0;
- int posEndMask;
- int posEndTotalMask = 0;
-
- if (mask == "YYYYMMDD" || mask == "yyyymmdd" || mask == "aaaammdd" || mask == "AAAAMMDD")
- {
- sscanf(ds.c_str(),"%4d%2d%2d",&ts_.tm_year,&ts_.tm_mon,&ts_.tm_mday);
- }
- else if (mask == "DDMMAAAA" || mask == "ddmmaaaa" || mask == "DDMMYYYY" || mask == "ddmmyyyy")
- {
- sscanf(ds.c_str(),"%2d%2d%4d",&ts_.tm_mday,&ts_.tm_mon,&ts_.tm_year);
- }
- else if (mask == "DDAAAAMM" || mask == "ddaaaamm" || mask == "DDYYYYMM" || mask == "ddyyyymm")
- {
- sscanf(ds.c_str(),"%2d%4d%2d",&ts_.tm_mday,&ts_.tm_year,&ts_.tm_mon);
- }
- else if (mask == "MMDDAAAA" || mask == "mmddaaaa" || mask == "MMDDYYYY" || mask == "mmddyyyy")
- {
- sscanf(ds.c_str(),"%2d%4d%2d",&ts_.tm_mon,&ts_.tm_mday,&ts_.tm_year);
- }
- else if (mask == "AAAADDMM" || mask == "aaaaddmm" || mask == "YYYYDDMM" || mask == "yyyyddmm")
- {
- sscanf(ds.c_str(),"%4d%2d%2d",&ts_.tm_year,&ts_.tm_mday,&ts_.tm_mon);
- }
- else
- {
- while(flag)
- {
- posEndMask = maskTemp.find("s");
- posEndTotalMask += posEndMask;
-
- if(posEndMask==-1)
- {
- flag = false;
- posEndTotalMask = mask.size();
- }
- else
- {
- if(posBeginMask>0)
- ++posEndTotalMask;
-
- maskTemp = maskTemp.substr(posEndMask+1);
- }
-
- tempDT.clear();
- tempM = mask.substr(posBeginMask,(posEndTotalMask-posBeginMask));
-
- //fill the datetime
- std::string dt = ds.substr(posBeginDate,1);
- while((dt!=dateS) && (dt!=timeS) && (dt!=" ") && (posBeginDate < (int)ds.size()))
- {
- tempDT += dt;
- ++posBeginDate;
- dt = ds.substr(posBeginDate,1);
- }
- ++posBeginDate;
-
- //day
- if(tempM.find(68)==0)
- ts_.tm_mday = atoi(tempDT.c_str());
-
- //month
- else if (tempM.find(77)==0)
- {
- if(tempDT.size()>2)
- ts_.tm_mon = getMonth(tempDT)+1;
- else
- ts_.tm_mon = atoi(tempDT.c_str());
- }
-
- //year
- else if (tempM.find(89)==0)
- {
- ts_.tm_year = atoi(tempDT.c_str());
- if(ts_.tm_year < 100)
- ts_.tm_year += 1900;
- }
-
- //hour
- else if (tempM.find(72)==0)
- ts_.tm_hour = atoi(tempDT.c_str());
-
- //minute
- else if (tempM.find(109)==0)
- ts_.tm_min = atoi(tempDT.c_str());
-
- //second
- else if (tempM.find(83)==0)
- ts_.tm_sec = atoi(tempDT.c_str());
-
- //PM or AM indicator
- else if ((tempM.find(84)==0) && (tempDT==indPM))
- ts_.tm_hour += 12;
-
- posBeginMask = posEndTotalMask+1;
-
- if((posBeginDate)>(int)(ds.size()-1) || (posBeginMask)>(int)(mask.size()-1))
- flag = false;
- }
- }
-
- switch (chronon_)
- {
- case TeYEAR :
- ts_.tm_mon = 1;
- break;
- case TeMONTH :
- ts_.tm_mday = 1;
- break;
- case TeDAY :
- ts_.tm_hour = 0;
- break;
- case TeHOUR :
- ts_.tm_min = 0;
- break;
- case TeMINUTE :
- ts_.tm_sec = 0;
- break;
- default:
- break;
- }
-
- ts_.tm_year -= 1900;
- --ts_.tm_mon;
-
- last_ = mktime(&ts_);
- if (last_ != time_t(-1))
- ts_ = *localtime(&last_);
-}
-
-time_t TeTime::now(void)
-{
- time(&last_);
- ts_ = *localtime(&last_);
- return last_;
-}
-
-std::string
-TeTime::getTime()
-{
- char tbuf[9];
- sprintf(tbuf, "%02d:%02d:%02d",
- ts_.tm_hour,ts_.tm_min,ts_.tm_sec);
- return tbuf;
-}
-
-
-std::string
-TeTime::getDate()
-{
- char dbuf[12];
- sprintf(dbuf,"%4d-%02d-%02d",ts_.tm_year+1900,ts_.tm_mon+1,ts_.tm_mday);
- return dbuf;
-}
-
-std::string
-TeTime::getDateTime (const std::string& mask, const std::string& dateS, const std::string& timeS, const std::string& indPM, const std::string& indAM)
-{
- std::string result = "";
-
- bool flag = true;
- std::string tempM;
- std::string maskTemp = mask;
-
- int posBeginMask = 0;
- int posEndMask;
- int posEndTotalMask = 0;
-
- bool firstTime = true;
- bool pm = false;
- bool am = false;
-
- //verify if the mask is AM and PM
- std::string tempAPM = mask.substr(mask.size()-1, 1);
- if(tempAPM=="T")
- {
- if((ts_.tm_hour>12) || ((ts_.tm_hour==12) && (ts_.tm_min>0)) ||
- ((ts_.tm_hour==12) && (ts_.tm_min==0) && (ts_.tm_sec>0)))
- pm=true;
- else
- am=true;
- }
-
- while(flag)
- {
- posEndMask = maskTemp.find("s");
- posEndTotalMask += posEndMask;
-
- if(posEndMask==-1)
- {
- flag = false;
- posEndTotalMask = mask.size();
- }
- else
- {
- if(posBeginMask>0)
- ++posEndTotalMask;
-
- maskTemp = maskTemp.substr(posEndMask+1);
- }
-
- tempM = mask.substr(posBeginMask,(posEndTotalMask-posBeginMask));
-
- //day
- if(tempM.find(68)==0)
- result += Te2String(ts_.tm_mday) + dateS;
-
- //month
- else if (tempM.find(77)==0)
- {
- if(tempM=="MMM")
- result += getMonth(ts_.tm_mon) + dateS;
- else
- result += Te2String(ts_.tm_mon+1) + dateS;
- }
-
- //year
- else if (tempM.find(89)==0)
- {
- if(tempM=="YYYY")
- result += Te2String(ts_.tm_year+1900) + dateS;
- else
- {
- std::string tempY = Te2String(ts_.tm_year);
- tempY = tempY.substr(tempY.size()-2, 2);
- result += tempY + dateS;
- }
- }
-
- //hour
- else if (tempM.find(72)==0)
- {
- if(firstTime)
- result.replace(result.size()-1, 1, " ");
-
- if(pm)
- result += Te2String(ts_.tm_hour-12) + timeS;
- else
- result += Te2String(ts_.tm_hour) + timeS;
-
- firstTime = false;
- }
-
- //minute
- else if (tempM.find(109)==0)
- {
- if(firstTime)
- result.replace(result.size()-1, 1, " ");
-
- result += Te2String(ts_.tm_min) + timeS;
- firstTime = false;
- }
-
- //second
- else if (tempM.find(83)==0)
- {
- if(firstTime)
- result.replace(result.size()-1, 1, " ");
-
- result += Te2String(ts_.tm_sec) + timeS;
- firstTime = false;
- }
-
- //PM or AM indicator
- else if (tempM.find(84)==0)
- {
- result.replace(result.size()-1, 1, " ");
-
- if(pm)
- result += indPM;
- else if(am)
- result += indAM;
-
- }
-
- posBeginMask = posEndTotalMask+1;
- }
-
- if((!am) && (!pm))
- result.replace(result.size()-1, 1, " ");
-
- return result;
-}
-
-time_t
-TeTime::Set(int y, int m, int d, int h, int mt, int s)
-{
- if (y > -1) ts_.tm_year = y-1900;
- if (m > -1) ts_.tm_mon = m-1;
-
-
- if (d > -1) ts_.tm_mday = d;
- if (h > -1) ts_.tm_hour = h;
- if (mt > -1) ts_.tm_min = mt;
- if (s > -1) ts_.tm_sec = s;
- ts_.tm_isdst =-1;
- last_ = mktime(&ts_);
- if (last_ == -1) last_ = 0;
- return last_;
-}
-
-TeTime&
-TeTime::operator=(const TeTime& other)
-{
- memcpy(&ts_, &other.ts_, sizeof(struct tm));
- last_ = other.last_;
- chronon_ = other.chronon_;
- return *this;
-}
-
-
-TeTime&
-TeTime::operator+=(int delta)
-{
- if (delta == 0)
- return *this;
-
- int deltaux=delta;
- switch (chronon_)
- {
- case TeYEAR :
- ts_.tm_isdst = -1;
- ts_.tm_year += delta;
- last_ = mktime(&ts_);
- break;
- case TeMONTH :
- case TeMONTHOFYEAR:
- ts_.tm_isdst = -1;
- ts_.tm_year += (ts_.tm_mon+delta)/12;
- ts_.tm_mon = (ts_.tm_mon+delta)%12;
- last_ = mktime(&ts_);
- break;
- case TeDAY :
- case TeDAYOFMONTH:
- case TeDAYOFWEEK:
- case TeDAYOFYEAR:
- deltaux *= 3600*24;
- last_ += deltaux;
- ts_ = *localtime(&last_);
- break;
- case TeHOUR :
- case TeHOUROFDAY :
- deltaux *= 3600;
- last_ += deltaux;
- ts_ = *localtime(&last_);
- break;
- case TeMINUTE :
- case TeMINUTEOFHOUR:
- deltaux *= 60;;
- last_ += deltaux;
- ts_ = *localtime(&last_);
- break;
- case TeSECOND :
- case TeSECONDOFMINUTE :
- last_ += deltaux;
- ts_ = *localtime(&last_);
- break;
- default :
- break;
- }
-
- return *this;
-}
-
-TeTime&
-TeTime::operator++()
-{
- this->operator +=(1);
- return *this;
-}
-
-TeTime
-TeTime::operator+(int delta)
-{
- TeTime temp(*this);
- temp += delta;
- return temp;
-}
-
-TeTime&
-TeTime::operator-=(int delta)
-{
- last_ -= delta;
- ts_ = *localtime(&last_);
- return *this;
-}
-
-bool
-TeTime::operator==(const TeTime& time) const
-{
- return ((chronon_==time.chronon_) && (ts_.tm_sec==time.ts_.tm_sec) && (ts_.tm_min==time.ts_.tm_min) &&
- (ts_.tm_hour==time.ts_.tm_hour) && (ts_.tm_isdst==time.ts_.tm_isdst) && (ts_.tm_mday==time.ts_.tm_mday) &&
- (ts_.tm_mon==time.ts_.tm_mon) && (ts_.tm_year==time.ts_.tm_year));
-}
-
-bool
-TeTime::operator<(const TeTime& time) const
-{
- if(chronon_!=time.chronon_)
- return false;
-
- if(ts_.tm_year>time.ts_.tm_year)
- return false;
- else if(ts_.tm_year<time.ts_.tm_year)
- return true;
-
- if(ts_.tm_mon>time.ts_.tm_mon)
- return false;
- else if (ts_.tm_mon<time.ts_.tm_mon)
- return true;
-
- if(ts_.tm_mday>time.ts_.tm_mday)
- return false;
- else if (ts_.tm_mday<time.ts_.tm_mday)
- return true;
-
- if(ts_.tm_hour>time.ts_.tm_hour)
- return false;
- else if (ts_.tm_hour<time.ts_.tm_hour)
- return true;
-
- if(ts_.tm_min>time.ts_.tm_min)
- return false;
- else if (ts_.tm_min<time.ts_.tm_min)
- return true;
-
- if(ts_.tm_sec>time.ts_.tm_sec)
- return false;
- else if (ts_.tm_sec<time.ts_.tm_sec)
- return true;
-
- return false;
-}
-
-bool
-TeTime::operator<=(const TeTime& time) const
-{
- return (this->operator<(time) || this->operator==(time));
-}
-
-int
-TeTime::operator-(const TeTime& other)
-{
- if(this->chronon_!=other.chronon_)
- return 0;
- int t = (int)this->last_- other.last_;
- return (t);
-}
-
-bool
-TeTime::isValid()
-{
- if( (chronon_==TeSECOND) && (ts_.tm_sec==0) && (ts_.tm_min==0) &&
- (ts_.tm_hour==0) && (ts_.tm_mday==1) &&
- (ts_.tm_mon==0) && (ts_.tm_year==0))
- return false;
- else
- return true;
-}
-
-void
-TeTime::chronon (TeChronon c)
-{
- if(chronon_==c)
- return;
-
- chronon_=c;
-}
-
-
-std::ostream& operator<<(std::ostream& os, TeTime& N)
-{
- os << N.getDateTime();
- return os;
-}
-
-
-
-
diff --git a/src/terralib/kernel/TeTime.h b/src/terralib/kernel/TeTime.h
deleted file mode 100644
index 534e46b..0000000
--- a/src/terralib/kernel/TeTime.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeTime.h
- \brief This file contains structures and definitions to deal with date and time
-*/
-#ifndef __TERRALIB_INTERNAL_TIME_H
-#define __TERRALIB_INTERNAL_TIME_H
-
-#include "TeDefines.h"
-#include "TeDataTypes.h"
-
-#include <time.h>
-#include <stdio.h>
-#include <string>
-#include <iostream>
-
-//! A class for supporting date and time.
-class TL_DLL TeTime
-{
- struct tm ts_; // Unix time structure
- time_t last_; // time in seconds
- TeChronon chronon_;
-
-public:
-
- //! Set the date and time from the system clock.
- time_t now(void);
-
- //! Set all time information with NULL value
- TeTime(void);
-
- //! Copy constructor.
- TeTime(const TeTime& t);
-
- //! Set the date from the system clock and the time from its parameter list. Chronon defaulted to second.
- TeTime(int h, int m, int s, TeChronon chronon);
-
- //! Set date and time from arguments, though the time fields.
- TeTime( const std::string& dt, TeChronon chronon, const std::string& mask,
- const std::string& dateS = "/", const std::string& timeS = ":", const std::string& indPM = "PM");
-
- //! Return a time of day std::string in format "hh:mm:ss"
- std::string getTime();
-
- //! Return a std::string to the date in the form "yyyy-mm-dd"
- std::string getDate(void);
-
- //! Return a pointer to the date and time in the form passed in mask.
- std::string getDateTime (const std::string& mask= "DDsMMsYYYYsHHsmmsSS", const std::string& dateS="/", const std::string& timeS=":", const std::string& indPM="PM", const std::string& indAM="AM");
-
- //! Reset time to the specified arguments. Return time_t: number of seconds since 0:00:00 Jan 1 1987
- /*!
- \param y year
- \param m month
- \param d day
- \param h hour
- \param min minutes
- \param s seconds
- */
- time_t Set(int y, int m, int d, int h = 0, int min = 0, int s = 0);
-
- //! Get year value as an four digit integer
- int year() {return ts_.tm_year+1900;}
-
- //! Get month value
- int month() {return ts_.tm_mon+1;}
-
- //! Get day of the month value
- int day() {return ts_.tm_mday;}
-
- //! Get hour value as an integer
- int hour() {return ts_.tm_hour;}
-
- //! Get minute value as an integer
- int minute() {return ts_.tm_min;}
-
- //! Get second value as an integer
- int second() {return ts_.tm_sec;}
-
- //! Get week day as in integer
- int weekDay() { return ts_.tm_wday;} //(0-6) 0=Sunday
-
- //! Get year day as in integer
- int yearDay() { return ts_.tm_yday;} //(0-365) 01/01=0
-
- //! Get chronon definition
- TeChronon chronon () {return chronon_;}
-
- //! Set chronon definition
- void chronon (TeChronon c);
-
- //! Assignment operator for TeTime objects.
- TeTime& operator=(const TeTime&);
-
- //! Add 'delta' chronon units to the current date. Return current date.
- TeTime& operator+=(int delta);
-
- //! Increase a chronon unit in the time (Prefix operator)
- TeTime& operator++();
-
- //! Add 'delta' chronon units to the current date and return a new date. Return new date.
- TeTime operator+(int delta);
-
- //! Subtract 'delta' chronon units from the current date. Return current date.
- TeTime& operator-=(int delta);
-
- //! Operator ==
- bool operator==(const TeTime& time) const;
-
- //! Operator <
- bool operator<(const TeTime& time) const;
-
- //! Operator <=
- bool operator<=(const TeTime& time) const;
-
- //! Returns the difference betwwen the times in seconds
- int operator-(const TeTime& other);
-
- //! Verify if the time has null values
- bool isValid();
-
- //! Normal destructor.
- ~TeTime(void) { }
-
-};
-
-//! Operator to display an instance of TeTime
-TL_DLL std::ostream& operator<<(std::ostream& os, TeTime& N);
-
-
-#endif
-
-
diff --git a/src/terralib/kernel/TeTimeInterval.cpp b/src/terralib/kernel/TeTimeInterval.cpp
deleted file mode 100644
index efd6d26..0000000
--- a/src/terralib/kernel/TeTimeInterval.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeTimeInterval.h"
-
-TeTimeInterval :: TeTimeInterval(const std::string& s1, const std::string& s2, TeChronon chronon,
- const std::string& mask, const std::string& dateS, const std::string& timeS,
- const std::string& indPM)
-{
- intChronon_ = chronon;
- //build t1 and t2 with the chronon parameter
- TeTime t1 (s1, chronon, mask, dateS, timeS, indPM);
- TeTime t2 (s2, chronon, mask, dateS, timeS, indPM);
- t1_ = t1;
- t2_ = t2;
- adjustIntervaltoChronon();
-
-}
-
-void
-TeTimeInterval::intervalChronon(TeChronon c)
-{
- intChronon_ = c;
- t1_.chronon(c);
- t2_.chronon(c);
- adjustIntervaltoChronon();
-}
-
-void
-TeTimeInterval::adjustIntervaltoChronon ()
-{
- int m2 = t2_.month();
- int d2 = 31;
- int d1 = 1;
-
- if ((m2 == 4) || (m2 == 6) || (m2 == 9) || (m2 == 11)) //april, june, september, november
- d2 = 30;
- if (m2 == 2) //february
- d2 = 28;
-
- switch (intChronon_)
- {
- case TeYEAR :
- t1_.Set(t1_.year(), 1 , 1, 0, 0, 0);
- t2_.Set(t2_.year(), 12, 31, 23, 59, 59);
- break;
- case TeMONTH :
- t1_.Set(t1_.year(), t1_.month(), d1, 0, 0, 0);
- t2_.Set(t2_.year(), t2_.month(), d2, 23, 59, 59);
- break;
- case TeDAY :
- t1_.Set(t1_.year(), t1_.month(), t1_.day(), 0, 0, 0);
- t2_.Set(t2_.year(), t2_.month(), t2_.day(), 23, 59, 59);
- break;
- case TeHOUR :
- t1_.Set(t1_.year(), t1_.month(), t1_.day(), t1_.hour(), 0, 0);
- t2_.Set(t2_.year(), t2_.month(), t2_.day(), t2_.hour(), 59, 59);
- break;
- case TeMINUTE :
- t1_.Set(t1_.year(), t1_.month(), t1_.day(), t1_.hour(), t1_.minute(), 0);
- t2_.Set(t2_.year(), t2_.month(), t2_.day(), t2_.hour(), t2_.minute(), 59);
- break;
- default:
- break;
- }
-}
-
-
-int
-TeTimeInterval :: length ()
-{
- return 1;
-}
-
-void
-TeTimeInterval :: shift (const std::string& t)
-{
- TeTime new_t1;
- if (t == "")
- TeTime new_t1 (t2_);
- else
- TeTime new_t1 (t, t2_.chronon(), "YYYYsMMsDDsHHsmmsSS");
-
- TeTime new_t2 = new_t1 + length();
-
- t1_ = new_t1;
- t2_ = new_t2;
- adjustIntervaltoChronon();
-}
-
-
-void
-TeTimeInterval :: shiftPlus (int delta)
-{
- t1_ += delta;
- t2_ = t1_ + (delta - 1);
- adjustIntervaltoChronon();
-}
-
-
-void
-TeTimeInterval :: shiftMinus (int delta)
-{
- t1_ -= delta;
- t2_ = t1_ + (-delta);
- adjustIntervaltoChronon();
-}
-
-bool
-TeTimeInterval :: during (TeTime& time)
-{
- if(intChronon_==TeMONTHOFYEAR)
- return ((this->getT1().month()<=time.month()) && (this->getT2().month()>=time.month()));
-
- if (intChronon_==TeDAYOFMONTH)
- return ((this->getT1().day()<=time.day()) && (this->getT2().day()>=time.day()));
-
- if (intChronon_== TeDAYOFWEEK)
- return ((this->getT1().weekDay()<=time.weekDay()) && (this->getT2().weekDay()>=time.weekDay()));
-
- if (intChronon_== TeDAYOFYEAR)
- return ((this->getT1().yearDay()<=time.yearDay()) && (this->getT2().yearDay()>=time.yearDay()));
-
- if (intChronon_== TeHOUROFDAY)
- return ((this->getT1().hour()<=time.hour()) && (this->getT2().hour()>=time.hour()));
-
- if (intChronon_==TeMINUTEOFHOUR)
- return ((this->getT1().minute()<=time.minute()) && (this->getT2().minute()>=time.minute()));
-
- if (intChronon_==TeSECONDOFMINUTE)
- return ((this->getT1().second()<=time.second()) && (this->getT2().second()>=time.second()));
-
- return ((this->getT1()<=time) && (time<=this->getT2()));
-}
-
-bool
-TeTimeInterval :: before (TeTime& time)
-{
- if(intChronon_==TeMONTHOFYEAR)
- return (time.month() < this->getT1().month());
-
- if (intChronon_==TeDAYOFMONTH)
- return (time.day() < this->getT1().day());
-
- if (intChronon_== TeDAYOFWEEK)
- return (time.weekDay() < this->getT1().weekDay());
-
- if (intChronon_== TeDAYOFYEAR)
- return (time.yearDay() < this->getT1().yearDay());
-
- if (intChronon_== TeHOUROFDAY)
- return (time.hour() < this->getT1().hour());
-
- if (intChronon_==TeMINUTEOFHOUR)
- return (time.minute() < this->getT1().minute());
-
- if (intChronon_==TeSECONDOFMINUTE)
- return (time.second() < this->getT1().second());
-
- return (time < this->getT1());
-}
diff --git a/src/terralib/kernel/TeTimeInterval.h b/src/terralib/kernel/TeTimeInterval.h
deleted file mode 100644
index 3d653c1..0000000
--- a/src/terralib/kernel/TeTimeInterval.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeTimeInterval.h
- \brief This file contains structures and definitions to deal with date and time intervals
-*/
-
-#ifndef __TERRALIB_INTERNAL_TIMEINTERVAL_H
-#define __TERRALIB_INTERNAL_TIMEINTERVAL_H
-
-#include "TeTime.h"
-
-//! This class provides a set of functions for manipulating date and time intervals
-class TL_DLL TeTimeInterval
-{
-private:
-
- TeTime t1_;
- TeTime t2_;
- TeChronon intChronon_;
-
- void adjustIntervaltoChronon ();
-
-public:
-
- //! Set the date and time from the system clock
- void now(void) {t1_.now(); t2_.now();}
-
- //! Empty constructor
- TeTimeInterval (void): t1_(), t2_() {}
-
- //! Set all time information from the system clock
- TeTimeInterval (TeTime& t1, TeTime& t2): t1_(t1), t2_(t2) {}
-
- //! Copy constructor.
- TeTimeInterval(const TeTimeInterval& t): t1_(t.t1_), t2_(t.t2_) {}
-
- //! Set date and time from arguments, though the time fields defaults to zero.
- TeTimeInterval(const std::string& t1, const std::string& t2, TeChronon chronon=TeSECOND, const std::string& mask="YYYYsMMsDDsHHsmmsSS", const std::string& dateS = "/", const std::string& timeS = ":", const std::string& indPM = "PM");
-
- //! Set date and time from arguments, though the time fields defaults to zero.
- TeTimeInterval(const std::string& t1, TeChronon chronon=TeSECOND, const std::string& mask="YYYYsMMsDDsHHsmmsSS", int delta = 0, int numsteps = 1):
- t1_ (t1, chronon, mask)
- {
- t2_ = t1_ + (delta-1)*numsteps;
- adjustIntervaltoChronon();
- }
-
- //! Returns the chronon of the interval
- TeChronon intervalChronon() { return intChronon_; }
-
- //! Sets the chronon of the interval
- void intervalChronon(TeChronon c);
-
- //! Return a time of day std::string in format "hh:mm:ss"
- std::string getInitialTime() {return t1_.getTime();}
-
- //! Return a time of day std::string in format "hh:mm:ss"
- std::string getFinalTime() {return t2_.getTime();}
-
- //! Return a std::string to the date in the form "yyyy-mm-dd"
- std::string getInitialDate(void) {return t1_.getDate();}
-
- //! Return a std::string to the date in the form "yyyy-mm-dd"
- std::string getFinalDate(void) {return t2_.getDate();}
-
- //! Return the time t1_
- TeTime& getT1 (void) {return t1_;}
-
- //! Return the time t2_
- TeTime& getT2 (void) {return t2_;}
-
- //! Return a pointer to the date and time in the form passed in mask.
- std::string getInitialDateTime (const std::string& mask="YYYYsMMsDDsHHsmmsSS", const std::string& dateS="/", const std::string& timeS=":", const std::string& indPM="PM", const std::string& indAM="AM") {return t1_.getDateTime(mask, dateS, timeS, indPM, indAM);}
-
- //! Return a pointer to the date and time in the form passed in mask.
- std::string getFinalDateTime (const std::string& mask="YYYYsMMsDDsHHsmmsSS", const std::string& dateS="/", const std::string& timeS=":", const std::string& indPM="PM", const std::string& indAM="AM") {return t2_.getDateTime(mask, dateS, timeS, indPM, indAM);}
-
-
- //! Reset time to the specified arguments. Return time_t: number of seconds since 0:00:00 Jan 1 1987
- /*!
- \param y year
- \param m month
- \param d day
- \param h hour
- \param min minutes
- \param s seconds
- */
- time_t setInitialTime (int y, int m, int d, int h = 0, int min = 0, int s = 0)
- {return t1_.Set(y, m, d, h, min, s);}
-
-
- //! Reset time to the specified arguments. Return time_t: number of seconds since 0:00:00 Jan 1 1987
- /*!
- \param y year
- \param m month
- \param d day
- \param h hour
- \param min minutes
- \param s seconds
- */
- time_t setFinalTime (int y, int m, int d, int h = 0, int min = 0, int s = 0)
- {return t2_.Set(y, m, d, h, min, s);}
-
- //! Assignment operator for TeTime objects.
- TeTimeInterval& operator=(const TeTimeInterval& t) {t1_ = t.t1_; t2_ = t.t2_; intChronon_ = t.intChronon_; return (*this);}
-
- //! Operator ==
- bool operator==(const TeTimeInterval& other) const { return (this->t1_ == other.t1_ && this->t2_ == other.t2_); }
-
- bool operator<(const TeTimeInterval& other) const { return (this->t1_ < other.t1_ && this->t2_ < other.t2_); }
-
- //! Compute legnth of time interval in units of chonon
- int length ();
-
- //! Shift the interval, begining at time t (in the form "yyyy-mm-dd hh:mm:ss").
- /*!
- If t is not provided, the current final time becomes the initial time.
- The interval length is maintained.
- */
- void shift (const std::string& t = "");
-
-
- //! Shift the interval, begining delta units after the initial time. The interval length is maintained.
- void shiftPlus (int delta);
-
- //! Shift the interval, begining delta units before the initial time. The interval length is maintained.
- void shiftMinus (int delta);
-
- //! verify if the times have null values
- bool isValid()
- { return (t1_.isValid() || t2_.isValid()); }
-
- //! Normal destructor.
- ~TeTimeInterval(void) { }
-
- //! Verify if a specific time is during the interval time
- bool during (TeTime& time);
-
- //! Verify if a specific time is before the interval time
- bool before (TeTime& time);
-
-};
-
-//! Standard output operator definition
-TL_DLL std::ostream& operator<<(std::ostream& os, TeTime& N);
-
-#endif
-
-
diff --git a/src/terralib/kernel/TeTin.cpp b/src/terralib/kernel/TeTin.cpp
deleted file mode 100644
index b591b1d..0000000
--- a/src/terralib/kernel/TeTin.cpp
+++ /dev/null
@@ -1,1796 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeTin.h"
-#include "TeStdFile.h"
-#include "TeException.h"
-#include "TeGeometryAlgorithms.h"
-
-#include <iostream>
-#include <fstream>
-#include <algorithm>
-
-// TeTinTriangleSet
-
-bool
-TeTinTriangleSet::loadFromFile(std::string &fileName)
-{
-// Open tin triangles file
- std::string trianglesFile = fileName;
- trianglesFile += ".tpl";
-
- std::ifstream inStream;
- inStream.open( trianglesFile.data(), std::ios::in | std::ios::binary );
-
- if (! inStream.good() )
- return false;
-
- long laux;
-//#if defined(SPRWIN) || defined(LITTLEENDIAN) - File is saved in LITTLEENDIAN
- inStream.read((char*)&laux, sizeof(long));
- long numTriangles = laux;
-
-// Create and std::set tin triangles std::vector
- if ( this->size () )
- this->clear ();
- this->reserve (numTriangles);
-
-// Read file for triangles data load
- long lineid [3];
- for (long i = 0; i < numTriangles; i++)
- {
- for (long j = 0; j < 3; j++)
- {
- if (! inStream.good() )
- return false;
- inStream.read((char*)&laux, sizeof(long));
- lineid[j] = laux;
- }
- this->add ( TeTinTriangle (lineid[0],lineid[1],lineid[2]) );
-// triangles_[i].setEdges(lineid[0],lineid[1],lineid[2]);
- }
- return true;
-}
-
-bool
-TeTinVertexSet::loadFromFile(std::string &fileName)
-{
-// Open tin vertices file
- std::string verticesFile = fileName;
- verticesFile += ".tnd";
-
- std::ifstream inStream;
- inStream.open( verticesFile.data(), std::ios::in | std::ios::binary );
-
- if (! inStream.good() )
- return false;
-
- long laux;
-//#if defined(SPRWIN) || defined(LITTLEENDIAN) - File is saved in LITTLEENDIAN
- inStream.read((char*)&laux, sizeof(long));
- long numVertices = laux;
-
-// Create and std::set tin vertices std::vector
- if ( this->size () )
- this->clear ();
- this->reserve (numVertices);
-
-// Read file for vertices data load
- double x, y;
- double value;
- short vertexType;
- for (long i = 0; i < numVertices; i++)
- {
- if (! inStream.good() )
- return false;
- inStream.read((char*)&x, sizeof(double));
- if (! inStream.good() )
- return false;
- inStream.read((char*)&y, sizeof(double));
- if (! inStream.good() )
- return false;
- inStream.read((char*)&value, sizeof(double));
- if (! inStream.good() )
- return false;
- inStream.read((char*)&vertexType, sizeof(short));
- this->add( TeTinVertex (TeCoord2D (x,y), value,
- (TeTinVertexType) vertexType, -1 ) );
- }
- return true;
-}
-
-bool
-TeTinEdgeSet::loadFromFile(std::string &fileName)
-{
-// Open tin edges file
- std::string edgesFile = fileName;
- edgesFile += ".tln";
-
- std::ifstream inStream;
- inStream.open( edgesFile.data(), std::ios::in | std::ios::binary );
-
- if (! inStream.good() )
- return false;
-
- long laux;
-//#if defined(SPRWIN) || defined(LITTLEENDIAN) - File is saved in LITTLEENDIAN
- inStream.read((char*)&laux, sizeof(long));
- long numEdges = laux;
-
-// Create and std::set tin edges std::vector
- if ( this->size () )
- this->clear ();
- this->reserve (numEdges);
-
-// Read file for edges data load
- long from, to, left, right;
- for (long i = 0; i < numEdges; i++)
- {
- if (! inStream.good() )
- return false;
- inStream.read((char*)&from, sizeof(long));
- if (! inStream.good() )
- return false;
- inStream.read((char*)&to, sizeof(long));
-
- if (! inStream.good() )
- return false;
- inStream.read((char*)&left, sizeof(long));
- if (! inStream.good() )
- return false;
- inStream.read((char*)&right, sizeof(long));
-
- this->add( TeTinEdge (from, to, left, right, NORMALEDGE) );
- }
- return true;
-}
-
-
-// TeTin
-
-bool
-TeTin::loadFromFile(std::string &fileName)
-{
- if ( triangleSet_.loadFromFile ( fileName ) )
- {
- if ( vertexSet_.loadFromFile ( fileName ) )
- {
- if ( edgeSet_.loadFromFile ( fileName ) )
- return true;
- }
- }
- return false;
-}
-
-bool
-TeTin::getLines(TeLineSet &lineSet)
-{
- std::vector<TeTinEdge>::iterator i = edgeSet_.begin();
- while ( i != edgeSet_.end() )
- {
- long from = (*i).from();
- long to = (*i).to();
- TeCoord2D ptf = vertexSet_[from].location();
- TeCoord2D ptt = vertexSet_[to].location();
- i++;
-
- TeLine2D line;
- line.add (ptf);
- line.add (ptt);
- lineSet.add(line);
- }
- return true;
-}
-
-long
-TeTin::oneEdgeWithVertex(long v)
-{
- long vsize = vertexSet_.size();
- long edge;
- if (v < vsize)
- {
- TeTinVertex vv = vertexSet_[v];
- edge = vv.oneEdge();
- }
- else
- return -1;
-
- // Test to make sure there is no wrong index
- if ( edge != -1 )
- if ( ( edgeSet_[edge].to() == v ) ||
- ( edgeSet_[edge].from() == v ) )
- return edge;
-
- //Fail safe code, must return from previous code
- static long oldedge = 0; // Set one edge only once
-
- long j = 0;
- while (j < 2)
- {
- unsigned long i;
- for (i = oldedge; i < edgeSet_.size(); i++)
- {
- long from = edgeSet_[i].from();
- long to = edgeSet_[i].to();
- if ( from == -1 || to == -1 )
- continue;
- if (from == v || to == v)
- {
- oldedge = i;
- return i;
- }
- }
- oldedge = 0;
- j++;
- }
- return -1;
-}
-
-long
-TeTin::edgeOppVertex(TeTinTriangle& t, long v)
-{
- long edges[3];
- t.edges(edges[0],edges[1],edges[2]);
-
- for (long i = 0; i < 3; i++)
- {
- if ( edgeSet_[edges[i]].from() != v &&
- edgeSet_[edges[i]].to() != v )
- return edges[i];
- }
- return -1;
-}
-
-long
-TeTin::vertexOppEdge(long t, long e)
-{
- long edges[3];
- triangleSet_[t].edges(edges[0],edges[1],edges[2]);
-
- long vef(-1), vet(-1);
- unsigned long i;
- for (i = 0; i < 3; i++)
- {
- if ( edges[i] == e )
- {
- vef = edgeSet_[edges[i]].from();
- vet = edgeSet_[edges[i]].to();
- break;
- }
- }
- if ( vef == -1 )
- return -1;
-
- for (i = 0; i < 3; i++)
- {
- if ( edges[i] != e )
- {
- if ( vef == edgeSet_[edges[i]].from() ||
- vet == edgeSet_[edges[i]].from() )
- return edgeSet_[edges[i]].to();
- if ( vef == edgeSet_[edges[i]].to() ||
- vet == edgeSet_[edges[i]].to() )
- return edgeSet_[edges[i]].from();
- return -1;
- }
- }
- return -1;
-}
-
-long
-TeTin::edgeWithVertexDiffFromEdge(long t, long v, long e)
-{
- long edges[3];
- triangleSet_[t].edges(edges[0],edges[1],edges[2]);
-
- for (long i = 0; i < 3; i++)
- {
- if ( edges[i] == e )
- continue;
- if ( edgeSet_[edges[i]].from() == v ||
- edgeSet_[edges[i]].to() == v )
- return edges[i];
- }
- return -1;
-}
-
-bool
-TeTin::vertexOppEdges(long v, std::list<long> &edges)
-{
-// Find one line that contains node
- long a = oneEdgeWithVertex(v);
- if (a == -1)
- return false;
-
-// 1. Defina td como sendo o tri�ngulo que est� � direita da aresta a e
- long td = edgeSet_[a].right(); // te como sendo o tri�ngulo que est�
- long te = edgeSet_[a].left(); // � esquerda de a,
-
- long ai = a; // 2. Defina ai como sendo aresta a
- long ti = td;// e ti como sendo o tri�ngulo td,
-
- long ao;
-
- if ( ti != -1 ) // 3. Se o tri�ngulo ti n�o for nulo,
- { // insira aresta ao de ti que n�o � diretamente
- ao = edgeOppVertex ( ti, v );// conectado a v no conjunto A,
- if (ao == -1)
- return false;
- edges.push_back (ao);
- }
-
- while (ti != te)// 4. Enquanto ti for diferente do tri�ngulo te,
- {
- if (ti == -1)// 4.1. Se o tri�ngulo ti � nulo (esta' na
- { // borda da triangula��o) fa�a:
- ti = te; // 4.1.1. Defina ti como sendo o tri�ngulo te,
- te = -1; // 4.1.2. Defina te como sendo nulo,
- ai = a; // 4.1.3. Defina ai como sendo aresta a,
- if ( ti != -1 ) // 4.1.4. Se o tri�ngulo ti n�o for nulo,
- { // insira aresta ao de ti que n�o � diretamente
- ao = edgeOppVertex ( ti, v );// conectado a v
- if (ao == -1)
- return false;
- edges.push_back (ao); // a v no conjunto A,
- }
- continue;// 4.1.5. Retorne a 4.
- }
-
- long aaux = edgeWithVertexDiffFromEdge ( ti, v, ai );// 4.2. Defina a
- if (aaux == -1) // aresta aaux do tri�ngulo ti que conecta o
- return false;// v�rtice v e � diferente de ai,
-
- long taux;
- if (edgeSet_[aaux].right() == ti) // 4.3. Defina taux como sendo
- taux = edgeSet_[aaux].left();// o tri�ngulo que compartilha
- else if (edgeSet_[aaux].left() == ti)// a aresta aaux com ti,
- taux = edgeSet_[aaux].right();
- else
- return false;
-
- ti = taux;// 4.4. Defina ti como sendo o tri�ngulo taux e ai
- ai = aaux;// como sendo aresta aaux,
-
- if ( ti != -1 )// 4.5. Se o tri�ngulo ti n�o for nulo, insira
- { // aresta ao de ti que n�o � diretamente
- ao = edgeOppVertex ( ti, v ); // conectado a v
- if (ao == -1) // no conjunto A,
- return false;
- edges.push_back (ao);
- }
- } // 4.6. Retorne a 4.
- return true;
-}
-
-bool
-TeTin::vertexEdges(long v, std::list<long> &edges)
-{
-// Find one line that contains node
- long a = oneEdgeWithVertex(v);
- if (a == -1)
- return false;
-
-// 1. Defina td como sendo o tri�ngulo que est� � direita da aresta a e
- long td = edgeSet_[a].right(); // te como sendo o tri�ngulo que est�
- long te = edgeSet_[a].left(); // � esquerda de a,
-
- long ai = a; // 2. Defina ai como sendo aresta a
- long ti = td;// e ti como sendo o tri�ngulo td,
-
- edges.push_back (ai);// 3. Insira a aresta ai no conjunto A,
-
- while (ti != te)// 4. Enquanto ti for diferente do tri�ngulo te,
- {
- if (ti == -1)
- {// 4.1. Se o tri�ngulo ti � nulo (esta' na borda da triangula��o) fa�a:
- ti = te;// 4.1.1. Defina ti como sendo o tri�ngulo te,
- te = -1;// 4.1.2. Defina te como sendo nulo,
- ai = a;// 4.1.3. Defina ai como sendo aresta a,
- continue;// 4.1.4. Retorne a 4.
- }
-
- long aaux = edgeWithVertexDiffFromEdge ( ti, v, ai );// 4.2. Defina a
- if (aaux == -1) // aresta aaux do tri�ngulo ti que conecta o
- return false;// v�rtice v e � diferente de ai,
-
- long taux;
- if (edgeSet_[aaux].right() == ti) // 4.3. Defina taux como sendo
- taux = edgeSet_[aaux].left();// o tri�ngulo que compartilha
- else if (edgeSet_[aaux].left() == ti)// a aresta aaux com ti,
- taux = edgeSet_[aaux].right();
- else
- return false;
-
- ti = taux;// 4.4. Defina ti como sendo o tri�ngulo taux e ai
- ai = aaux;// como sendo aresta aaux,
-
- edges.push_back (ai);// 4.5. Se o tri�ngulo ti n�o for nulo, insira
- } // 4.6. Retorne a 4.
- return true;
-}
-
-bool
-TeTin::vertexOppVertices(long v, std::list<long> &vertices)
-{
-// Find one line that contains node
- long a = oneEdgeWithVertex(v);
- if (a == -1)
- return false;
-
-// 1. Defina td como sendo o tri�ngulo que est� � direita da aresta a e
- long td = edgeSet_[a].right(); // te como sendo o tri�ngulo que est�
- long te = edgeSet_[a].left(); // � esquerda de a,
-
- long ai = a; // 2. Defina ai como sendo aresta a
- long ti = td;// e ti como sendo o tri�ngulo td,
-
- long vi = edgeSet_[a].from();// 3. Insira o v�rtice diferente de v
- if (vi == v) // conectado � aresta ai no conjunto V,
- vi = edgeSet_[a].to();
- vertices.push_back (vi);
-
- while (ti != te)// 4. Enquanto ti for diferente do tri�ngulo te,
- {
- if (ti == -1)// 4.1. Se o tri�ngulo ti � nulo (esta' na borda
- { // da triangula��o) fa�a:
- ti = te; // 4.1.1. Defina ti como sendo o tri�ngulo te,
- te = -1; // 4.1.2. Defina te como sendo nulo,
- ai = a; // 4.1.3. Defina ai como sendo aresta a,
- continue;// 4.1.4. Retorne a 4.
- }
-
- long aaux = edgeWithVertexDiffFromEdge ( ti, v, ai );// 4.2. Defina a
- if (aaux == -1) // aresta aaux do tri�ngulo ti que conecta o
- return false;// v�rtice v e � diferente de ai,
-
- long taux;
- if (edgeSet_[aaux].right() == ti) // 4.3. Defina taux como sendo
- taux = edgeSet_[aaux].left();// o tri�ngulo que compartilha
- else if (edgeSet_[aaux].left() == ti)// a aresta aaux com ti,
- taux = edgeSet_[aaux].right();
- else
- return false;
-
- ti = taux;// 4.4. Defina ti como sendo o tri�ngulo taux e ai
- ai = aaux;// como sendo aresta aaux,
-
- vi = edgeSet_[ai].from();// 4.5. Insira o v�rtice diferente
- if (vi == v) // de v conectado � aresta ai no conjunto V,
- vi = edgeSet_[ai].to();
- vertices.push_back (vi);
- }// 4.6. Retorne a 4.
- return true;
-}
-
-bool
-TeTin::vertexTriangles(long v, std::list<long> &triangles)
-{
-// Find one line that contains node
- long a = oneEdgeWithVertex(v);
- if (a == -1)
- return false;
-
-// 1. Defina td como sendo o tri�ngulo que est� � direita da aresta a e
- long td = edgeSet_[a].right(); // te como sendo o tri�ngulo que est�
- long te = edgeSet_[a].left(); // � esquerda de a,
-
- long ai = a; // 2. Defina ai como sendo aresta a
- long ti = td;// e ti como sendo o tri�ngulo td,
-
- if ( ti != -1 ) // 3. Se o tri�ngulo ti n�o for nulo,
- { // insira ti no conjunto T,
- triangles.push_back (ti);
- }
-
- while (ti != te)// 4. Enquanto ti for diferente do tri�ngulo te,
- {
- if (ti == -1)// 4.1. Se o tri�ngulo ti � nulo (esta' na
- { // borda da triangula��o) fa�a:
- ti = te; // 4.1.1. Defina ti como sendo o tri�ngulo te,
- te = -1; // 4.1.2. Defina te como sendo nulo,
- ai = a; // 4.1.3. Defina ai como sendo aresta a,
- if ( ti != -1 ) // 4.1.4. Se o tri�ngulo ti n�o for nulo,
- { // insira ti no conjunto T,
- triangles.push_back (ti);
- }
- continue;// 4.1.5. Retorne a 4.
- }
-
- long aaux = edgeWithVertexDiffFromEdge ( ti, v, ai );// 4.2. Defina a
- if (aaux == -1) // aresta aaux do tri�ngulo ti que conecta o
- return false;// v�rtice v e � diferente de ai,
-
- long taux;
- if (edgeSet_[aaux].right() == ti) // 4.3. Defina taux como sendo
- taux = edgeSet_[aaux].left();// o tri�ngulo que compartilha
- else if (edgeSet_[aaux].left() == ti)// a aresta aaux com ti,
- taux = edgeSet_[aaux].right();
- else
- return false;
-
- ti = taux;// 4.4. Defina ti como sendo o tri�ngulo taux e ai
- ai = aaux;// como sendo aresta aaux,
-
- if ( ti != -1 )// 4.5. Se o tri�ngulo ti n�o for nulo, insira
- { // aresta ao de ti que n�o � diretamente
- triangles.push_back (ti);
- }
- } // 4.6. Retorne a 4.
- return true;
-}
-
-bool
-TeTin::vertexOppEdges(long v, std::list<long> &triset, std::list<long> &edges)
-{
- std::list<long>::iterator tii;
- for (tii = triset.begin(); tii != triset.end(); tii++)
- {
- long ti = *tii;
- long nedge = this->edgeOppVertex(ti, v);
- edges.push_back(nedge);
- }
- return true;
-}
-
-long
-TeTin::oneTriangleWithVertex(long v)
-{
-// Find one line that contains node
- long a = oneEdgeWithVertex(v);
- if (a == -1)
- return -1;
-
- long td = edgeSet_[a].right();
- if ( td == -1 )
- return edgeSet_[a].left();
- else
- return td;
-}
-
-bool
-TeTin::triangleContainsPoint(TeTinTriangle& t, TeCoord2D& pt)
-{
- double totalArea, triangleArea;
- TeCoord2D vert[3];
-
- this->trianglePoints(t, vert[0], vert[1], vert[2]);
-
-// Calculate the base triangle area
- triangleArea = fabs(( (vert[1].x() - vert[0].x()) *
- (vert[2].y() - vert[0].y()) ) -
- ( (vert[2].x() - vert[0].x()) *
- (vert[1].y() - vert[0].y()) ));
- triangleArea *= 1.00001;
- totalArea = fabs(( (vert[0].x() - pt.x()) * (vert[1].y() - pt.y()) ) -
- ( (vert[1].x() - pt.x()) * (vert[0].y() - pt.y()) ));
- if (totalArea > triangleArea)
- return false;
-
- totalArea += fabs(( (vert[1].x() - pt.x()) * (vert[2].y() - pt.y()) ) -
- ( (vert[2].x() - pt.x()) * (vert[1].y() - pt.y()) ));
- if (totalArea > triangleArea)
- return false;
-
- totalArea += fabs(( (vert[0].x() - pt.x()) * (vert[2].y() - pt.y()) ) -
- ( (vert[2].x() - pt.x()) * (vert[0].y() - pt.y()) ));
- if (totalArea > triangleArea)
- return false;
-
- return true;
-}
-
-long
-TeTin::triangleAt (TeCoord2D& pt)
-{
-//Seja v um v�rtice qualquer da triangula��o T e p o ponto para o qual se deseja saber qual tri�ngulo t
-// o cont�m.
- long vi1;
-
- TeTinEdgeSet::reverse_iterator i = edgeSet_.rbegin();
- while ( i != edgeSet_.rend() )
- {
- vi1 = (*i++).from();
- if (vi1 >= 0 ) // -1L)
- break;
- }
- if ( i == edgeSet_.rend() )
- return -1;
-
-//1. Defina o conjunto T={t1,..., tm} com os m tri�ngulos que compartilham o v�rtice vi,
- std::list<long> triset;
- this->vertexTriangles(vi1, triset);
-
- TeCoord2D pf = vertexSet_[vi1].location();
- if ( pf == pt )
-//2. Se vi � igual a p, o tri�ngulo que cont�m p � um dos tri�ngulos que compartilham vi.
-// Escolha qualquer um dos tri�ngulos e termine o algoritmo.
- return ( *(triset.begin()) );
-
-//3. Defina A={a1,...,an} com as n arestas opostas a vi,
- std::list<long> aedges;
- this->vertexOppEdges(vi1, triset, aedges);
-
-//4. Defina V={v1,...,vm} com os m v�rtices dos tri�ngulos que cont�m o v�rtice vi,
- std::list <long> vvertex;
- this->vertexOppVertices(vi1, vvertex);
-
-//5. Insira o v�rtice v no conjunto VI de v�rtices intersectados,
- std::set <long> viset;
- viset.insert(vi1);
-
-//6. Defina o v�rtice auxiliar vaux como sendo vi,
- long vaux = vi1;
-// e aresta aaux como sendo inv�lida
- long aaux = -1;
- std::vector<long> auxset(3);
- for (;;)
- {
-//7. Para cada tri�ngulo ti de T, fa�a:
- std::list<long>::iterator tii;
- for (tii = triset.begin(); tii != triset.end(); tii++)
- {
- long ti = *tii;
-//7.1. Se o tri�ngulo ti cont�m o ponto pn, termine o algoritmo.
- if ( this->triangleContainsPoint( ti, pt ) )
- return ti;
- }
-//8. Para cada v�rtice vi de V, fa�a:
- std::list<long>::iterator vii;
- for (vii = vvertex.begin(); vii != vvertex.end(); vii++)
- {
- long vi = *vii;
- TeCoord2D ptvi = vertexSet_[vi].location();
- if ( ptvi == pt )
-//8.1. Se vi � igual a p, o tri�ngulo que cont�m p � um dos tri�ngulos que compartilham vi.
- {
- for (tii = triset.begin(); tii != triset.end(); tii++)
- {
- long ti = *tii;
- long v0, v1, v2;
- this->triangleVertices(ti, v0, v1, v2);
- if ( v0 == vi || v1 == vi || v2 == vi)
- return ti;
- }
- return -1;
- }
- }
-//9. Para cada v�rtice vi de V, fa�a:
- for ( vii = vvertex.begin(); vii != vvertex.end(); vii++)
- {
- long vi = *vii;
-//9.1. Se vi est� sobre r, fa�a:
- TeCoord2D ptvi = vertexSet_[vi].location();
- TeCoord2D pinter;
- if ( TePerpendicularDistance(pf, pt, ptvi, pinter) < TePrecision::instance().precision() )
- {
- TeBox box1;
- updateBox (box1, pf);
- updateBox (box1, pt);
-
- if (TeWithin (pinter, box1) )
- {
-//9.1.1. Redefina o conjunto A={a1,..., an} com as n arestas opostas a vi, diferentes de aaux,
- aedges.clear();
- this->vertexOppEdges(vi, aedges);
-//9.1.2. Defina o conjunto Aaux={a1,..., am} com as m arestas compartilhadas por vaux,
- std::list <long> vauxedges;
- this->vertexEdges(vaux, vauxedges);
-//9.1.3. Exclua do conjunto A todas as arestas que pertencem ao conjunto Aaux,
- for (std::list<long>::iterator vai = vauxedges.begin(); vai != vauxedges.end(); vai++)
- aedges.remove ( *vai );
-//9.1.4. Exclua do conjunto A a aresta aaux,
- aedges.remove ( aaux ); // better perfomance than remove algorithm
-//9.1.5. Redefina o conjunto V={v1,..., vm} com os m v�rtices dos tri�ngulos que cont�m o v�rtice vi,
-// diferentes de vaux,
- vvertex.clear();
- this->vertexOppVertices(vi, vvertex);
-//9.1.6. Exclua do conjunto V todos os v�rtices que pertencem ao conjunto VI,
- for (std::set<long>::iterator vvi = viset.begin(); vvi != viset.end(); vvi++)
- vvertex.remove ( *vvi );
-//9.1.7. Redefina o conjunto T={t1, ..., tk } com os k tri�ngulos que cont�m o v�rtice vi,
- triset.clear();
- this->vertexTriangles(vi, triset);
-//9.1.8. Redefina o v�rtice auxiliar vaux como sendo vi,
- vaux = vi;
-//9.1.8. Insira o v�rtice vi no conjunto VI de v�rtices intersectados,
- viset.insert(vi);
-//9.1.8. Retorne a 7,
- //pf = vertexSet_[vi].location();
- break;
- }
- }
- }
- if ( vii != vvertex.end() )
- continue; // do for (;;)
-
-//10. Para cada aresta ai de A, fa�a:
- std::list<long>::iterator aii;
- for (aii = aedges.begin(); aii != aedges.end(); aii++)
- {
- long ai = *aii;
-//10.1. Se o ponto p est� sobre ai, fa�a:
- TeCoord2D pfr = vertexSet_[edgeSet_[ai].from()].location();
- TeCoord2D pto = vertexSet_[edgeSet_[ai].to()].location();
- TeCoord2D pinter;
- if ( TePerpendicularDistance(pfr, pto, pt, pinter) < TePrecision::instance().precision() )
- {
- TeBox box1;
- updateBox (box1, pfr);
- updateBox (box1, pto);
- if (TeWithin(pinter, box1) )
- {
-//10.1.1. Escolha qualquer um dos tri�ngulos que compartilham ai.
- long ti = edgeSet_[ai].left();
-//10.1.2. Termine o algoritmo.
- if ( (ti != -1) && (this->triangleContainsPoint(ti, pt)) )
- return ( ti );
- else
- {
- ti = edgeSet_[ai].right();
- if ( (ti != -1) && (this->triangleContainsPoint(ti, pt)) )
- return ( ti );
- return -1;
- }
- }
- }
- }
-
-//11. Para cada aresta ai de A, fa�a:
- for (aii = aedges.begin(); aii != aedges.end(); aii++)
- {
- long ai = *aii;
- long vt = edgeSet_[ai].to();
- long vf = edgeSet_[ai].from();
- TeCoord2D pi;
-//11.1. Se ai intersecta r, fa�a:
- if (TeSegmentsIntersectPoint(vertexSet_[vt].location(), vertexSet_[vf].location(), pf, pt, pi) )
- {
-//11.1.2. Defina os tri�ngulos t1 e t2 que compartilham a aresta ai.
-//11.1.3. Se t2 est� contido no conjunto T , ent�o fa�a taux=t1,
- long taux = edgeSet_[ai].left();
- if (taux == -1)
- return -1;
- std::list<long>::iterator pos1 = find (triset.begin(), triset.end(), taux);
- if ( pos1 != triset.end() )
-//11.1.4. Sen�o, fa�a taux=t2,
- taux = edgeSet_[ai].right();
- if (taux == -1)
- return -1;
-//11.1.5. Se o tri�ngulo taux cont�m o ponto pn, termine o algoritmo.
- if ( this->triangleContainsPoint( taux, pt ) )
- return taux;
-//11.1.6. Redefina o conjunto A={a1, a2} com as arestas do tri�ngulo taux diferentes de ai,
- triangleSet_[taux].edges ( auxset[0], auxset[1], auxset[2] );
- aedges.clear();
- aedges.insert( aedges.begin(), auxset.begin(), auxset.end() );
- aedges.remove( ai );
-//11.1.7. Redefina o conjunto V={v1}. O v�rtice v1 � o v�rtice do tri�ngulo taux que n�o est�
-// em nenhuma extremidade da aresta ai,
- long vaux1 = edgeSet_[ai].from();
- long vaux2 = edgeSet_[ai].to();
- this->triangleVertices ( taux, auxset[0], auxset[1], auxset[2]);
- vvertex.clear();
- vvertex.insert ( vvertex.begin(), auxset.begin(), auxset.end() );
- vvertex.remove ( vaux1 );
- vvertex.remove ( vaux2 );
-
-//11.1.8. Redefina o conjunto T={taux},
- triset.clear();
- triset.push_back ( taux );
-//11.1.9. Redefina aaux como sendo ai,
- aaux = ai;
-//11.1.10. Retorne a 8;
- break;
- }
- }
-//12. Se n�o h� mais arestas em A, ent�o:
- if ( aii == aedges.end() )
- {
-//12.1. Para cada tri�ngulo ti de T, fa�a:
-// TeTinTriangleIterator tii;
-// for ( tii = triangleBegin(); tii != triangleEnd(); tii++)
- long ti;
- long tEnd = triangleSet_.size();
- for ( ti = 0; ti < tEnd; ti++)
- {
-// TeTinTriangle ti = *tii;
- //12.1.1. Se o tri�ngulo ti cont�m o ponto pn, termine o algoritmo.
- if ( this->triangleContainsPoint( ti, pt ) )
- return ti;
- }
- if (ti == tEnd )
- return -1;
- }
- } // Do for (;;)
- return -1;
-}
-
-bool
-TeTin::insertPoint(double x, double y, double value)
-{
-// Get Point to be inserted from std::vector
- TeCoord2D pt(x,y);
- if ( ! TeWithin (pt, vertexSet_.box()) )
- return false;
-
-// Find the triangle that owns the point pt
- long t = triangleAt ( pt );
-
- if (t == -1)
- return false;
-
- TeCoord2D vert[3];
- trianglePoints(t, vert[0], vert[1], vert[2]);
-
-
-
-// Verify if point is too close to one triangle vertex
- long j;
- for ( j = 0; j < 3; j++)
- {
- if (pt == vert[j]) // Using precision to compare
- return false;
- }
-
-// Test if the point is on an edge
- long nedge = -1;
- double dmin = TeMAXFLOAT;
- TeCoord2D pmin;
- for (j = 0; j < 3; j++)
- {
- if ( TeWithinOrTouches (pt, vert[j], vert[(j+1)%3]) == false )
- continue;
-
- TeCoord2D paux;
- double daux = TePerpendicularDistance(vert[j], vert[(j+1)%3], pt, paux);
- if ((daux < TePrecision::instance().precision()) && (daux < dmin))
- {// On edge j
- nedge = j;
- dmin = daux;
- pmin = paux;
- }
- }
-
- vertexSet_.add( TeTinVertex (pt, value, NORMALVERTEX, -1 ) );
- long v = vertexSet_.size()-1;
-
- std::set<long> trianglesToTest;
- if (nedge == -1) // Not on an edge
- {
- this->twoNewTriangles(t, v, trianglesToTest); //If not, split triang
- }
- else
- {
- long neighids[3];
- this->triangle3Neighbors(t, neighids[0],neighids[1],neighids[2]);
- long edges[3];
- triangleSet_[t].edges( edges[0], edges[1], edges[2] );
- for (j = 0; j < 3; j++)
- { // Check if neighbor triangle opposite vertex is too close
- if ( neighids[j] == -1L )
- continue;
- long oppVertex = edgeOppVertex(neighids[j], edges[j]);
- long vsize = vertexSet_.size();
- if ( oppVertex < vsize )
- {
- TeCoord2D ptaux = vertexSet_[oppVertex].location();
- if ( ptaux == pt )
-// if ( vertexSet_[oppVertex].location() == pt )
- {
- // If necessary add code to change oppVertex type and value
- return false;
- }
- }
- }
-
-// Duplicate triangle and its neighbor on the same edge
- long an0 = this->duplicateTriangle( t, nedge, v, trianglesToTest);
- if (neighids[nedge] != -1L)
- {
- long tv = neighids[nedge];
- this->dupNeighTriangle( tv, an0, v, trianglesToTest);
- }
- }
- this->testDelaunayForVertex(v, trianglesToTest);
- return true;
-}
-
-bool
-TeTin::trianglePoints(TeTinTriangle& t, TeCoord2D& pt0, TeCoord2D& pt1, TeCoord2D& pt2)
-{
- long vertex0, vertex1, vertex2;
- this->triangleVertices(t, vertex0, vertex1, vertex2);
-
- pt0 = vertexSet_[vertex0].location();
- pt1 = vertexSet_[vertex1].location();
- pt2 = vertexSet_[vertex2].location();
-
- return true;
-}
-
-bool
-TeTin::triangleVertices(TeTinTriangle& t, long& vertex0, long& vertex1, long& vertex2)
-{
- long edge0, edge1, edge2;
- t.edges(edge0,edge1,edge2);
-
- if (edgeSet_[edge0].to() == edgeSet_[edge1].to())
- {
- vertex0 = edgeSet_[edge0].from();
- vertex1 = edgeSet_[edge0].to();
- vertex2 = edgeSet_[edge1].from();
- }
- else if (edgeSet_[edge0].to() == edgeSet_[edge1].from())
- {
- vertex0 = edgeSet_[edge0].from();
- vertex1 = edgeSet_[edge0].to();
- vertex2 = edgeSet_[edge1].to();
- }
- else if (edgeSet_[edge0].from() == edgeSet_[edge1].from())
- {
- vertex0 = edgeSet_[edge0].to();
- vertex1 = edgeSet_[edge0].from();
- vertex2 = edgeSet_[edge1].to();
- }
- else if (edgeSet_[edge0].from() == edgeSet_[edge1].to())
- {
- vertex0 = edgeSet_[edge0].to();
- vertex1 = edgeSet_[edge0].from();
- vertex2 = edgeSet_[edge1].from();
- }
- else
- return false;
-
- return true;
-}
-
-bool
-TeTin::triangle3Neighbors(long t, long& neighbor0, long& neighbor1, long& neighbor2)
-{
- long edge0, edge1, edge2;
- triangleSet_[t].edges(edge0,edge1,edge2);
-
- if (edgeSet_[edge0].left() == t)
- neighbor0 = edgeSet_[edge0].right();
- else
- neighbor0 = edgeSet_[edge0].left();
-
- if (edgeSet_[edge1].left() == t)
- neighbor1 = edgeSet_[edge1].right();
- else
- neighbor1 = edgeSet_[edge1].left();
-
- if (edgeSet_[edge2].left() == t)
- neighbor2 = edgeSet_[edge2].right();
- else
- neighbor2 = edgeSet_[edge2].left();
-
- return true;
-}
-
-long
-TeTin::triangleVertexAt(long t, long vertex)
-{
- long vertices[3];
- this->triangleVertices ( t, vertices[0],vertices[1],vertices[2] );
-
- return vertices[vertex];
-}
-
-bool
-TeTin::twoNewTriangles(long t, long v, std::set<long>& triangles)
-{
-//1. Crie o v�rtice vn com os dados da amostra s,
-// Sint4 vn = nodeId;
-
-//2. Crie 2 novos tri�ngulos t1 e t2,
- long t1 = triangleSet_.size();
- long t2 = t1+1;
-
-//3. Crie a nova aresta an0 que conecta os v�rtices vn e v0 e
-// tem t e t1 como os tri�ngulos que compartilham a aresta.
- long v0 = this->triangleVertexAt(t,0); //v0 e' o vertice 0 de t
- edgeSet_.add( TeTinEdge (v, v0, t, t1, NORMALEDGE) );
- long an0 = edgeSet_.size()-1;
- vertexSet_[v].setOneEdge (an0);
-
-//4. Crie a nova aresta an1 que conecta os v�rtices vn e v1 e
-// tem t1 e t2 como os tri�ngulos que compartilham a aresta.
- long v1 = this->triangleVertexAt(t,1); //v1 e' o vertice 1 de t
- edgeSet_.add( TeTinEdge (v, v1, t1, t2, NORMALEDGE) );
- long an1 = edgeSet_.size()-1;
-
-//5. Crie a nova aresta an2 que conecta os v�rtices vn e v2 e
-// tem t2 e t como os tri�ngulos que compartilham a aresta.
- long v2 = this->triangleVertexAt(t,2); //v2 e' o vertice 2 de t
- edgeSet_.add( TeTinEdge (v, v2, t2, t, NORMALEDGE) );
- long an2 = edgeSet_.size()-1;
-
-//6. Troque o tri�ngulo t por t1 na aresta a0,
- long a0 = triangleSet_[t].edgeAt(0); // retorna aresta 0 de t
- edgeSet_[a0].exchangeTriangle(t,t1);
-
-//7. Defina as arestas de t1 como sendo an0, a0 e an1,
- triangleSet_.add ( TeTinTriangle (an0, a0, an1) );
-
-//8. Troque o tri�ngulo t por t2 na aresta a1,
- long a1 = triangleSet_[t].edgeAt(1); // retorna aresta 1 de t
- edgeSet_[a1].exchangeTriangle(t, t2);
-
-//9. Defina as arestas de t2 como sendo an1, a1 e an2,
- triangleSet_.add ( TeTinTriangle (an1, a1, an2) );
-
-//10. Defina as arestas de t como sendo an2, a2 e an0,
- long a2 = triangleSet_[t].edgeAt(2); // retorna aresta 2 de t
- triangleSet_[t].setEdges(an2, a2, an0);
-
- triangles.insert(t);
- triangles.insert(t1);
- triangles.insert(t2);
- return true;
-}
-
-long
-TeTin::duplicateTriangle(long t, long n, long v, std::set<long>& triangles)
-{
-// Seja t o tri�ngulo que cont�m cuja n-�sima aresta an � a aresta
-// pr�xima a amostra s ( n E {0,1,2} ). A aresta an conecta os v�rtices
-// vn e vj, a aresta aj conecta os v�rtices vj e vk e a aresta ak conecta
-// os v�rtices vk e vn, sendo j o resto da divis�o de n+1 por 3 e k o resto
-// da divis�o de n+2 por 3.
- long edges[3];
- triangleSet_[t].edges(edges[0],edges[1],edges[2]);
-
- long an = edges [ n ];
- long aj = edges [ (n+1)%3 ];
- long ak = edges [ (n+2)%3 ];
-
- long vn = this->triangleVertexAt( t, n );
-
-// 1. Crie o v�rtice v com os dados da amostra s,
-// 2. Defina o tri�ngulo tv que compartilha a aresta an com t,
- long tv = 0;
- if (edgeSet_[an].left() == t)
- tv = edgeSet_[an].right();
- else if (edgeSet_[an].right() == t)
- tv = edgeSet_[an].left();
-
-// 3. Defina o v�rtice vop do tri�ngulo t que n�o � conectado a aresta an,
- long vop = this->triangleVertexAt ( t, (n+2)%3 );
-
-// 4. Crie o novo tri�ngulos t1,
- long t1 = triangleSet_.size();
-
-// 5. Crie a nova aresta an0 que conecta os v�rtices v e vn e
-// tem t1 e tv como os tri�ngulos que compartilham a aresta.
- edgeSet_.add( TeTinEdge (v, vn, t1, tv, NORMALEDGE) );
- long an0 = edgeSet_.size()-1;
-
-// 6. Crie a nova aresta an1 que conecta os v�rtices v e vop e
-// tem t e t1 como os tri�ngulos que compartilham a aresta.
- edgeSet_.add( TeTinEdge (v, vop, t, t1, NORMALEDGE) );
- long an1 = edgeSet_.size()-1;
-
-// 7. Modifique a aresta an para conectar o v�rtice v ao inv�s de vn,
- edgeSet_[an].exchangeVertex( vn, v );
- vertexSet_[vn].setOneEdge ( an0 );
-
-// 8. Defina as arestas de t como sendo an, aj e an1,
- triangleSet_[t].setEdges( an, aj, an1 );
-
-// 9. Modifique a aresta ak para compartilhar o tri�ngulo t1 ao inv�s de t,
- edgeSet_[ak].exchangeTriangle( t, t1 );
-
-// 10. Defina as arestas de t1 como sendo an0, an1 e ak,
- triangleSet_.add ( TeTinTriangle (an0, an1, ak) );
-
- triangles.insert(t);
- triangles.insert(t1);
-
- return an0;
-}
-
-bool
-TeTin::dupNeighTriangle(long tv, long an0, long v, std::set<long>& triangles)
-{
-// 11.1. Crie o novo tri�ngulo t2,
- long t2 = triangleSet_.size();
-
-// 11.2. Defina a aresta av do tri�ngulo tv que cont�m o v�rtice vn
-// (obs: s� h� uma aresta porque a outra foi modificada),
- long vn = edgeSet_[an0].to(); //Due to assembly, dangerous
- if ( vn == v )
- vn = edgeSet_[an0].from();
-
- long edges[3];
- triangleSet_[tv].edges(edges[0],edges[1],edges[2]);
- long i;
- for (i = 0; i < 3; i++)
- {
- if ( (edgeSet_[edges[i]].from() == vn) ||
- (edgeSet_[edges[i]].to() == vn) )
- break;
- }
- if (i == 3)
- return false;
- long av = edges[i];
-
-// 11.3. Defina as outras arestas de tv como sendo av1 e av2.
- long av1 = edges[ (i+1)%3];
- long av2 = edges[ (i+2)%3];
-
-// 11.4. Defina o v�rtice vvo conectado a vn por meio da aresta av,
- long vvo;
- if (edgeSet_[av].from() == vn)
- vvo = edgeSet_[av].to();
- else
- vvo = edgeSet_[av].from();
-
-// 11.5. Crie a nova aresta an2 que conecta os v�rtices v e vvo e
-// tem t e t2 como os tri�ngulos que compartilham a aresta.
- edgeSet_.add( TeTinEdge (v, vvo, tv, t2, NORMALEDGE) );
- long an2 = edgeSet_.size()-1;
-
-// 11.6. Troque o tri�ngulo tv por t2 na aresta av,
- edgeSet_[av].exchangeTriangle( tv, t2 );
-
-// 11.7. Troque o tri�ngulo tv por t2 na aresta an0,
- edgeSet_[an0].exchangeTriangle( tv, t2 );
-
-// 11.8. Defina as arestas de tv como sendo an2, av1 e av2.
- triangleSet_[tv].setEdges( an2, av1, av2 );
-
-// 11.9. Defina as arestas de t2 como sendo an0, av e an2,
- triangleSet_.add ( TeTinTriangle ( an0, av, an2 ) );
-
- triangles.insert(tv);
- triangles.insert(t2);
-
- return true;
-}
-
-void
-TeTin::testDelaunayForVertex(long v, std::set<long>& triangles)
-{
- while ( triangles.size() )
- {
- std::set<long>::iterator i = triangles.begin();
- long t = *i;
- triangles.erase(t);
- this->testDelaunayAt(t, v, triangles);
- }
-}
-
-bool
-TeTin::testDelaunayAt(long t, long v, std::set<long>& triangles)
-{
- // Retrieve line of triangle common to neighbor triangle
- long e = this->edgeOppVertex (t, v);
-
-// Retrieve neighbour triangle (tviz) pointer
- long tviz = edgeSet_[e].left();
- if ( edgeSet_[e].left() == t )
- tviz = edgeSet_[e].right();
- if ( tviz == -1 )
- return false;
-
-// Define base triangle (tri) center point
- TeCoord2D vert[3];
- this->trianglePoints(t, vert[0], vert[1], vert[2]);
-
-// Find opposite point to base triangle (tri) inside neighbour (tviz)
- long vo = this->vertexOppEdge ( tviz, e );
- TeCoord2D pto = vertexSet_[vo].location();
-
-// To avoid overflow
- TeCoord2D ptmin( TeMAXFLOAT, TeMAXFLOAT );
- long i;
- for (i = 0; i < 3; i++)
- if ( vert[i] < ptmin )
- ptmin = vert[i];
-
- if ( ! ptmin.tooBig() )
- {
- TeCoord2D mptmin ( -ptmin.x(), -ptmin.y() );
- for (i = 0; i < 3; i++)
- vert[i] += mptmin;
- pto += mptmin;
- }
-
- TeCoord2D ptc;
- if ( ! TeFindTriangleCenter( vert[0], vert[1], vert[2], ptc ) )
- return false;
-
-// Calculate base triangle (tri) radius
- double xaux = ptc.x() - vert[0].x();
- double yaux = ptc.y() - vert[0].y();
- double raio2 = xaux * xaux + yaux * yaux;
-
-// Calculate distance from opposite point (tviz) to center point (tri)
- xaux = ptc.x() - pto.x();
- yaux = ptc.y() - pto.y();
- double dist2 = xaux * xaux + yaux * yaux;
-
-/* float fr = (float)sqrt(raio2);
- float fd = (float)sqrt(dist2);
- if (fr <= fd)
- return false; */
-
- if ( raio2 <= dist2 )
- return false;
-
- // If not, change edge between tri and ntri
- bool status;
- if ( (status = this->swapEdges(t, tviz, e)) )
- {
- triangles.insert(t);
- triangles.insert(tviz);
- }
- return status;
-}
-
-bool
-TeTin::swapEdges( long t, long tv, long ai )
-{
- if ( tv == -1 )
- return false;
-// Seja t o tri�ngulo que cont�m cuja i-�sima aresta ai � a aresta
-// que se deseja alterar ( i E {0,1,2} ). A aresta ai conecta os
-// v�rtices vi e vj, a aresta aj conecta os v�rtices vj e vk e a
-// aresta ak conecta os v�rtices vk e vi, sendo j o resto da divis�o
-// de i+1 por 3 e k o resto da divis�o de i+2 por 3.
-
- long tedges[3];
- triangleSet_[t].edges ( tedges[0], tedges[1], tedges[2] );
-
- long vertex[3];
- this->triangleVertices ( t, vertex[0], vertex[1], vertex[2]);
- long i;
- for ( i= 0; i < 3; i++ )
- if ( tedges[i] == ai )
- break;
-
- long aj = tedges [ (i+1) % 3 ];
- long ak = tedges [ (i+2) % 3 ];
-
- long vi = vertex [ i ];
- long vj = vertex [ (i+1) % 3 ];
- long vk = vertex [ (i+2) % 3 ];
-
-// Seja tv o tri�ngulo que compartilha a aresta ai com t. O v�rtice de
-// tv que n�o � conectado pela aresta ai � o v�rtice vn. As outras
-// arestas do tri�ngulo tv s�o am que conecta os v�rtices vi e vn e a
-// aresta an conecta os v�rtices vn e vj.
-
- long vn = this->vertexOppEdge ( tv, ai );
-
- long tvedges [3];
- triangleSet_[tv].edges ( tvedges[0], tvedges[1], tvedges[2] );
-
- long am, an = 0;
- for ( long j = 0; j < 3; j++ )
- {
- if ( tvedges [ j ] == ai )
- continue;
-
- if ( edgeSet_[tvedges[j]].from() == vn )
- {
- if ( edgeSet_[tvedges[j]].to() == vi )
- am = tvedges [ j ];
- else if ( edgeSet_[tvedges[j]].to() == vj )
- an = tvedges [ j ];
- }
- else if ( edgeSet_[tvedges[j]].to() == vn )
- {
- if ( edgeSet_[tvedges[j]].from() == vi )
- am = tvedges [ j ];
- else if ( edgeSet_[tvedges[j]].from() == vj )
- an = tvedges [ j ];
- }
- }
-
- TeCoord2D ptaux;
- double tol = TePrecision::instance().precision();
- if ( TePerpendicularDistance(vertexSet_[vk].location(), vertexSet_[vn].location(),
- vertexSet_[vi].location(), ptaux) < tol )
- return false;
- if ( TePerpendicularDistance(vertexSet_[vk].location(), vertexSet_[vn].location(),
- vertexSet_[vj].location(), ptaux) < TePrecision::instance().precision() )
- return false;
-
-// 1. Se o segmento de reta formado conectando o v�rtice vk do
-// tri�ngulo t ao v�rtice vn de tv intersecta a aresta ai, fa�a:
- TeCoord2D pi;
- if (TeSegmentsIntersectPoint(vertexSet_[vi].location(), vertexSet_[vj].location(), vertexSet_[vk].location(), vertexSet_[vn].location(), pi) == false )
- return false;
-
-// 1.1. Troque na aresta ai o v�rtice vi pelo vertice vk e o
-// v�rtice vj pelo v�rtice vn.
- edgeSet_[ai].exchangeVertex ( vi, vk );
- edgeSet_[ai].exchangeVertex ( vj, vn );
-
- if ( vertexSet_[vi].oneEdge() == ai )
- vertexSet_[vi].setOneEdge ( ak );
- if ( vertexSet_[vj].oneEdge() == ai )
- vertexSet_[vj].setOneEdge ( aj );
-
-// 1.2. Troque na aresta an o tri�ngulo tv pelo tri�ngulo t.
- edgeSet_[an].exchangeTriangle( tv , t );
-
-// 1.3. Troque na aresta ak o tri�ngulo t pelo tri�ngulo tv.
- edgeSet_[ak].exchangeTriangle( t, tv );
-
-// 1.4. Troque no tri�ngulo t a aresta ai pela aresta an e a
-// aresta ak pela aresta ai.
- for ( i = 0; i < 3; i++ )
- if ( tedges[i] == ai )
- break;
- tedges[i] = an;
- tedges[(i+2)%3] = ai;
- triangleSet_[t].setEdges ( tedges[0], tedges[1], tedges[2] );
-
-// 1.5. Troque no tri�ngulo tv a aresta ai pela aresta ak
- for ( i = 0; i < 3; i++ )
- if ( tvedges[i] == ai )
- break;
- tvedges [i] = ak;
-
-// e a aresta an pela aresta ai.
- for ( i = 0; i < 3; i++ )
- if (tvedges[i] == an )
- break;
- tvedges[i] = ai;
-
- triangleSet_[tv].setEdges ( tvedges[0], tvedges[1], tvedges[2] );
-
- return true;
-}
-
-bool
-TeTin::edgesInterBySegment( TeCoord2D& pf, TeCoord2D& pn, std::list<long> &aiset, std::list<long> &viset )
-{
-// Seja o segmento de reta r que conecta os pontos pf e pn,
-//1. Defina o tri�ngulo tf que cont�m o ponto pf,
- long tf = this->triangleAt (pf);
- if (tf == -1)
- return false;
-
-//2. Defina o v�rtice vaux e aresta aaux, como sendo inv�lidos,
- long vaux = -1;
- long aaux = -1;
-
-//3. Defina o conjunto A={a1, a2, a3} com as arestas de tf,
- std::vector<long> auxset(3);
- triangleSet_[tf].edges ( auxset[0], auxset[1], auxset[2] );
- std::list<long> aedges ( auxset.begin(), auxset.end() );
-
-//4. Defina o conjunto V={v1, v2, v3} com os v�rtices de tf,
- this->triangleVertices ( tf, auxset[0], auxset[1], auxset[2]);
- std::list <long> vvertex ( auxset.begin(), auxset.end() );
-
-//5. Defina o conjunto T={tf},
- std::list<long> triset( 1, tf );
- std::set<long> visetaux;
-
-//6. Para cada v�rtice vi de V, fa�a:
- std::list<long>::iterator vii;
- for (vii = vvertex.begin(); vii != vvertex.end(); vii++)
- {
- long vi = *vii;
- TeCoord2D ptvi = vertexSet_[vi].location();
- TeCoord2D pinter;
-
-//6.1. Se o v�rtice vi coincide com pf, fa�a:
- if ( ptvi == pf )
- {
-//6.1.1. Redefina A={a1,...,an} com as n arestas opostas a vi,
- aedges.clear();
- this->vertexOppEdges(vi, aedges);
-
-//6.1.2. Redefina V={v1,...,vm} com os m v�rtices dos tri�ngulos que cont�m o v�rtice vi,
- vvertex.clear();
- this->vertexOppVertices(vi, vvertex);
-
-//6.1.3. Redefina o conjunto T={t1,..., tm} com os m tri�ngulos que compartilham o v�rtice vi,
- triset.clear();
- this->vertexTriangles(vi, triset);
-
-//6.1.4. Redefina o v�rtice auxiliar vaux como sendo vi,
- vaux = vi;
- visetaux.insert(vi);
-//6.1.5. V� para 8,
- break;
- }
- }
- if ( vii == vvertex.end() )
- {
-//7. Para cada aresta ai de A, fa�a:
- for (std::list<long>::iterator aii = aedges.begin(); aii != aedges.end(); aii++)
- {
- long ai = *aii;
-//7.1. Se o ponto pf est� sobre ai, fa�a:
- TeCoord2D pfr = vertexSet_[edgeSet_[ai].from()].location();
- TeCoord2D pto = vertexSet_[edgeSet_[ai].to()].location();
- TeCoord2D pinter;
- if ( TePerpendicularDistance(pfr, pto, pf, pinter) < TePrecision::instance().precision() )
- {
-//7.1.1. Defina o tri�ngulo tv que compartilha ai com tf,
- long tv = edgeSet_[ai].right();
- if (tv == tf)
- tv = edgeSet_[ai].left();
- if (tv == -1)
- return false;
-//7.1.2. Redefina V={v1, v2, v3, v4} com os v�rtices de tv e tf,
- vvertex.clear();
- this->triangleVertices ( tv, auxset[0], auxset[1], auxset[2]);
- vvertex.insert( vvertex.begin(), auxset.begin(), auxset.end() );
- this->triangleVertices ( tf, auxset[0], auxset[1], auxset[2]);
- vvertex.insert( vvertex.begin(), auxset.begin(), auxset.end() );
- vvertex.sort();
- vvertex.unique();
-//7.1.3. Redefina A={a1, a2, a3, a4} com as arestas de tv e tf diferentes de ai,
- aedges.clear();
- triangleSet_[tv].edges ( auxset[0], auxset[1], auxset[2] );
- aedges.insert( aedges.begin(), auxset.begin(), auxset.end() );
- aedges.remove(ai);
- triangleSet_[tf].edges ( auxset[0], auxset[1], auxset[2] );
- aedges.insert( aedges.begin(), auxset.begin(), auxset.end() );
- aedges.remove(ai);
-
-//7.1.4. Redefina o conjunto T={tv, tf},
- triset.push_back ( tv );
-//7.1.5. Redefina a aresta auxiliar aaux como sendo ai,
- aiset.push_back ( ai );
- aaux = ai;
-//7.1.6. V� para 8,
- break;
- }
- }
- }
-
- for (;;)
- {
-//8. Para cada tri�ngulo ti de T, fa�a:
- std::list<long>::iterator tii;
- for ( tii = triset.begin(); tii != triset.end(); tii++)
- {
- long ti = *tii;
-//8.1.1. Se o tri�ngulo ti cont�m o ponto pn, termine o algoritmo.
- if ( this->triangleContainsPoint( ti, pn ) )
- return true;
- }
-//9. Para cada v�rtice vi de V, fa�a:
- std::list<long>::iterator vii;
- for (vii = vvertex.begin(); vii != vvertex.end(); vii++)
- {
- long vi = *vii;
- TeCoord2D ptvi = vertexSet_[vi].location();
-//9.1. Se vi coincide com pn, fa�a:
- if ( ptvi == pn )
- {
-//9.1.1. Insira o v�rtice vi no conjunto VI de v�rtices intersectados,
- viset.push_back ( vi );
-//9.1.2. Termine o algoritmo.
- break;
- }
- }
- if ( vii != vvertex.end() )
- break; // do for (;;)
-
-//10. Para cada v�rtice vi de V, fa�a:
- for ( vii = vvertex.begin(); vii != vvertex.end(); vii++)
- {
- long vi = *vii;
-//10.1. Se vi � diferente de vaux e est� sobre r, fa�a:
- if ( vi != vaux )
- {
- TeCoord2D ptvi = vertexSet_[vi].location();
- TeCoord2D pinter;
- if ( TePerpendicularDistance(pf, pn, ptvi, pinter) < TePrecision::instance().precision() )
- {
- TeBox box1;
- updateBox (box1, pf);
- updateBox (box1, pn);
- if (TeWithin (pinter, box1) )
- {
-//10.1.1. Redefina o conjunto A={a1,..., an} com as n arestas opostas a vi, excluindo as arestas de AI,
- aedges.clear();
- this->vertexOppEdges(vi, aedges);
- std::list<long>::iterator aisi;
- for ( aisi = aiset.begin(); aisi != aiset.end(); aisi++)
- aedges.remove ( *aisi );
-//10.1.2. Redefina o conjunto V={v1,..., vm} com os m v�rtices dos tri�ngulos que cont�m o v�rtice vi,
-// excluindo os vertices de Vi,
- vvertex.clear();
- this->vertexOppVertices(vi, vvertex);
- std::list<long>::iterator visi;
- for ( visi = viset.begin(); visi != viset.end(); aisi++)
- viset.remove ( *visi );
-//101.3. Redefina o conjunto T={t1, ..., tk } com os k tri�ngulos que cont�m o v�rtice vi,
- triset.clear();
- this->vertexTriangles(vi, triset);
-//101.4. Insira o v�rtice vi no conjunto VI de v�rtices intersectados,
- viset.push_back ( vi );
-//101.5. Defina o conjunto Ac={a1,..., aj} com as j arestas que cont�m vi, diferentes de aaux,
-//101.6. Insira as arestas de Ac no conjunto AI de arestas intersectadas,
- this->vertexEdges(vi, aiset);
- aiset.sort();
- aiset.unique();
-//10.7. Redefina o v�rtice auxiliar vaux como sendo vi,
- vaux = vi;
-//10.8. Retorne a 8,
- break;
- }
- }
- }
- }
- if ( vii != vvertex.end() )
- continue; // do for (;;)
-
-//11. Para cada aresta ai de A, fa�a:
- std::list<long>::iterator aii;
- for (aii = aedges.begin(); aii != aedges.end(); aii++)
- {
- long ai = *aii;
-//11.1. Se o ponto pn est� sobre ai, fa�a:
- TeCoord2D pfr = vertexSet_[edgeSet_[ai].from()].location();
- TeCoord2D pto = vertexSet_[edgeSet_[ai].to()].location();
- TeCoord2D pinter;
- if ( TePerpendicularDistance(pfr, pto, pn, pinter) < TePrecision::instance().precision() )
- {
- TeBox box1;
- updateBox (box1, pfr);
- updateBox (box1, pto);
- if (TeWithin (pinter, box1) )
- {
-//11.1.1. Insira a aresta ai no conjunto AI de arestas intersectadas,
- aiset.push_back ( ai );
-//11.1.2. Termine o algoritmo.
- break;
- }
- }
- }
- if ( aii != aedges.end() )
- break; // do for (;;)
-
-//12. Para cada aresta ai de A, fa�a:
- for (aii = aedges.begin(); aii != aedges.end(); aii++)
- {
- long ai = *aii;
- TeCoord2D pinter;
- long vt = edgeSet_[ai].to();
- long vf = edgeSet_[ai].from();
-//12.1. Se ai intersecta r, fa�a:
- if ( TeSegmentsIntersectPoint(vertexSet_[vt].location(), vertexSet_[vf].location(), pf, pn, pinter) )
- {
-//12.1.1. Insira a aresta ai no conjunto AI de arestas intersectadas,
- aiset.push_back ( ai );
-//12.1.2. Defina os tri�ngulos t1 e t2 que compartilham a aresta ai.
-//12.1.3. Se t2 est� contido no conjunto T , ent�o fa�a taux=t1,
- long taux = edgeSet_[ai].left();
- if (taux == -1)
- return false;
- std::list<long>::iterator pos1 = find (triset.begin(), triset.end(), taux);
- if ( pos1 != triset.end() )
-//12.1.4. Sen�o, fa�a taux=t2,
- taux = edgeSet_[ai].right();
- if (taux == -1)
- return false;
-//12.1.5. Se o tri�ngulo taux cont�m o ponto pn, termine o algoritmo.
- if ( this->triangleContainsPoint( taux, pn ) )
- return true;
-//12.1.6. Redefina o conjunto A={a1, a2} com as arestas do tri�ngulo taux diferentes de ai,
- triangleSet_[taux].edges ( auxset[0], auxset[1], auxset[2] );
- aedges.clear();
- aedges.insert( aedges.begin(), auxset.begin(), auxset.end() );
- aedges.remove( ai );
-//12.1.7. Redefina o conjunto V={v1}. O v�rtice v1 � o v�rtice do tri�ngulo taux que n�o est�
-// em nenhuma extremidade da aresta ai,
- long vaux1 = edgeSet_[ai].from();
- long vaux2 = edgeSet_[ai].to();
- this->triangleVertices ( taux, auxset[0], auxset[1], auxset[2]);
- vvertex.clear();
- vvertex.insert ( vvertex.begin(), auxset.begin(), auxset.end() );
- vvertex.remove ( vaux1 );
- vvertex.remove ( vaux2 );
-
-//12.1.8. Redefina o conjunto T={taux},
- triset.clear();
- triset.push_back ( taux );
-//12.1.9. Redefina aaux como sendo ai,
- aaux = ai;
-//12.1.10. Retorne a 8;
- break;
- }
- }
- } // Do for (;;)
- return true;
-}
-
-bool
-TeTin::insertSegment( TeCoord2D& pf, TeCoord2D& pn )
-{
- if ( this->insertPoint( pf.x(), pf.y(), 100.) )
- {
- if ( this->insertPoint( pn.x(), pn.y(), 100.) )
- {
- std::list<long> aiset;
- std::list<long> viset;
- if ( this->edgesInterBySegment( pf, pn, aiset, viset ) )
- {
- if ( viset.size() == 0 )
- {
- while ( aiset.size() > 0 )
- {
-//2. Para cada aresta ai de A, fa�a:
- std::list<long>::iterator aii;
- for (aii = aiset.begin(); aii != aiset.end(); aii++)
- {
- long ai = *aii;
-//2.1. Defina os tri�ngulos td e te compartilham ai,
- long td = edgeSet_[ai].right();
- long te = edgeSet_[ai].left();
-//2.2. Defina os v�rtices vm e vn dos tri�ngulos td e te que n�o est�o sobre a aresta ai,
- long vn = this->vertexOppEdge(td, ai);
- long vm = this->vertexOppEdge(te, ai);
-//2.3. Se r n�o intersecta o segmento que conecta os v�rtices vm e vn, fa�a:
- TeCoord2D pi;
- if ( TeSegmentsIntersectPoint(vertexSet_[vn].location(), vertexSet_[vm].location(), pf, pn, pi) )
- {
-//2.3.1. Se ai intersecta o segmento que conecta os v�rtices vm e vn, fa�a:
- if ( this->swapEdges( td, te, ai ) )
- {
-//2.3.1.1. Redefina ai como sendo o segmento que conecta os v�rtices vm e vn,
-//2.3.1.2. Redefina adequadamente os tri�ngulos tv e tf,
-//2.3.1.3. Remova a aresta ai de A,
- aiset.remove(ai);
- break;
- }
- }
- }
- if ( aii != aiset.end() )
- continue;
-//3. Se n�o h� mais arestas em A, ent�o:
-//3.1. Termine o algoritmo.
-//4. Para cada aresta ai de A, fa�a:
- aii = aiset.begin();
- while ( aii != aiset.end() )
- {
- long ai = *aii;
-//4.1. Defina os tri�ngulos td e te compartilham ai,
- long td = edgeSet_[ai].right();
- long te = edgeSet_[ai].left();
-//4.2. Defina os v�rtices vm e vn dos tri�ngulos td e te que n�o est�o sobre a aresta ai,
-//4.3. Se ai intersecta o segmento que conecta os v�rtices vm e vn, fa�a:
- if ( this->swapEdges( td, te, ai ) )
- {
-//4.3.1. Redefina ai como sendo o segmento que conecta os v�rtices vm e vn,
-//4.3.2. Redefina adequadamente os tri�ngulos tv e tf,
- TeCoord2D pinter;
- long vt = edgeSet_[ai].to();
- long vf = edgeSet_[ai].from();
- TeCoord2D pi;
- if ( ( vertexSet_[vt].location() == pf ) ||
- ( vertexSet_[vf].location() == pf ) ||
- ( vertexSet_[vt].location() == pn ) ||
- ( vertexSet_[vf].location() == pn ) ||
- ( TeSegmentsIntersectPoint(vertexSet_[vt].location(), vertexSet_[vf].location(), pf, pn, pi) == false ))
- {
-//4.3.3. Se ai n�o intersecta r, fa�a:
-//4.3.3.1. Remova a aresta ai de A
- aiset.remove(ai);
- aii = aiset.begin();
- }
- else
- aii++;
- }
- else
- aii++;
- }
-//4.3.3. Retorne a 2.
- }
- return true;
- }
- }
- }
- }
- return false;
-}
-
-bool
-TeTin::createInitialTriangles(TeBox &box)
-{
- // Make box 1% bigger
- zoomOut(box, 1./1.01);
-
- // Create and insert initial nodes of the Tin
- vertexSet_.add( TeTinVertex (box.lowerLeft(), TeMAXFLOAT, NORMALVERTEX, 0 ) ); //v0
- vertexSet_.add( TeTinVertex (TeCoord2D(box.x1(),box.y2()), TeMAXFLOAT, NORMALVERTEX, 1 ) ); //v1
- vertexSet_.add( TeTinVertex (box.upperRight(), TeMAXFLOAT, NORMALVERTEX, 2 ) ); //v2
- vertexSet_.add( TeTinVertex (TeCoord2D(box.x2(),box.y1()), TeMAXFLOAT, NORMALVERTEX, 3 ) ); //v3
-
-// Create and insert initial lines of the Tin
- edgeSet_.add( TeTinEdge (0, 1, -1, 0, NORMALEDGE) ); //a0
- edgeSet_.add( TeTinEdge (1, 2, -1, 0, NORMALEDGE) ); //a1
- edgeSet_.add( TeTinEdge (2, 3, -1, 1, NORMALEDGE) ); //a2
- edgeSet_.add( TeTinEdge (3, 0, -1, 1, NORMALEDGE) ); //a3
- edgeSet_.add( TeTinEdge (0, 2, 0, 1, NORMALEDGE) ); //a4
-
-// Create the two initial triangles of the Tin
-// Update triangles edges
- triangleSet_.add ( TeTinTriangle (0, 1, 4) );
- triangleSet_.add ( TeTinTriangle (2, 3, 4) );
-
- return true;
-}
-
-bool
-TeTin::insertLineSamples ( TeContourLine& line )
-{
- TeLineSimplify(line, 20., 200.);
- unsigned long i;
- for ( i = 0; i < line.size(); i++ )
- {
- TeCoord2D pt = line[i];
- this->insertPoint(pt.x(), pt.y(), line.value());
- }
- return true;
-}
-
-bool
-TeTin::isEdgeTriangle (long t)
-{
- long neighids[3];
- this->triangle3Neighbors(t, neighids[0],neighids[1],neighids[2]);
-
- long i;
- for (i = 0; i < 3; i++)
- if ( neighids[i] == -1)
- return true;
- return false;
-}
-
-void
-TeTin::convexize ()
-{
- unsigned long eii;
-
- for (eii = 0; eii < edgeSet_.size(); eii++)
- {
- TeTinEdge ei = this->edge(eii);
- if ((this->vertex(ei.from()).value() > TeTinBIGFLOAT ) ||
- (this->vertex(ei.to ()).value() > TeTinBIGFLOAT ) )
- {
- if ((this->vertex(ei.from()).value() > TeTinBIGFLOAT ) &&
- (this->vertex(ei.to ()).value() > TeTinBIGFLOAT ) )
- continue;
- else
- {
- long td = ei.right();
- long te = ei.left();
- if ( ! this->isEdgeTriangle(td) || ! this->isEdgeTriangle(te) )
- this->swapEdges( td, te, eii );
- }
- }
- }
-}
diff --git a/src/terralib/kernel/TeTin.h b/src/terralib/kernel/TeTin.h
deleted file mode 100644
index bb63f67..0000000
--- a/src/terralib/kernel/TeTin.h
+++ /dev/null
@@ -1,445 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeTin.h
- \brief This file provides support for a TIN structure
-*/
-#ifndef __TERRALIB_INTERNAL_TIN_H
-#define __TERRALIB_INTERNAL_TIN_H
-
-#include "TeGeometry.h"
-#include <list>
-#include <set>
-
-/** @} */
-
-/** @defgroup MathConst Mathematical constants and macro definitions for use in Tin
- @{
- */
-const double TeTinBIGFLOAT = TeMAXFLOAT / 10.; //!< Near Maximum float value - TeMAXFLOAT / 10.
-
-//! Tin Vertex types
-enum TeTinVertexType
-{ NORMALVERTEX = 0, ONCONTOURVERTEX = 1, ONBREAKLINEVERTEX = 0x10 };
-
-//! A basic class for handling vertex of TIN
-/*!
- \sa TeGeometry TeMeasure
-*/
-class TL_DLL TeTinVertex : public TeGeomSingle<TeCoord2D>, public TeMeasure
-{
-public:
-
- //! Empty constructor
- TeTinVertex() : TeMeasure ( TeMAXFLOAT ), oneEdge_ (-1) {}
-
- //! Constructor with parameters
- TeTinVertex( TeCoord2D xy, double value, TeTinVertexType type,
- long edge ) :
- TeGeomSingle<TeCoord2D> (xy), TeMeasure ( value ),
- type_ (type), oneEdge_ ( edge )
- { if ( ! xy.tooBig() ) TeGeometry::setBox(TeBox(xy,xy)); }
-
-// -- Methods
-//
- //! Returns TRUE if a TeTinVertex is equal to other
- bool operator== (const TeTinVertex& other) const
- {
- if((value_ == other.value_) && (type_ == other.type_) )
- {
- TeCoord2D p1 = location();
- TeCoord2D p2 = other.location();
- return p1==p2;
- }
- return false;
- }
-
- long oneEdge ()
- { return oneEdge_; }
-
- void setOneEdge (long oneEdge)
- { oneEdge_ = oneEdge; }
-
- TeTinVertexType type ()
- { return type_; }
-
- void setType (TeTinVertexType type)
- { type_ = type; }
-
- void value (double value)
- { value_ = value; }
-
- double value ()
- { return value_; }
-
- TeGeomRep elemType() { return TeSAMPLES; }
-
-private:
-
- TeTinVertexType type_;
- long oneEdge_;
-};
-
-//! A basic class for handling a std::set of TeTinVertex
-class TL_DLL TeTinVertexSet : public TeGeomComposite <TeTinVertex>
-{
-public:
-
-// -- Constructors
-
- TeTinVertexSet() {}
-
-// -- Methods
-
- bool loadFromFile (std::string &fileName);
-
- TeGeomRep elemType() { return TeSAMPLES; }
-};
-
-//! Tin Edges type
-enum TeTinEdgeType
-{ NORMALEDGE, ONCONTOUREDGE, ONBREAKLINEEDGE };
-
-//! A basic class for handling edges of a TIN
-/*!
- \sa TeGeometry
-*/
-class TL_DLL TeTinEdge : public TeGeometry
-{
-public:
-
-// -- Constructors
-
- TeTinEdge() {}
- TeTinEdge(long from, long to, long left, long right,
- TeTinEdgeType type) :
- from_ (from), to_ (to), left_ (left), right_ (right), type_ (type)
- {}
-
-// -- Methods
-
- //! Returns TRUE if a TeTinEdge is equal to other
- bool operator== (const TeTinEdge& other) const
- {
- if( (to_ == other.to_) && (from_ == other.from_) &&
- (left_ == other.left_) && (right_ == other.right_) &&
- (type_ == other.type_) )
- return true;
-
- return false;
- }
-
- long from ()
- { return from_; }
-
- long to ()
- { return to_; }
-
- void setVertices (long from, long to)
- {
- from_ = from;
- to_ = to;
- }
-
- void swapVertices ()
- {
- long aux = from_;
- from_ = to_;
- to_ = aux;
- }
-
- long left ()
- { return left_; }
-
- long right ()
- { return right_; }
-
- void setTriangles (long left, long right)
- {
- left_ = left;
- right_ = right;
- }
-
- void swapTriangles ()
- {
- long aux = left_;
- left_ = right_;
- right_ = aux;
- }
-
- void exchangeTriangle ( long t1, long t2 )
- {
- if (left_ == t1 )
- left_ = t2;
- else
- right_ = t2;
- }
-
- void exchangeVertex ( long v1, long v2 )
- {
- if (from_ == v1 )
- from_ = v2;
- else
- to_ = v2;
- }
-
- TeTinEdgeType type ()
- { return type_; }
-
- void setType (TeTinEdgeType type)
- { type_ = type; }
-
- TeGeomRep elemType() { return TeSAMPLES; }
-
-private:
-
- long from_, to_;
- long left_, right_;
- TeTinEdgeType type_;
-};
-
-//! A basic class for handling a std::set of TeTinEdge
-class TL_DLL TeTinEdgeSet : public TeGeomComposite<TeTinEdge>
-{
-public:
-
-// -- Constructors
-
- TeTinEdgeSet() {}
-
-// -- Methods
-
- bool loadFromFile (std::string &fileName);
-
- TeGeomRep elemType() { return TeSAMPLES; }
-};
-
-//! TeTinTriangle: A class for handling a TIN triangle
-class TL_DLL TeTinTriangle : public TeGeometry
-{
-public:
-
-// -- Constructors
-
- TeTinTriangle()
- {
- triEdges_[0] = -1;
- triEdges_[1] = -1;
- triEdges_[2] = -1;
- }
-
- TeTinTriangle(long first, long second, long third)
- {
- triEdges_[0] = first;
- triEdges_[1] = second;
- triEdges_[2] = third;
- }
-
-// -- Methods
-
- //! Returns TRUE if a TeTinTriangle is equal to other
- bool operator== (const TeTinTriangle& other) const
- {
- if( (triEdges_[0] == other.triEdges_[0]) &&
- (triEdges_[1] == other.triEdges_[1]) &&
- (triEdges_[2] == other.triEdges_[2]) )
- return true;
-
- return false;
- }
-
- void setEdges (long first, long second, long third)
- {
- triEdges_[0] = first;
- triEdges_[1] = second;
- triEdges_[2] = third;
- }
-
- //! Return triangle edges ids
- /*!
- \param first first edge
- \param second second edge
- \param third third edge
- */
- void edges (long& first, long& second, long& third)
- {
- first = triEdges_[0];
- second = triEdges_[1];
- third = triEdges_[2];
- }
-
- long edgeAt (short num)
- {
- if ((num > -1) && (num < 3))
- return triEdges_[num];
- else
- return -1;
- }
-
- TeGeomRep elemType() { return TeSAMPLES; }
-
-private:
-
- long triEdges_[3];
-};
-
-//! TeTinTriangle: A class for handling a std::set of TIN triangles
-class TL_DLL TeTinTriangleSet : public TeGeomComposite<TeTinTriangle>
-{
-public:
-
-// -- Constructors
-
- TeTinTriangleSet() {}
-
-// -- Methods
-
- bool loadFromFile (std::string &fileName);
-
- TeGeomRep elemType() { return TeSAMPLES; }
-};
-
-//! A class to handle a TIN
-class TL_DLL TeTin
-{
-public:
-
-// -- Constructors
-
- TeTin() {}
- TeTin(TeBox & /* box */) {}
-
-// -- Methods
- void clear()
- {
- vertexSet_.clear();
- triangleSet_.clear();
- edgeSet_.clear();
- }
-
- TeBox box()
- { return vertexSet_.box(); }
-
- bool createInitialTriangles(TeBox &box);
- bool insertLineSamples ( TeContourLine& line );
- bool loadFromFile(std::string &fileName);
- bool getLines(TeLineSet &lineSet);
- bool isEmpty ()
- { return ( vertexSet_.empty() && triangleSet_.empty() &&
- edgeSet_.empty() ); }
-
- TeTinEdge& edge (long i)
- { return edgeSet_[i]; }
-
- TeTinVertex& vertex (long i)
- { return vertexSet_[i]; }
-
- TeTinTriangle& triangle (long i)
- { return triangleSet_[i]; }
-
- typedef TeTinVertexSet::iterator TeTinVertexIterator;
-
- TeTinVertexIterator vertexBegin()
- { return vertexSet_.begin(); }
-
- TeTinVertexIterator vertexEnd()
- { return vertexSet_.end(); }
-
- typedef TeTinEdgeSet::iterator TeTinEdgeIterator;
-
- TeTinEdgeIterator edgeBegin()
- { return edgeSet_.begin(); }
-
- TeTinEdgeIterator edgeEnd()
- { return edgeSet_.end(); }
-
- typedef TeTinTriangleSet::iterator TeTinTriangleIterator;
-
- TeTinTriangleIterator triangleBegin()
- { return triangleSet_.begin(); }
-
- TeTinTriangleIterator triangleEnd()
- { return triangleSet_.end(); }
-
- bool triangleContainsPoint(TeTinTriangle& t, TeCoord2D& pt);
- bool triangleContainsPoint(long t, TeCoord2D& pt)
- { return triangleContainsPoint(triangleSet_[t], pt); }
-
- long edgeWithVertexDiffFromEdge(long t, long v, long e);
- long oneTriangleWithVertex(long vertex);
- long oneEdgeWithVertex(long vertex);
-
- long edgeOppVertex(TeTinTriangle& triangle, long vertex);
- long edgeOppVertex(long triangle, long vertex)
- { return edgeOppVertex(triangleSet_[triangle], vertex); }
-
- long vertexOppEdge(long triangle, long edge);
- bool vertexEdges(long vertex, std::list<long> &edges);
- bool vertexOppEdges(long vertex, std::list<long> &edges);
- bool vertexOppEdges(long v, std::list<long> &triset, std::list<long> &edges);
-
- bool vertexOppVertices(long vertex, std::list<long> &vertices);
- bool vertexSecondNeighVertices(long v, list<long> &vertices);
- bool vertexTriangles(long vertex, std::list<long> &triangles);
- bool triangle3Neighbors(long t, long& neighbor0, long& neighbor1, long& neighbor2);
- long triangleAt (TeCoord2D& pt);
-
- bool triangleVertices(TeTinTriangle& t, long& vertex0, long& vertex1, long& vertex2);
- bool triangleVertices(long t, long& vertex0, long& vertex1, long& vertex2)
- { return this->triangleVertices(triangleSet_[t], vertex0, vertex1, vertex2); }
-
- long triangleVertexAt(long t, long vertex);
-
- bool trianglePoints(TeTinTriangle& t, TeCoord2D& pt0, TeCoord2D& pt1, TeCoord2D& pt2);
- bool trianglePoints(long t, TeCoord2D& pt0, TeCoord2D& pt1, TeCoord2D& pt2)
- { return trianglePoints( triangleSet_[t], pt0, pt1, pt2); }
-
- bool twoNewTriangles(long t, long v, std::set<long>& triangles);
- long duplicateTriangle(long t, long n, long v, std::set<long>& triangles);
- bool dupNeighTriangle (long t, long e, long v, std::set<long>& triangles);
-
- void testDelaunayForVertex(long v, std::set<long>& triangles);
- bool testDelaunayAt(long t, long v, std::set<long>& triangles);
-
- bool swapEdges( long t, long tv, long ai );
-
- bool insertPoint(TeSample& xyz)
- { return insertPoint ( xyz.location().x(),xyz.location().y(),xyz.value() ); }
-
- bool insertPoint(double x, double y, double value);
-
- bool edgesInterBySegment( TeCoord2D& pf, TeCoord2D& pn, std::list<long> &aiset, std::list<long> &viset );
- bool insertSegment( TeCoord2D& pf, TeCoord2D& pn );
-
-
- void convexize ();
- bool isEdgeTriangle (long t);
-
- TeGeomRep elemType() { return TeSAMPLES; }
-private:
-
- TeTinVertexSet vertexSet_;
- TeTinTriangleSet triangleSet_;
- TeTinEdgeSet edgeSet_;
-};
-
-#endif
diff --git a/src/terralib/kernel/TeUtils.cpp b/src/terralib/kernel/TeUtils.cpp
index 8028459..13b9ddf 100644
--- a/src/terralib/kernel/TeUtils.cpp
+++ b/src/terralib/kernel/TeUtils.cpp
@@ -1,34 +1,21 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "TeUtils.h"
#include "TeDefines.h"
#include "TeException.h"
-#include "TeAgnostic.h"
#include <cstdlib>
#include <stdio.h>
#include <ctype.h>
+#include <iostream>
#include <cstring> //FAMI
/* The following includes are needed for pysical memory checking */
diff --git a/src/terralib/kernel/TeUtils.h b/src/terralib/kernel/TeUtils.h
index b0bc728..a3593ed 100644
--- a/src/terralib/kernel/TeUtils.h
+++ b/src/terralib/kernel/TeUtils.h
@@ -1,25 +1,13 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2004 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF & INPE.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file TeUtils.h
\brief This file contains some general purpose utilitary functions
*/
@@ -37,7 +25,6 @@ of this library and its documentation.
#include "TeCoord2D.h"
-#include "TeProgress.h"
using namespace std;
diff --git a/src/terralib/kernel/TeVectorRemap.cpp b/src/terralib/kernel/TeVectorRemap.cpp
deleted file mode 100644
index e567321..0000000
--- a/src/terralib/kernel/TeVectorRemap.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#include "TeVectorRemap.h"
-
-TeBox TeRemapBox ( TeBox& box, TeProjection* projFrom, TeProjection* projTo)
-{
- if (projFrom == 0 || projTo == 0)
- return box;
-
- if (*projFrom == *projTo)
- return box;
-
- if(projFrom->name() == "NoProjection" || projTo->name() == "NoProjection")
- return box;
-
- if (projFrom->datum().name() != projTo->datum().name())
- {
- projFrom->setDestinationProjection(projTo);
- projTo->setDestinationProjection(projFrom);
- }
-
- TeCoord2D pll = box.lowerLeft (),
- pur = box.upperRight (),
- pul (pll.x(),pur.y()),
- plr (pur.x(),pll.y());
-
-// Evaluate coordinates of box corners in Lat/Long
-
- pll = projFrom->PC2LL (pll);
- pur = projFrom->PC2LL (pur);
- pul = projFrom->PC2LL (pul);
- plr = projFrom->PC2LL (plr);
-
-// Evaluate the minimum box that includes all four corners
-
- pll.x(std::min(pll.x(),pul.x()));
- pll.y(std::min(pll.y(),plr.y()));
- plr.x(std::max(plr.x(),pur.x()));
- plr.y(std::min(pll.y(),plr.y()));
- pur.x(std::max(pur.x(),plr.x()));
- pur.y(std::max(pul.y(),pur.y()));
- pul.x(std::min(pll.x(),pul.x()));
- pul.y(std::max(pul.y(),pur.y()));
-
-
-// Bring coordinates of box corners to target projection
-
- pll = projTo->LL2PC (pll);
- pur = projTo->LL2PC (pur);
- pul = projTo->LL2PC (pul);
- plr = projTo->LL2PC (plr);
-
-// Evaluate the minimum box that includes all four corners
-
- return TeBox ( std::min(pll.x(),pul.x()),
- std::min(pll.y(),plr.y()),
- std::max(pur.x(),plr.x()),
- std::max(pul.y(),pur.y()));
-}
-
-void
-TeVectorRemap(TeCoord2D& c1, TeProjection* p1, TeCoord2D& c2, TeProjection* p2)
-{
- p1->setDestinationProjection(p2);
- TeCoord2D ll = p1->PC2LL(c1);
- c2 = p2->LL2PC(ll);
-}
-
-void
-TeVectorRemap(TeText& t1, TeProjection* p1, TeText& t2, TeProjection* p2)
-{
- p1->setDestinationProjection(p2);
- t2 = t1;
- TeCoord2D nl = p1->PC2LL(t1.location());
- TeCoord2D p = p2->LL2PC(nl);
- t2.setLocation(p);
-}
-
-void TeVectorRemap(TeCell& c1, TeProjection* p1, TeCell& c2, TeProjection* p2)
-{
- c2 = c1;
- TeBox nb = TeRemapBox(c1.box(),p1,p2);
- c2.setBox(nb);
-}
-
-TeBox TeRemapBoxPC2Geodetic (const TeBox& box, TeProjection* proj)
-{
- if (proj == 0)
- return box;
-
- proj->setDestinationProjection(0);
-
- TeCoord2D pll = box.lowerLeft (),
- pur = box.upperRight (),
- pul (pll.x(),pur.y()),
- plr (pur.x(),pll.y());
-
- pll = proj->PC2LL (pll);
- pur = proj->PC2LL (pur);
- pul = proj->PC2LL (pul);
- plr = proj->PC2LL (plr);
-
-// Evaluate the minimum box that includes all four corners
-
- return TeBox ( std::min(pll.x(),pul.x()),
- std::min(pll.y(),plr.y()),
- std::max(pur.x(),plr.x()),
- std::max(pul.y(),pur.y()));
-}
-
-TeBox TeRemapBoxGeodetic2PC (const TeBox& box, TeProjection* proj)
-{
- if (proj == 0)
- return box;
-
- proj->setDestinationProjection(0);
-
- TeCoord2D pll = box.lowerLeft (),
- pur = box.upperRight (),
- pul (pll.x(),pur.y()),
- plr (pur.x(),pll.y());
-
- pll = proj->LL2PC (pll);
- pur = proj->LL2PC (pur);
- pul = proj->LL2PC (pul);
- plr = proj->LL2PC (plr);
-
-// Evaluate the minimum box that includes all four corners
-
- return TeBox ( std::min(pll.x(),pul.x()),
- std::min(pll.y(),plr.y()),
- std::max(pur.x(),plr.x()),
- std::max(pul.y(),pur.y()));
-}
-
diff --git a/src/terralib/kernel/TeVectorRemap.h b/src/terralib/kernel/TeVectorRemap.h
deleted file mode 100644
index 6f79cc6..0000000
--- a/src/terralib/kernel/TeVectorRemap.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeVectorRemap.h
- \brief This file contains functions to remap vector structures
-*/
-#ifndef __TERRALIB_INTERNAL_VECTORREMAP_H
-#define __TERRALIB_INTERNAL_VECTORREMAP_H
-
-#include "TeProjection.h"
-#include "TeGeometry.h"
-
-//! Remaps a geometry. Templated by the type of geometry.
-/*
- \param g1 the input geometry
- \param p1 the initial projection
- \param g2 to receive the remapped geometry
- \param p1 the destination projection
-*/
-template<typename G>
-void TeVectorRemap (G& g1, TeProjection* p1, G& g2, TeProjection* p2)
-{
- int nItens = g1.size();
- for (int i=0; i<nItens; i++)
- {
- typename G::value_type e1 = g1[i];
- typename G::value_type e2;
- TeVectorRemap(e1,p1,e2,p2);
- g2.add(e2);
- }
-}
-
-//! Especialized version to remap coordinates
-TL_DLL void TeVectorRemap(TeCoord2D& pt1, TeProjection* p1, TeCoord2D& pt2, TeProjection* p2);
-
-//! Especialized version to remap cells
-TL_DLL void TeVectorRemap(TeCell& c1, TeProjection* p1, TeCell& c2, TeProjection* p2);
-
-//! Especialized version to remap texts
-TL_DLL void TeVectorRemap(TeText& t1, TeProjection* p1, TeText& t2, TeProjection* p2);
-
-//! Remaps a box from one projection to another
-/*
- \param box the input box
- \param projFrom the initial projection
- \param projTo the destination projection
- \returns the remmaped box
-*/
-TL_DLL TeBox TeRemapBox (TeBox& box, TeProjection* projFrom, TeProjection* projTo);
-
-//! Remaps a box from plane coordinate to geodetic coordinate
-/*
- \param box the input box
- \param proj the data projection
- \returns the remmaped box
-*/
-TL_DLL TeBox TeRemapBoxPC2Geodetic (const TeBox& box, TeProjection* proj);
-
-//! Remaps a box from geodetic coordinate to plane coordinate
-/*
- \param box the input box
- \param proj the data projection
- \returns the remmaped box
-*/
-TL_DLL TeBox TeRemapBoxGeodetic2PC (const TeBox& box, TeProjection* proj);
-
-#endif
diff --git a/src/terralib/kernel/TeView.h b/src/terralib/kernel/TeView.h
deleted file mode 100644
index 352217c..0000000
--- a/src/terralib/kernel/TeView.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeView.h
- \brief This file provides TerraLib's definition of a View
-*/
-#ifndef __TERRALIB_INTERNAL_VIEW_H
-#define __TERRALIB_INTERNAL_VIEW_H
-
-#include "TeLayer.h"
-#include "TeTheme.h"
-#include "TeProjection.h"
-#include "TeViewNode.h"
-#include <algorithm>
-
-using namespace std;
-
-//! A class to deal with views in TerraLib
-/*!
- A View is a structure that aggregated themes to be visualized or
- processed in its own projection. Views may belong to a particular user.
- \sa TeTheme TeViewNode
-*/
-class TL_DLL TeView
-{
-public:
- //! Constructor
- TeView( const string& name="", const string& user="", int id=0)
- : id_(id), name_(name), user_(user), proj_(0), is_visible_(true), connectedId_(0), currentTheme_(-1)
- {}
-
- //! Destructor
- virtual ~TeView ()
- {
- if(proj_)
- delete proj_;
- }
-
- //! Returns view unique id
- virtual int id () { return id_; }
-
- //! Sets view unique id
- virtual void id (int id)
- {
- id_ = id; // update view id
- for (unsigned int th=0;th<viewTree_.size();th++) //update its themes
- viewTree_.retrieve(th)->view (id_);
- viewTree_.view(id);
- }
-
- //! Returns the view name
- virtual string name () { return name_; }
-
- //! Sets the view name
- virtual void name (const string& s) { name_ = s; }
-
- //! Returns the view user name
- virtual string user () { return user_; }
-
- //! Sets the view user name
- virtual void user (const string& i) { user_ = i; }
-
- //! Returns the view projection
- virtual TeProjection* projection () { return proj_; }
-
- //! Sets the view projection
- virtual void projection (TeProjection* p) { proj_ = p; }
-
- //! Returns TRUE if view is visible
- virtual bool isVisible () { return is_visible_; }
-
- //! Sets whether view is visible
- virtual void isVisible (bool v) { is_visible_ = v; }
-
- //! Returns the current box
- virtual TeBox& getCurrentBox () { return currentBox_; }
-
- //! Sets the current box
- virtual void setCurrentBox (const TeBox& b) { currentBox_ = b; }
-
- //! Returns the current theme id
- virtual int getCurrentTheme () { return currentTheme_; }
-
- //! Sets the current theme id
- virtual void setCurrentTheme (const int& id) { currentTheme_ = id; }
-
- //! Returns the view tree where view belongs
- virtual TeViewTree* root () { return &viewTree_; }
-
- //! Adds a view node to the view tree
- virtual void add( TeViewNode* node )
- {
- node->view (id_);
- viewTree_.add ( node );
- }
-
- //! Removes a view node through its name from the view tree
- virtual TeViewNode* remove(string name)
- {
- return viewTree_.remove(name);
- }
-
- //! Removes a view node through its identifier from the view tree
- virtual TeViewNode* remove (int id)
- {
- return viewTree_.removeID(id);
- }
-
- //! Moves a node up
- virtual void moveUp (TeViewNode* node)
- {
- viewTree_.moveUp(node);
- }
-
- //! Moves a node down
- virtual void moveDown(TeViewNode* node)
- {
- viewTree_.moveDown(node);
- }
-
- //! Returns a node identified by its position
- virtual TeViewNode* get(int i)
- {
- return viewTree_.retrieve(i);
- }
-
- //! Returns a node identified by its name and version
- virtual TeTheme* get(string themeName)
- {
- TeTheme *ret = 0;
- for (unsigned int th = 0;th < viewTree_.size();th++)
- {
- TeViewNode *node = viewTree_.retrieve(th);
- if (node->type() == TeTHEME)
- {
- TeTheme *tmp = (TeTheme*)node;
- if (tmp->name() == themeName)
- {
- ret = tmp;
- break;
- }
- }
- }
- return ret;
- }
-
- //! Sort the themes in the view
- virtual void sort()
- { viewTree_.sort(); }
-
- //! Swap the order of two themes
- virtual void swap( unsigned int i, unsigned int j)
- {
- viewTree_.swap(i,j);
- }
-
- //! Sets the themes visibility
- virtual void visibility( int vis )
- {
- viewTree_.visibility( vis );
- }
-
- //! Returns the themes visibility
- virtual int visibility()
- {
- return viewTree_.visibility();
- }
-
- //! Returns the number of themes in the view
- virtual unsigned int size()
- { return viewTree_.size() ; }
-
- //! Returns the vector of themes of the view sorted according to their priorities
- virtual vector<TeViewNode*>& themes()
- { return viewTree_.nodes();}
-
- //! Sets the id of the connected view
- virtual void connectedId(int id) {connectedId_ = id;}
-
- //! Returns the id of the connected view
- virtual int connectedId() {return connectedId_;}
-
- /*! Returns the boundary box of the view themes
- \param onlyVisible If is true, returns the boundary box of visible themes, otherwise returns the boundary box of all themes
- */
- virtual TeBox box( bool onlyVisible )
- {
- TeBox retval;
- if ( root() )
- retval = root()->box(onlyVisible,proj_);
- return retval;
- };
-
-private:
- int id_; // view id
- string name_; // view name
- string user_; // user id
- TeProjection* proj_;
- bool is_visible_;
-
- TeViewTree viewTree_;
- int connectedId_; // connected view
-
- TeBox currentBox_; // current box
- int currentTheme_; // current theme id
-};
-
-//! A map from identifiers to pointers to views
-typedef map<int,TeView*> TeViewMap;
-
-#endif
-
-
-
diff --git a/src/terralib/kernel/TeViewNode.cpp b/src/terralib/kernel/TeViewNode.cpp
deleted file mode 100644
index aa28c7b..0000000
--- a/src/terralib/kernel/TeViewNode.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-#include "TeViewNode.h"
-#include "TeTheme.h"
-#include "TeLayer.h"
-#include "TeProjection.h"
-
-TeBox
-TeViewTree::box(bool onlyVisible, TeProjection* destProjection)
-{
- TeBox retval;
- if ( destProjection == 0 )
- return retval;
-
- for (vector<TeViewNode*>::iterator child = nodes_.begin(); child != nodes_.end(); ++child)
- {
- TeViewNode* pt = (*child);
- if( pt->type() == TeTREE )
- updateBox( retval, ( (TeViewTree*)pt)->box( onlyVisible, destProjection ) );
- else
- {
-
- TeAbstractTheme* theme = (TeAbstractTheme*)(pt);
-
- if( onlyVisible && !( theme->visibility() & 0x00000001 ) )
- continue;
-
- TeBox themeBox = theme->getThemeBox();
- if(!themeBox.isValid())
- continue;
- theme->getThemeProjection()->setDestinationProjection(destProjection);
- TeCoord2D ll = themeBox.lowerLeft();
- TeCoord2D ur = themeBox.upperRight();
- TeBox convertedBox(theme->getThemeProjection()->PC2LL(ll),
- theme->getThemeProjection()->PC2LL(ur));
- ll = convertedBox.lowerLeft();
- ur = convertedBox.upperRight();
- convertedBox = TeBox(destProjection->LL2PC(ll),destProjection->LL2PC(ur));
- updateBox(retval, convertedBox);
- }
- }
- return retval;
-}
-
-bool
-TeViewTree::assertsPriorities()
-{
- bool updated = false;
- for ( unsigned int i=0; i<nodes_.size(); ++i)
- {
- TeViewNode* node = nodes_[i];
- if ( (node != NULL) && ( node->priority() != (int)i ) )
- {
- node->priority(i);
- updated = true;
- }
- if ( node->type() == TeTREE )
- {
- TeViewTree* tree = (TeViewTree*)node;
- if ( ( tree != NULL )
- && ( tree->assertsPriorities()== true)
- && ( updated == false ) )
- updated = true;
- }
- }
- return updated;
-}
-
-TeViewTree::~TeViewTree ()
-{
- // For all my children, delete them
- vector<TeViewNode*>::iterator child = nodes_.begin();
- while( child != nodes_.end() )
- {
- // Create a temporary pointer to store the child's
- // address
- TeViewNode* pt = (*child);
-
- // Remove the child from the list
- nodes_.erase(child);
- child = nodes_.begin();
-
- // Ok, now the child's parent points to NULL and we can
- // safely call the child's destructor
- delete pt;
- pt = 0;
- }
-}
-
-void
-TeViewTree::visibility(int vis)
-{
- for (vector<TeViewNode*>::iterator child = nodes_.begin();
- child != nodes_.end(); ++child)
- {
- TeViewNode* pt = (*child);
- pt->visibility( vis );
- }
-}
-
-int TeViewTree::visibility()
-{
- for (vector<TeViewNode*>::iterator child = nodes_.begin();
- child != nodes_.end(); ++child)
- {
- TeViewNode* pt = (*child);
- if ( pt->visibility() == 1 )
- return 1;
- }
- return 0;
-}
-
-void
-TeViewTree::swap(unsigned int i, unsigned int j)
-{
- if (i==j || i>=nodes_.size() || j>=nodes_.size())
- return;
- TeViewNode* temp = nodes_[i];
- nodes_[i] = nodes_[j];
- nodes_[j] = temp;
- nodes_[i]->priority (i);
- nodes_[j]->priority (j);
-}
-
-
-void
-TeViewTree::moveUp(TeViewNode* node)
-{
- for (unsigned int i=0 ; i<nodes_.size() ; i++)
- {
- if (node == nodes_[i])
- {
- swap (i, i-1);
- return;
- }
- }
-}
-
-void
-TeViewTree::moveDown(TeViewNode* node)
-{
- if (!node)
- return;
-
- for (unsigned int i=0 ; i<nodes_.size() ; ++i)
- {
- if (node == nodes_[i])
- {
- swap (i, i+1);
- return;
- }
- }
-}
-
-void TeViewTree::add(TeViewNode* node)
-{
- node->setParent ( this ); // I am the father
- node->priority(static_cast<int>(nodes_.size()));
- nodes_.push_back (node);
-}
-
-//! Removes a node identified by its name
-TeViewNode*
-TeViewTree::remove (const string& name)
-{
- vector<TeViewNode*>::iterator child = nodes_.begin();
- while ( child != nodes_.end() )
- {
- TeViewNode* pt = (*child);
- if (pt->name() == name)
- {
- nodes_.erase(child);
- return pt;
- }
- if(pt->type() == TeTREE)
- {
- TeViewNode* result = pt->remove(name);
- if(result) return result;
- }
- ++child;
- }
- return 0;
-}
-
-//! Removes a node through its identifier
-TeViewNode*
-TeViewTree::removeID (int id)
-{
- for (vector<TeViewNode*>::iterator child = nodes_.begin();
- child != nodes_.end(); ++child)
- {
- TeViewNode* pt = (*child);
- if(pt->id() == id)
- {
- nodes_.erase(child);
- return pt;
- }
- if(pt->type() == TeTREE)
- {
- TeViewNode* result = pt->removeID(id);
- if(result) return result;
- }
- }
- return 0;
-}
-
-void
-TeViewTree::draw ()
-{
- vector<TeViewNode*>::iterator child = nodes_.begin();
- while ( child != nodes_.end() )
- {
- TeViewNode* pt = (*child);
- pt->draw();
- ++child;
- }
-}
-
-void
-TeViewTree::sort()
-{
- int i, j;
- for (i = 0; i < (int)size() - 1; ++i)
- {
- for (j = i+1; j < (int)size(); ++j)
- {
- if (nodes_[i]->priority() > nodes_[j]->priority())
- {
- TeViewNode* temp = nodes_[i];
- nodes_[i] = nodes_[j];
- nodes_[j] = temp;
- }
- }
- }
-}
-
-void
-TeViewTree::clear()
-{
- // For all my children, delete them
- vector<TeViewNode*>::iterator child = nodes_.begin();
- while( child != nodes_.end() )
- {
- // Create a temporary pointer to store the child's
- // address
- TeViewNode* pt = (*child);
-
- // Remove the child from the list
- nodes_.erase(child);
-
- if( pt->type() == TeTREE )
- ((TeViewTree*)pt)->clear();
-
- child = nodes_.begin();
- }
-}
-
-int
-TeViewTree::moveTop (TeViewNode* node)
-{
- TeViewNode* parent = node->parent();
- if(parent == NULL)
- return -1;
- if(parent->type() != TeTREE)
- return -1;
- TeViewTree* tree = (TeViewTree*)parent;
- int i = 0;
- while(tree->retrieve(0) != node && tree->retrieve(0) != NULL)
- {
- tree->moveUp(node);
- ++i;
- }
- return i;
-}
-
-int
-TeViewTree::moveBottom(TeViewNode* node)
-{
- TeViewNode* parent = node->parent();
- if (parent == 0 || parent->type() != TeTREE)
- return -1;
- TeViewTree* tree = (TeViewTree*)parent;
- int i = 0;
- while(tree->nodes().back() != node && tree->nodes().back() != 0)
- {
- tree->moveDown(node);
- ++i;
- }
- return i;
-}
-
-
-void
-TeViewTree::insertFront(TeViewNode* node)
-{
- node->setParent( this ); // I am the father
- nodes_.insert(nodes_.begin(), node);
- int ind = 0;
- for (vector<TeViewNode*>::iterator child = nodes_.begin();
- child != nodes_.end(); ++child)
- {
- TeViewNode* pt = (*child);
- if ( pt )
- pt->priority( ind++ );
- }
-}
-
-TeViewNode*
-TeViewTree::find (int id)
-{
- for (vector<TeViewNode*>::iterator child = nodes_.begin();
- child != nodes_.end(); ++child)
- {
- TeViewNode* pt = (*child);
- if(pt->id() == id)
- return pt;
- if(pt->type() == TeTREE)
- {
- TeViewNode* result = ((TeViewTree*)(pt))->find(id);
- if(result)
- return result;
- }
- }
- return 0;
-}
-TeViewNode*
-TeViewTree::find( std::string name, bool caseS)
-{
- for (vector<TeViewNode*>::iterator child = nodes_.begin();
- child != nodes_.end(); ++child)
- {
- TeViewNode* pt = (*child);
- if( TeStringCompare( pt->name(), name, caseS ) )
- return pt;
- if( pt->type() == TeTREE )
- {
- TeViewNode* result = ((TeViewTree*)(pt))->find( name, caseS );
- if (result)
- return result;
- }
- }
- return 0;
-}
diff --git a/src/terralib/kernel/TeViewNode.h b/src/terralib/kernel/TeViewNode.h
deleted file mode 100644
index efcc9bb..0000000
--- a/src/terralib/kernel/TeViewNode.h
+++ /dev/null
@@ -1,404 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeViewNode.h
- \brief This file provides TerraLib's tree structure of views
-*/
-#ifndef __TERRALIB_INTERNAL_VIEWNODE_H
-#define __TERRALIB_INTERNAL_VIEWNODE_H
-
-#define THEME_GROUP
-
-#include "TeDefines.h"
-#include "TeBox.h"
-#include "TeAbstractFactory.h"
-
-#include <iostream>
-#include <string>
-#include <vector>
-using namespace std;
-
-class TeProjection;
-class TeViewNode;
-
-//! Type of view node
-enum TeViewNodeType
-{ TeTHEME=0, TeTREE=1, TeEXTERNALTHEME=2, TeFILETHEME=3 };
-
-
-//! A class to represent the view node parameters
-/*!
- This class contains the main view node parameters and it is used
- by the factory responsible for creating view node objects.
-
- \sa
- TeViewNode
-*/
-class TL_DLL TeViewNodeParams
-{
-public:
- //! Constructor
- TeViewNodeParams(const string& name="", const int& id=0, const int& viewId=0,
- const int nodeType=0, const int& priority=0, TeViewNode* parentNode=0,
- const int parentId=0):
- name_(name),
- id_(id),
- viewId_(viewId),
- nodeType_(nodeType),
- priority_(priority),
- myParent_(parentNode),
- myParentId_(parentId)
- { }
-
- //! Copy constructor
- TeViewNodeParams(const TeViewNodeParams& params)
- {
- name_ = params.name_;
- id_ = params.id_;
- viewId_ = params.viewId_;
- nodeType_ = params.nodeType_;
- priority_ = params.priority_;
- myParent_ = params.myParent_;
- myParentId_ = params.myParentId_;
- }
-
- //! Returns the view node type
- int getProductId() { return nodeType_; }
-
- //! Node name
- string name_;
- //! Node identity
- int id_;
- //! View identity that contains this node
- int viewId_;
- //! Node type
- int nodeType_;
- //! Precedence when stored in a view
- int priority_;
- //! Pointer to its parent
- TeViewNode* myParent_;
- //! Node parent id
- int myParentId_;
-};
-
-
-//! A class to deal with nodes of a view
-/*!
- In Terralib, a view is composed of nodes. This is a base class
- used to specialize view node types.
-
- \sa
- TeView TeViewNodeParams
-*/
-class TL_DLL TeViewNode
-{
-public:
- //! Empty constructor
- TeViewNode(const string& name="", TeViewNode* parent=0, const int& view=0, const int& id=0, const int& nodeType=0):
- viewNodeParams_(name, id, view, nodeType, 0, parent)
- { }
-
- //! Constructor
- TeViewNode(const TeViewNodeParams& viewNodeParams):
- viewNodeParams_(viewNodeParams)
- { }
-
- //! Destructor
- virtual ~TeViewNode()
- {}
-
- //! Inserts a new child in the tree hierachy. Fails if the object is a leaf
- virtual void add (TeViewNode*) {}
-
- //! Remove an existing child identified by its id from the tree hierarchy
- /*!
- Fails if the object is a leaf
- Should be used in conjunction with a delete
- */
- virtual TeViewNode* removeID (int /* id */) { return 0; }
-
- //! Remove an existing child identified by its name from the tree hierarchy
- /*!
- Fails if the object is a leaf
- Should be used in conjunction with a delete
- */
- virtual TeViewNode* remove (const string& /*name*/) { return 0; }
-
- //! Retrieve a node identified by its identifier from the tree structure
- virtual TeViewNode* retrieve (int) { return 0; }
-
- //! Returns a pointer to a parent node
- virtual TeViewNode* parent()
- { return viewNodeParams_.myParent_; }
-
- //! Returns the identifier of a node parent
- virtual int parentId()
- {
- if (viewNodeParams_.myParent_)
- return viewNodeParams_.myParent_->id();
- else
- return viewNodeParams_.myParentId_;
- }
-
- //! Sets the identification of the parent node
- virtual void parentId(int i)
- {
- if (viewNodeParams_.myParent_)
- viewNodeParams_.myParent_->id(i);
- viewNodeParams_.myParentId_ = i;
- }
-
- //! Sets the parent of node
- virtual void setParent ( TeViewNode* node )
- {
- viewNodeParams_.myParent_ = node;
- viewNodeParams_.myParentId_ = (viewNodeParams_.myParent_)? viewNodeParams_.myParent_->id():0;
- }
-
- //! Returns the identification of a node
- virtual int id () { return viewNodeParams_.id_; }
-
- //! Sets the identification of a node
- virtual void id (int i){ viewNodeParams_.id_ = i; }
-
- //! Returns the name of a node
- virtual string name () { return viewNodeParams_.name_; }
- //! Sets the name of a node
- virtual void name (const string& s) { viewNodeParams_.name_ = s; }
-
- //! Returns the priority of a node
- virtual int priority() { return viewNodeParams_.priority_; }
- //! Sets the priority of a node
- virtual void priority(int i) { viewNodeParams_.priority_ = i; }
-
- //! Sets the view identification of a node
- virtual void view (int viewId) { viewNodeParams_.viewId_ = viewId; }
- //! Returns the view identification of a node
- virtual int view () { return viewNodeParams_.viewId_ ; }
-
- //! Returns the node type
- virtual int type() { return viewNodeParams_.nodeType_; };
- //! Sets the node type
- virtual void type(const int& t) { viewNodeParams_.nodeType_ = t; }
-
- //! Moves a node up in the tree structure
- virtual void moveUp ()
- {
- if (viewNodeParams_.myParent_)
- viewNodeParams_.myParent_->moveUp (this);
- }
-
- //! Moves a node down in the tree structure
- virtual void moveDown ()
- {
- if (viewNodeParams_.myParent_)
- viewNodeParams_.myParent_->moveDown (this);
- }
-
- //! Swaps nodes
- virtual void swap ( unsigned int, unsigned int ) {}
-
- //! Sets the nodes visibility
- virtual void visibility ( int ){};
-
- //! Returns the nodes visibility
- virtual int visibility(){ return 1; };
-
- //! Draws a node
- virtual void draw() {}
-
- //! Sorts the node
- virtual void sort() {}
-
- static TeViewNode* DefaultObject()
- { return 0; }
-
- virtual int getProductId() const
- { return viewNodeParams_.nodeType_; }
-
- virtual TeViewNodeParams& viewNodeParams()
- { return viewNodeParams_; }
-
- virtual void viewNodeParams(TeViewNodeParams& p)
- { viewNodeParams_ = p; }
-
-
-protected:
-
- virtual void moveUp (TeViewNode*) {}
- virtual void moveDown (TeViewNode*) {}
-
- //! Node parameters
- TeViewNodeParams viewNodeParams_;
-};
-
-
-//! This class implements a virtual factory to create view node types.
-/*!
- This class is a base virtual factory used to specialize
- other factories that create particular node view types.
-
- \sa
- TeAbstractFactory TeViewNode TeViewNodeParams
-*/
-class TL_DLL TeViewNodeFactory : public TeAbstractFactory<TeViewNode,TeViewNodeParams, int>
-{
-public:
- //! Constructor based on the view node type
- TeViewNodeFactory(const int& nodeType) :
- TeAbstractFactory<TeViewNode,TeViewNodeParams, int>(nodeType)
- { }
-};
-
-
-//! A class to deal with branchs in a view tree structure
-class TL_DLL TeViewTree: public TeViewNode
-{
-public:
-
- //! Constructor
- TeViewTree(const string& name=""): TeViewNode(name, 0, 0, 0, (int)TeTREE)
- { }
-
- //! Constructor
- TeViewTree(const TeViewNodeParams& params):
- TeViewNode(params)
- { }
-
-
- //! Destructor
- virtual ~TeViewTree ();
-
- //! Sets the nodes visibility
- virtual void visibility (int vis);
-
- //! Returns the nodes visibility
- virtual int visibility ();
-
- //! Swap nodes
- virtual void swap (unsigned int i, unsigned int j);
-
- //! Moves a node up in the tree structure
- virtual void moveUp (TeViewNode* node);
-
- //! Moves a node down in the tree structure
- virtual void moveDown (TeViewNode* node);
-
- //! Adds a node to the structure
- virtual void add (TeViewNode* node);
-
- //! Removes a node identified by its name
- virtual TeViewNode* remove (const string& name);
-
- //! Removes a node through its identifier
- virtual TeViewNode* removeID (int id) ;
-
- //! Retrieves a node through its index
- virtual TeViewNode* retrieve (unsigned int i)
- { return nodes_[i]; }
-
- //! Draw a node
- virtual void draw ();
-
- //! Returns the size of the structure
- unsigned int size()
- { return nodes_.size(); }
-
- //! Returns the vector of View nodes
- vector<TeViewNode*>& nodes()
- { return nodes_; }
-
- //! Sort the vector of nodes according to their priorities
- void sort();
-
- //! Unlinks the nodes from the view tree
- virtual void clear();
-
- /*! Move the given node to the top of it's tree.
- \param node to be moved
- \return the number of positions the node has been moved
- */
- virtual int moveTop (TeViewNode* node);
-
- /*! Move the given node to the bottom of it's tree.
- \param node to be moved
- \return the number of positions the node has been moved
- */
- int moveBottom(TeViewNode* node);
-
- /*!
- Inserts the given node to at the begin of the view tree.
- \param node node to be added
- */
- virtual void insertFront(TeViewNode* node);
-
- /*! Look at a View Tree for a node with the given id.
- \param id Id of the node to be found
- */
- virtual TeViewNode* find (int id);
-
- /*! Look at a View Tree for a node with the given name.
- \param name name of the node to be found
- \param caseS(optional) true if the given name is case sensitive
- */
- virtual TeViewNode* find( std::string name, bool caseS = false );
-
- /*! Returns the boundary box of the tree view themes
- \param projection The returned box coordinates will be in the given projection
- */
- virtual TeBox box(bool onlyVisible, TeProjection* projection );
-
- /*! Asserts the nodes priorities by the positions.
- Returns true if any priority was updated, otherwise returns false.
- */
- virtual bool assertsPriorities();
-
-private:
- vector<TeViewNode*> nodes_;
-};
-
-
-//! This class implements a factory to create view tree objects.
-/*!
- This class is a factory that create view nodes
- of the type TeTREE, that is, view tree objects.
-
- \sa
- TeViewNodeFactory TeViewNodeParams TeViewTree
-*/
-class TL_DLL TeViewTreeFactory : public TeViewNodeFactory
-{
-public:
- //! Constructor
- TeViewTreeFactory() : TeViewNodeFactory((int)TeTREE)
- {}
-
- //! Created view tree objects
- TeViewTree* build(TeViewNodeParams* params)
- {
- TeViewNodeParams auxParams = *params;
- return new TeViewTree(auxParams);
- }
-};
-
-#endif
-
diff --git a/src/terralib/kernel/TeVisual.cpp b/src/terralib/kernel/TeVisual.cpp
deleted file mode 100644
index 2ea09d0..0000000
--- a/src/terralib/kernel/TeVisual.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-#include <TeVisual.h>
-
-TeBaseVisualParams::TeBaseVisualParams(TeGeomRep rep, const string& visualType) :
- symbId_ (TePolyTypeFill),
- color_ (255,0,0),
- transparency_ (0),
- width_ (0),
- contourSymbId_ (TeLnTypeContinuous),
- contourColor_(0,255,255),
- contourTransparency_ (0),
- contourWidth_ (1),
- sizeValue_ (0),
- ptAngle_ (0),
- family_ ("Verdana"),
- bold_ (false),
- italic_(false),
- alignmentVert_(0),
- alignmentHoriz_(0),
- tabSize_(6),
- lineSpace_(1),
- fixedSize_(false),
- visualType_(visualType),
- geomRep_(rep)
-{
- switch (rep)
- {
- case TePOLYGONS:
- case TeCELLS:
- symbId_= TePolyTypeFill;
- contourSymbId_= TeLnTypeContinuous;
- break;
- case TeLINES:
- symbId_= TeLnTypeContinuous;
- width_ = 1;
- break;
- case TePOINTS:
- case TeNODES:
- symbId_= TePtTypeBox;
- sizeValue_ = 3;
- break;
- case TeTEXT:
- sizeValue_= 12;
- break;
- default:
- break;
- }
-}
-
-// Copy constructor
-TeBaseVisualParams::TeBaseVisualParams(const TeBaseVisualParams& other)
-{
- symbId_ = other.symbId_;
- color_ = other.color_;
- transparency_ = other.transparency_;
- width_ = other.width_;
-
- contourSymbId_ = other.contourSymbId_;
- contourColor_ = other.contourColor_;
- contourTransparency_ = other.contourTransparency_;
- contourWidth_ = other.contourWidth_;
-
- sizeValue_ = other.sizeValue_;
- ptAngle_ = other.ptAngle_;
-
- family_ = other.family_;
- bold_ = other.bold_;
- italic_ = other.italic_;
- fixedSize_ = other.fixedSize_;
- alignmentVert_ = other.alignmentVert_;
- alignmentHoriz_ = other.alignmentHoriz_;
- tabSize_ = other.tabSize_;
- lineSpace_ = other.lineSpace_;
-
- visualType_ = other.visualType_;
- geomRep_ = other.geomRep_;
-}
-
-// Assignment operator
-TeBaseVisualParams&
-TeBaseVisualParams::operator=(const TeBaseVisualParams& vis)
-{
- if ( this != &vis )
- {
- symbId_ = vis.symbId_;
- color_ = vis.color_;
- transparency_ = vis.transparency_;
- width_ = vis.width_;
-
- contourSymbId_ = vis.contourSymbId_;
- contourColor_ = vis.contourColor_;
- contourTransparency_ = vis.contourTransparency_;
- contourWidth_ = vis.contourWidth_;
-
- sizeValue_ = vis.sizeValue_;
- ptAngle_ = vis.ptAngle_;
-
- family_ = vis.family_;
- bold_ = vis.bold_;
- italic_ = vis.italic_;
- fixedSize_ = vis.fixedSize_;
- alignmentVert_ = vis.alignmentVert_;
- alignmentHoriz_ = vis.alignmentHoriz_;
- tabSize_ = vis.tabSize_;
- lineSpace_ = vis.lineSpace_;
-
- visualType_ = vis.visualType_;
- geomRep_ = vis.geomRep_;
- }
- return *this;
-}
-
-// Returns TRUE if param1 is equal to param2 or FALSE if they are different.
-bool
-TeBaseVisualParams::operator== (const TeBaseVisualParams& vis)
-{
- return ( symbId_ == vis.symbId_ &&
- color_ == vis.color_ &&
- transparency_ == vis.transparency_ &&
- width_ == vis.width_ &&
- contourSymbId_ == vis.contourSymbId_ &&
- contourColor_ == vis.contourColor_ &&
- contourTransparency_ == vis.contourTransparency_ &&
- contourWidth_ == vis.contourWidth_ &&
- sizeValue_ == vis.sizeValue_ &&
- ptAngle_ == vis.ptAngle_ &&
- family_ == vis.family_ &&
- bold_ == vis.bold_ &&
- italic_ == vis.italic_ &&
- fixedSize_ == vis.fixedSize_ &&
- alignmentVert_ == vis.alignmentVert_ &&
- alignmentHoriz_ == vis.alignmentHoriz_ &&
- tabSize_ == vis.tabSize_ &&
- lineSpace_ == vis.lineSpace_ &&
- visualType_ == vis.visualType_ &&
- geomRep_ == vis.geomRep_);
-}
-
-// Returns visual to the default parameters
-void
-TeBaseVisualParams::clear()
-{
- symbId_ = TePolyTypeFill;
- color_ = TeColor(255,0,0);
- transparency_=0;
- width_ = 0;
- contourSymbId_ = TeLnTypeContinuous;
- contourColor_ = TeColor (0,255,255);
- contourTransparency_ = 0;
- contourWidth_ = 1;
- sizeValue_ = 0;
- ptAngle_ = 0;
- family_ = "Verdana";
- bold_ = false;
- italic_ = false;
- alignmentVert_ = 0;
- alignmentHoriz_ = 0;
- tabSize_ = 6;
- lineSpace_ = 1;
- fixedSize_ = false;
- geomRep_ = TePOLYGONS;
- visualType_="tevisual";
-}
-
-// Copies only the basic visual parameters from another visual
-void
-TeBaseVisualParams::setBasic (TeBaseVisualParams &vis)
-{
- symbId_ = vis.symbId_;
- color_ = vis.color_;
- transparency_ = vis.transparency_;
- width_ = vis.width_;
-
- contourSymbId_ = vis.contourSymbId_;
- contourColor_ = vis.contourColor_;
- contourTransparency_ = vis.contourTransparency_;
- contourWidth_ = vis.contourWidth_;
-
- sizeValue_ = vis.sizeValue_;
- ptAngle_ = vis.ptAngle_;
-
- family_ = vis.family_;
- bold_ = vis.bold_;
- italic_ = vis.italic_;
- fixedSize_ = vis.fixedSize_;
- alignmentVert_ = vis.alignmentVert_;
- alignmentHoriz_ = vis.alignmentHoriz_;
- tabSize_ = vis.tabSize_;
- lineSpace_ = vis.lineSpace_;
- geomRep_ = vis.geomRep_;
- visualType_="tevisual";
-}
-
-//--------------
-
-TeVisual::TeVisual(TeGeomRep rep) :
- params_ (TeBaseVisualParams(rep, "tevisual"))
-{
-}
-
-// Copy constructor
-TeVisual::TeVisual(const TeVisual& other)
-{
- params_ = other.params_;
-}
-
-// Assignment operator
-TeVisual&
-TeVisual::operator=(const TeVisual& vis)
-{
- if ( this != &vis )
- params_ = vis.params_;
- return *this;
-}
-
-// Returns TRUE if param1 is equal to param2 or FALSE if they are different.
-bool
-TeVisual::operator== (const TeVisual& vis)
-{
- return ( params_ == vis.params_);
-}
-
-// Returns visual to the default parameters
-void
-TeVisual::clear()
-{
- params_.clear();
-}
-
-// Copies only the basic visual parameters from another visual
-void
-TeVisual::setBasic (TeVisual &vis)
-{
- params_.setBasic(vis.params_);
-}
-
-
diff --git a/src/terralib/kernel/TeVisual.h b/src/terralib/kernel/TeVisual.h
deleted file mode 100644
index 707e2d9..0000000
--- a/src/terralib/kernel/TeVisual.h
+++ /dev/null
@@ -1,368 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeVisual.h
- \brief This file deals with the visual presentation characteristics of geometries in TerraLib
-*/
-#ifndef __TERRALIB_INTERNAL_VISUAL_H
-#define __TERRALIB_INTERNAL_VISUAL_H
-
-#include "TeDataTypes.h"
-#include "TeAbstractFactory.h"
-
-class TeRasterTransform;
-
-#include <string>
-#include <map>
-
-using namespace std;
-
-
-//! A structure for supporting a color definition
-struct TL_DLL TeColor
-{
- //! Red component
- int red_;
-
- //! Green component
- int green_;
-
- //! Blue component
- int blue_;
-
- //! Color name
- string name_;
-
- //! Empty constructor
- TeColor () : red_(0),green_(0),blue_(0), name_("") {}
-
- //! Constructor with parameters
- TeColor (int r, int g, int b, const string& name="") : red_(r),green_(g),blue_(b), name_(name) {}
-
- //! Set parameters of colors
- void init (int r, int g, int b, const string& name="") {red_=r,green_=g,blue_=b;name_=name; }
-
-
- //! Returns TRUE if color1 is equal to color2 or FALSE if they are different.
- bool operator== (const TeColor& color)
- {
- return (red_==color.red_ && green_==color.green_ && blue_==color.blue_);
- }
-
- //! Assignment operator
- TeColor& operator= ( const TeColor& color )
- {
- if ( this != &color )
- {
- red_ = color.red_;
- green_ = color.green_;
- blue_ = color.blue_;
- name_ = color.name_;
- }
- return *this;
- }
-};
-
-//! A class to represent the base visual parameters
-/*!
- This class contains the base visual parameters and it is used
- by the factory responsible for creating visual objects.
-
- \sa
- TeVisual
-*/
-class TL_DLL TeBaseVisualParams
-{
-public:
- //! Constructor
- TeBaseVisualParams(TeGeomRep rep = TePOLYGONS, const string& visualType = "tevisual");
-
- //! Copy constructor
- TeBaseVisualParams(const TeBaseVisualParams& other);
-
- //! Destructor
- virtual ~TeBaseVisualParams() {}
-
- //! Assignment operator
- virtual TeBaseVisualParams& operator=(const TeBaseVisualParams& visParams);
-
- //! Returns TRUE if param1 is equal to param2 or FALSE if they are different.
- virtual bool operator== (const TeBaseVisualParams& visParams);
-
- //! Returns visual to the default parameters
- virtual void clear();
-
- //! Copies only the basic visual parameters from another visual
- virtual void setBasic (TeBaseVisualParams &visParams);
-
- //! Returns the visual params type
- string getProductId() { return visualType_; }
-
- //! Symbol id that define the style for the geometry filling
- int symbId_;
- //! Color used for geometry filling (line, point and text color)
- TeColor color_;
- //! Percentage of transparency for the geometry filling
- int transparency_;
- //! Width for line geometry
- int width_;
-
- //! Symbol id that define the style for the geometry outline
- int contourSymbId_;
- //! Contour color for the geometry outline
- TeColor contourColor_;
- //! Percentage of transparency for the geometry outline
- int contourTransparency_;
- //! Width for the geometry outline
- int contourWidth_;
-
- //! Point size
- int sizeValue_;
- //! Point angle
- int ptAngle_;
-
- // Text attributes
- //! Text family
- string family_;
- //! Flag to indicate if text is bold
- bool bold_;
- //! Flag to indicate if text is italic
- bool italic_;
- //! Position of vertical alignment
- double alignmentVert_;
- //! Position of horizontal alignment
- double alignmentHoriz_;
- //! Number of spaces defined in a tab character
- int tabSize_;
- //! Spacing between lines
- int lineSpace_;
- //! Flag to indicate that element has a fixed size, dont follow zoom operations
- bool fixedSize_;
-
- //! Visual type used in factory strategy
- string visualType_;
- //! Geometric representation associated with this visual
- TeGeomRep geomRep_;
-};
-
-//! This class is used to store the standard presentation characteristics of vector geometries
-class TL_DLL TeVisual
-{
-public :
-
- //! Empty constructor
- TeVisual(TeGeomRep rep = TePOLYGONS);
-
- //! Destructor
- virtual ~TeVisual() {}
-
- //! Copy constructor
- TeVisual(const TeVisual& other);
-
- //! Assignment operator
- virtual TeVisual& operator=(const TeVisual& vis);
-
- //! Returns TRUE if param1 is equal to param2 or FALSE if they are different.
- virtual bool operator== (const TeVisual& vis);
-
- //! Returns visual to the default parameters
- virtual void clear();
-
- //! Copies only the basic visual parameters from another visual
- virtual void setBasic (TeVisual &vis);
-
- //! Sets the color used for geometry filling and line, point and text color
- virtual void color(TeColor& color)
- { params_.color_ = color;}
-
- //! Returns the color used for geometry filling and line, point and text color
- virtual TeColor& color()
- { return params_.color_; }
-
- //! Sets the style for the filling of geometries
- virtual void style(int s)
- { params_.symbId_ = s; }
-
- //! Returns the style for the filling of geometries
- virtual int style()
- { return params_.symbId_; }
-
- //! Sets the percentage of transparency for polygons and cells
- virtual void transparency(int t)
- { params_.transparency_ = t; }
-
- //! Returns the percentage of transparency used in polygons and cells
- virtual int transparency()
- { return params_.transparency_; }
-
- //! Sets the color for the polygons and cells outlines
- virtual void contourColor(TeColor& color)
- { params_.contourColor_ = color;}
-
- //! Returns the color used in the polygons and cells outlines
- virtual TeColor& contourColor()
- { return params_.contourColor_; }
-
- //! Sets the percentage of transparency for the polygon ans cells outlines
- virtual void contourTransparency(int t)
- { params_.contourTransparency_ = t;}
-
- //! Returns the color used in the polygons and cells outlines
- virtual int contourTransparency()
- { return params_.contourTransparency_; }
-
- //! Sets the contour width for the polygons and cells outlines
- virtual void contourWidth(int w)
- { params_.contourWidth_ = w; }
-
- //! Returns the contour width used in the polygons and cells outlines
- virtual int contourWidth()
- { return params_.contourWidth_; }
-
- //! Sets the contour style for the polygons and cells outlines
- virtual void contourStyle(int s)
- { params_.contourSymbId_ = s; }
-
- //! Returns the contour style used in the polygons and cells outlines
- virtual int contourStyle()
- { return params_.contourSymbId_; }
-
- //! Sets the width
- virtual void width(int w)
- { params_.width_ = w; }
-
- //! Returns the width
- virtual int width ()
- { return params_.width_; }
-
- //! Sets the point size
- virtual void size (int s)
- { params_.sizeValue_ = s; }
-
- //! Returns the point size
- virtual int size ()
- { return params_.sizeValue_; }
-
- //! Sets the text family for fonts
- virtual void family (string f)
- { params_.family_ = f; }
-
- //! Returns fonts family
- virtual string family ()
- { return params_.family_ ; }
-
- //! Sets the bold style for texts
- virtual void bold (bool b)
- { params_.bold_ = b; }
-
- //! Returns the bold style used in the texts
- virtual bool bold ()
- { return params_.bold_; }
-
- //! Sets the italic style for texts
- virtual void italic (bool i)
- { params_.italic_ = i; }
-
- //! Returns the italic style used in the texts
- virtual bool italic ()
- { return params_.italic_; }
-
- //! Sets a flag indicating if the text will have a fixed size
- virtual void fixedSize (bool i)
- { params_.fixedSize_ = i; }
-
- //! Retuns a flag indicating if an text have a fixed size
- virtual bool fixedSize ()
- { return params_.fixedSize_; }
-
- //! Sets the vertical alignment of texts
- virtual void alignmentVert(double a)
- { params_.alignmentVert_ = a; }
-
- //! Retuns the vertical alignment of texts
- virtual double alignmentVert()
- { return params_.alignmentVert_; }
-
- //! Sets the horizontal alignment of texts
- virtual void alignmentHoriz(double a)
- { params_.alignmentHoriz_ = a; }
-
- //! Retuns the horizontal alignment of texts
- virtual double alignmentHoriz()
- { return params_.alignmentHoriz_; }
-
- //! Sets the number of spaces defined in a tab character
- virtual void tabSize (int s)
- { params_.tabSize_ = s; }
-
- //! Returns the number of spaces defined in a tab character
- virtual int tabSize ()
- { return params_.tabSize_; }
-
- //! Sets the spacing between lines
- virtual void lineSpace (int s)
- { params_.lineSpace_ = s; }
-
- //! Returns the spacing between lines
- virtual int lineSpace ()
- { return params_.lineSpace_; }
-
- //! Returns the angle of points and symbols
- virtual int ptAngle()
- {return params_.ptAngle_; }
-
- //! Sets the angle of points and symbols
- virtual void ptAngle(int p)
- {params_.ptAngle_ = p;}
-
- //! Creates another visual pointer and copies its content
- virtual TeVisual* copy()
- {
- TeVisual* retval = new TeVisual();
- *retval = *this;
- return retval;
- }
-
- //! Returns a default visual object
- static TeVisual* DefaultObject()
- { return new TeVisual(); }
-
-protected:
- TeBaseVisualParams params_;
-};
-
-
-//! A factory to build TeVisual objects
-class TL_DLL TeVisualFactory : public TeAbstractFactory<TeVisual, TeBaseVisualParams, string>
-{
-public:
- TeVisualFactory(const string& facName) : TeAbstractFactory<TeVisual, TeBaseVisualParams, string>(facName)
- {}
- virtual TeVisual* build ()
- { return new TeVisual(); }
-};
-
-//! Export the type that represents the definition of visual for raster data
-typedef TeRasterTransform TeRasterVisual;
-
-#endif
-
diff --git a/src/terralib/kernel/checkvec.h b/src/terralib/kernel/checkvec.h
deleted file mode 100644
index 50cbefb..0000000
--- a/src/terralib/kernel/checkvec.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/************************************************************************************
- TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-// include/checkvec : vector class with checked limits
-#ifndef CHECKVEC_H
-#define CHECKVEC_H
-#include<cassert>
-#include<vector>
-
-namespace br_stl
-{
- template<class T>
- class checkedVector : public std::vector<T>
- {
- public:
- // inherited types
- typedef typename checkedVector::size_type size_type;
- typedef typename checkedVector::iterator iterator;
- typedef typename checkedVector::difference_type difference_type;
- typedef typename checkedVector::reference reference;
- typedef typename checkedVector::const_reference const_reference;
-
- checkedVector() {
- }
-
- checkedVector(size_type n, const T& value = T())
- : std::vector<T>(n, value) {
- }
-
- // checkedVector(iterator i, iterator j)
- // : std::vector<T>(i, j) {}
-
- reference operator[](difference_type index) {
- assert(index >=0
- && index < static_cast<difference_type>(this->size()));
- return std::vector<T>::operator[](index);
- }
-
-
- const_reference operator[](difference_type index) const {
- assert(index >=0
- && index < static_cast<difference_type>(this->size()));
- return std::vector<T>::operator[](index);
- }
-
- };
-}
-
-
-#endif
-
diff --git a/src/terralib/kernel/dynpq.h b/src/terralib/kernel/dynpq.h
deleted file mode 100644
index ebb0a8d..0000000
--- a/src/terralib/kernel/dynpq.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-// include/dynpq.h
-#ifndef DYNPQ_H
-#define DYNPQ_H
-#include<checkvec.h>
-#include<algorithm>
-#include<showseq.h>
-
-namespace br_stl
-{
- // compares the associated values of passed iterators
- template<class T>
- struct IterGreater
- {
- bool operator()( T x, T y) const
- {
- return *y < *x;
- }
- };
-
- template <class key_type>
- class dynamic_priority_queue
- {
- public:
- // public type definitions
- typedef typename std::vector<key_type>::size_type size_type;
- typedef typename std::vector<key_type>::difference_type index_type;
-
- // constructor
- dynamic_priority_queue(std::vector<key_type>& v);
-
- // change a value at position 'at'
- void changeKeyAt(index_type at, key_type k);
-
- // index of the smallest element (= highest priority)
- index_type topIndex() const { return c.front() - first; }
-
- // value of the smallest element (= highest priority)
- const key_type& topKey() const { return *c.front(); }
-
- void pop(); // remove smallest element from the heap
-
- bool empty() const { return csize == 0;}
- size_type size() const { return csize;}
-
- private:
- // checkedVector<index_type> Indices; // auxiliary vector ANAP
- vector<index_type> Indices; // auxiliary vector
- typedef typename std::vector<key_type>::iterator randomAccessIterator;
- // checkedVector<randomAccessIterator> c; // heap of iterators ANAP
- vector<randomAccessIterator> c; // heap of iterators
- randomAccessIterator first; // beginning of the external vector
- IterGreater<randomAccessIterator> comp; // comparison object
- index_type csize; // current heap size
-
- // heap update (see below)
- void goUp(index_type);
- void goDown(index_type);
- };
-
- template <class key_type>
- dynamic_priority_queue<key_type>::dynamic_priority_queue(
- std::vector<key_type>& v)
- : Indices(v.size()), c(v.size()), first(v.begin()),
- csize(v.size())
- {
- // store iterators and generate heap
- for(index_type i = 0; i< csize; ++i)
- c[i] = v.begin()+i;
- make_heap(c.begin(), c.end(), comp); // STL
-
- // construct index array
- for(index_type ii = 0; ii< csize; ++ii) // ANAP i-> ii
- Indices[c[ii] - first] = ii;
- }
-
- template <class key_type>
- void dynamic_priority_queue<key_type>::changeKeyAt(
- index_type at, key_type k)
- {
- index_type idx = Indices[at];
-
- // if (idx < csize) //ANAP
- // {
- assert(idx < csize); // value still present in the queue?
-
- if(*c[idx] != k) { // in case of equality, do nothing
- if(k > *c[idx])
- {
- *c[idx] = k; // enter heavier value
- goDown(idx); // reorganize heap
- }
- else
- {
- *c[idx] = k; // enter lighter value
- goUp(idx); // reorganize heap
- }
- }
- // }
- // else cout << "erro no dynamic_priority_queue<key_type>::changeKeyAt" << idx << csize << k << endl;
- }
-
- template <class key_type>
- void dynamic_priority_queue<key_type>::goUp(index_type idx)
- {
- index_type Predecessor = (idx-1)/2;
- randomAccessIterator temp = c[idx];
-
- while(Predecessor != idx && comp(c[Predecessor], temp))
- {
- c[idx] = c[Predecessor];
- Indices[c[idx]-first] = idx;
- idx = Predecessor;
- Predecessor = (idx-1)/2;
- }
-
- c[idx] = temp;
- Indices[c[idx]-first] = idx;
- }
-
- template <class key_type>
- void dynamic_priority_queue<key_type>::goDown(index_type idx)
- {
- index_type Successor = (idx+1)*2-1;
-
- if(Successor < csize-1
- && comp(c[Successor], c[Successor+1]))
- ++Successor;
- randomAccessIterator temp = c[idx];
-
- while(Successor < csize && comp(temp, c[Successor]))
- {
- c[idx] = c[Successor];
- Indices[c[idx]-first] = idx;
- idx = Successor;
- Successor = (idx+1)*2-1;
-
- if(Successor < csize-1
- && comp(c[Successor], c[Successor+1]))
- ++Successor;
- }
- c[idx] = temp;
- Indices[c[idx]-first] = idx;
- }
-
- /* The method pop() removes the topmost element from the heap. This is
- done by moving the last element to the top and blocking the freed
- position with --csize. Subsequently, the element sinks down to its
- proper position. */
-
- template <class key_type>
- void dynamic_priority_queue<key_type>::pop()
- {
- // overwrite iterator at the top with the
- // address of the last element
- c[0] = c[--csize];
-
- // enter the new address 0 at the position belonging
- // to this element in the auxiliary array
- Indices[c[0]-first] = 0;
-
- // let the element at the top sink to the correct
- // position corresponding to its weight
- goDown(0);
- }
-
-} // namespace br_stl
-#endif
-
diff --git a/src/terralib/kernel/graph.h b/src/terralib/kernel/graph.h
deleted file mode 100644
index 6205ef9..0000000
--- a/src/terralib/kernel/graph.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file graph.h
- \brief This file contains structures and definitions used to manipulate a graph strucutre
- \note this code came from the book "Desining Components with C++ STL" -
- Ulrich Breymann - Addison-Wesley - pag 243
-*/
-#ifndef TL_GRAPH_H
-#define TL_GRAPH_H
-#include <cassert>
-#include <vector>
-#include <map>
-#include <stack>
-#include <iostream>
-#include <TeDefines.h>
-
-namespace br_stl
-{
- // empty parameter class with a minimal set of operations
- // if there are no weights for edges necessary
- struct TL_DLL Empty
- {
- public:
- Empty(int=0) {}
- bool operator<(const Empty&) const { return true;}
- };
-
- inline std::ostream& operator<<(std::ostream& os, const Empty&) { return os;}
- inline std::istream& operator>>(std::istream& is, Empty& ) { return is;}
-
- template<class VertexType, class EdgeType>
- class Graph
- {
- public:
- // public type interface
- typedef std::map<int, EdgeType > Successor;
- typedef std::pair<VertexType, Successor> vertex;
- typedef std::vector<vertex> GraphType;
- typedef typename GraphType::iterator iterator;
- typedef typename GraphType::const_iterator const_iterator;
-
- /* The following constructor initializes the output channel with
- cerr. A parameter must be specified as to whether the graph is
- directed or undirected, because this is an essential property
- of a graph. */
-
- Graph(bool g, std::ostream& os = cerr)
- : directed(g), pOut(&os)
- { }
-
- bool isDirected() const { return directed;}
-
- /* A graph is a special kind of container to which something can
- be added and whose elements can be accessed. Therefore, typical
- container methods follow, which in their extent are limited to
- those needed in the book's examples. Thus, there is no method
- for explicit removal of a vertex or an edge from the graph. */
-
- size_t size() const { return C.size();}
-
- iterator begin() { return C.begin();}
- iterator end() { return C.end();}
-
- // access to vertex i}
- vertex& operator[](int i)
- {
- // the access is safe, because C is a checkedVector
- return C[i];
- }
-
- // return the position of the vertex, if it does not exist return -1
- int getPosition(const VertexType& e);
-
- // addition of a vertex
- int insert(const VertexType& e);
-
- // addition of an edge between e1 and e2
- void insert(const VertexType& e1, const VertexType& e2,
- const EdgeType& Value);
-
- // addition of an edge between vertices no. i and j
- void connectVertices(int i, int j, const EdgeType& Value);
-
- // set the edge value between vertices no. i and j
- bool setEdgeValue(const VertexType& e1, const VertexType& e2, const EdgeType& Value);
-
- /* The following methods are useful tools for displaying
- information on a graph and check its structure.*/
-
- // checking of a read data model
- // output on the channel passed to check()
- void check(std::ostream& = std::cout);
-
- // determine the number of edges
- size_t CountEdges();
-
- /* determine whether the graph contains cycles and in which way it
- is connected. The method combines two tasks, because they can
- be carried out in a single run.*/
- void CycleAndConnect(std::ostream& = cout);
- int sucessors(int index);
-
- private:
- bool directed;
- GraphType C; // container
- std::ostream* pOut;
- }; // class Graph
-
-
- template<class VertexType, class EdgeType>
- int Graph<VertexType,EdgeType>::getPosition(const VertexType& e)
- {
- for(size_t i = 0; i < size(); ++i)
- if(e == C[i].first)
- return i;
-
- return -1;
- }
-
- /* In order to avoid ambiguities, a vertex is only entered if it does
- not yet exist. The sequential search is not particularly fast; on the
- other hand, this process is only needed once during the construction
- of the graph. The position of the vertex is returned. */
-
- template<class VertexType, class EdgeType>
- int Graph<VertexType,EdgeType>::insert(const VertexType& e)
- {
- int pos = getPosition(e);
- if(pos<0)
- {
- // if not found, insert:
- C.push_back(vertex(e, Successor()));
- return size()-1;
- }
-
- return pos;
- }
-
- /* An edge is inserted by first inserting the vertices, if needed, and
- by determining their positions. The edge construction itself is
- carried out by the function connectVertices(). It is passed the
- vertex numbers and, because of the absence of a search procedure,
- it is very fast. */
-
- template<class VertexType, class EdgeType>
- void Graph<VertexType,EdgeType>::insert(const VertexType& e1,
- const VertexType& e2,
- const EdgeType& Value)
- {
- int pos1 = insert(e1);
- int pos2 = insert(e2);
- connectVertices(pos1, pos2, Value);
- }
-
- template<class VertexType, class EdgeType>
- void Graph<VertexType,EdgeType>::connectVertices(
- int pos1, int pos2, const EdgeType& Value)
- {
- (C[pos1].second)[pos2] = Value;
-
- if(!directed) // automatically insert opposite direction too
- (C[pos2].second)[pos1] = Value;
- }
-
- template<class VertexType, class EdgeType>
- bool Graph<VertexType,EdgeType>::setEdgeValue(const VertexType& e1,
- const VertexType& e2,
- const EdgeType& Value)
- {
- int pos1 = getPosition(e1);
- int pos2 = getPosition(e2);
-
- if((pos1<0) || (pos2<0))
- return false;
-
- (C[pos1].second)[pos2] = Value;
-
- if(!directed) // automatically insert opposite direction too
- (C[pos1].second)[pos2] = Value;
-
- return true;
- }
-
-
- template<class VertexType, class EdgeType>
- void Graph<VertexType,EdgeType>::check(std::ostream& os)
- {
- os << "The graph is ";
- if(!isDirected())
- os << "un";
-
- os << "directed and has "
- << size() << " vertices and "
- << CountEdges()
- << " edges\n";
- CycleAndConnect(os);
- }
-
- template<class VertexType, class EdgeType>
- size_t Graph<VertexType,EdgeType>::CountEdges()
- {
- size_t edges = 0;
- iterator temp = begin();
-
- while(temp != end())
- edges += (*temp++).second.size();
-
- if(!directed)
- edges /= 2;
- return edges;
- }
-
- // Type for next function
- enum VertStatus {notVisited, visited, processed};
-
- template<class VertexType, class EdgeType>
- int Graph<VertexType, EdgeType>::sucessors(int index) {
- typename Successor::const_iterator
- start = operator[](index).second.begin(),
- end = operator[](index).second.end();
- int nSucc = 0;
- while(start != end)
- {
- nSucc++;
- ++start;
- }
-
- return nSucc;
- }
- template<class VertexType, class EdgeType>
- void Graph<VertexType, EdgeType>::CycleAndConnect(std::ostream& os) {
- int Cycles = 0;
- int ComponentNumber = 0;
- std::stack<int, std::vector<int> > verticesStack; // vertices to be visited
-
- /* In order to prevent multiple visits to vertices in possible
- cycles, which entails the risk of infinite loops, the vertices
- are marked for having been visited or finished being processed.
- This purpose is served by the vector VertexState. */
-
- // assign all vertices the state `not visited'
- std::vector<VertStatus> VertexState(size(), notVisited);
-
- /* If, starting from one vertex, an attempt is made to reach all
- other vertices, success is not guaranteed in weakly or
- non-connected graphs. Therefore, each vertex is visited. If it
- is found that a vertex has already been visited, it does not
- need to be processed any further. */
-
- // visit all vertices
- for(size_t i = 0; i < size(); ++i)
- {
- if(VertexState[i] == notVisited)
- {
- ++ComponentNumber;
- // store on stack for further processing
- verticesStack.push(i);
-
- // process stack
- while(!verticesStack.empty())
- {
- int theVertex = verticesStack.top();
- verticesStack.pop();
- if(VertexState[theVertex] == visited)
- VertexState[theVertex] = processed;
- else
- if(VertexState[theVertex] == notVisited)
- {
- VertexState[theVertex] = visited;
- // new vertex, earmark for processed mark
- verticesStack.push(theVertex);
-
- /* If one of the successors of a newly found vertex
- bears the visited mark, the algorithm has already
- passed this point once, and there is a cycle. */
-
- // earmark successor:
- typename Successor::const_iterator
- start = operator[](theVertex).second.begin(),
- end = operator[](theVertex).second.end();
-
- while(start != end)
- {
- int Succ = (*start).first;
-
- if(VertexState[Succ] == visited)
- {
- ++Cycles; // someone's been here already!
- (*pOut) << "at least vertex "
- << operator[](Succ).first
- << " lies in a cycle\n";
- }
-
- /* Otherwise, the vertex has already been
- processed and therefore should not be
- considered again, or it has not yet been
- visited and is earmarked on the stack. */
-
- if(VertexState[Succ] == notVisited)
- verticesStack.push(Succ);
- ++start;
- }
- }
- } // stack empty?
- } // if(VertexState}...
- } // for()} ...
-
- /* Now we only need the output. In case of directed, weakly
- connected graphs, the algorithm counts several components. In
- order to make the output conform to the above definitions,
- although with less content of information, a distinction is
- made as to whether the graph is directed or not. */
-
- if(directed)
- {
- if(ComponentNumber == 1)
- os << "The graph is strongly connected.\n";
- else
- os << "The graph is not or weakly "
- "connected.\n";
- }
- else
- os << "The graph has "
- << ComponentNumber
- << " component(s)." << std::endl;
-
- os << "The graph has ";
- if(Cycles == 0)
- os << "no ";
- os << "cycles." << std::endl;
- }
-
- template<class VertexType, class EdgeType>
- std::ostream& operator<<(std::ostream& os, Graph<VertexType,EdgeType>& G)
- {
- // display of vertices with successors
- for(size_t i = 0; i < G.size(); ++i)
- {
- os << G[i].first << " <";
- typename Graph<VertexType,EdgeType>::Successor::const_iterator
- startN = G[i].second.begin(),
- endN = G[i].second.end();
-
- while(startN != endN)
- {
- os << G[(*startN).first].first << ' ' // vertex
- << (*startN).second << ' '; // edge value
- ++startN;
- }
- os << ">" << std::endl;
- }
- return os;
- }
-} // namespace br_stl
-
-
-
-#endif
-
diff --git a/src/terralib/kernel/lexTemporal.cpp b/src/terralib/kernel/lexTemporal.cpp
deleted file mode 100644
index 55a0eae..0000000
--- a/src/terralib/kernel/lexTemporal.cpp
+++ /dev/null
@@ -1,1927 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-/* A lexical scanner generated by flex */
-
-/* Scanner skeleton version:
- * $Header: /home/terralib/src/terralib/kernel/lexTemporal.cpp,v 1.8 2007/01/16 16:52:24 lubia Exp $
- */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-
-#include <stdio.h>
-#include <errno.h>
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
-
-#ifdef __cplusplus
-
-#include <stdlib.h>
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-#if __STDC__
-
-#define YY_USE_PROTOS
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-#ifdef __TURBOC__
- #pragma warn -rch
- #pragma warn -use
-#include <io.h>
-#include <stdlib.h>
-#define YY_USE_CONST
-#define YY_USE_PROTOS
-#endif
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-
-#ifdef YY_USE_PROTOS
-#define YY_PROTO(proto) proto
-#else
-#define YY_PROTO(proto) ()
-#endif
-
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#define YY_BUF_SIZE 16384
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-
-extern int yyleng;
-extern FILE *yyin, *yyout;
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yytext_ptr )
-
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-typedef unsigned int yy_size_t;
-
-
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
-static YY_BUFFER_STATE yy_current_buffer = 0;
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- */
-#define YY_CURRENT_BUFFER yy_current_buffer
-
-
-/* yy_hold_char holds the character lost when yytext is formed. */
-static char yy_hold_char;
-
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-
-
-int yyleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 1; /* whether we need to initialize */
-static int yy_start = 0; /* start state number */
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-void yyrestart YY_PROTO(( FILE *input_file ));
-
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
-void yy_load_buffer_state YY_PROTO(( void ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
-
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
-
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
-static void yy_flex_free YY_PROTO(( void * ));
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
-
-
-#define YY_USES_REJECT
-
-#define yywrap() 1
-#define YY_SKIP_YYWRAP
-typedef unsigned char YY_CHAR;
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
-typedef int yy_state_type;
-extern int yylineno;
-int yylineno = 1;
-extern char *yytext;
-#define yytext_ptr yytext
-
-static yy_state_type yy_get_previous_state YY_PROTO(( void ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
-static int yy_get_next_buffer YY_PROTO(( void ));
-static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yytext_ptr = yy_bp; \
- yyleng = (int) (yy_cp - yy_bp); \
- yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- yy_c_buf_p = yy_cp;
-
-#define YY_NUM_RULES 35
-#define YY_END_OF_BUFFER 36
-static yyconst short int yy_acclist[257] =
- { 0,
- 36, 34, 35, 1, 2, 34, 35, 33, 35, 2,
- 34, 35, 3, 34, 35, 4, 34, 35, 34, 35,
- 23, 34, 35, 34, 35, 34, 35, 26, 34, 35,
- 34, 35, 34, 35, 34, 35, 1, 3, 4, 31,
- 32, 23, 30, 30, 26, 30, 26, 30, 30, 27,
- 30, 30, 28, 30, 26, 30, 26, 30, 26, 30,
- 29, 30, 30, 30, 30, 30, 30, 30, 30, 26,
- 30, 26, 30, 26, 30, 26, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 24, 26, 30, 26, 30,
- 26, 30, 26, 30, 26, 30, 16, 30, 30, 30,
-
- 30, 30, 30, 30, 30, 30, 24, 26, 30, 26,
- 30, 26, 30, 26, 30, 26, 30, 26, 30, 30,
- 15, 30, 30, 30, 30, 30, 30, 30, 18, 30,
- 24, 26, 30, 26, 30, 26, 30, 26, 30, 26,
- 30, 26, 30, 30, 30, 17, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 26, 30, 26,
- 30, 26, 30, 26, 30, 26, 30, 30, 30, 14,
- 30, 21, 30, 13, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 26, 30, 26, 30, 26, 30,
- 26, 30, 30, 30, 30, 30, 30, 30, 30, 30,
-
- 30, 30, 30, 26, 30, 26, 30, 26, 30, 30,
- 30, 30, 30, 30, 11, 30, 30, 30, 30, 30,
- 30, 25, 25, 26, 30, 26, 30, 19, 30, 20,
- 30, 7, 30, 30, 30, 5, 30, 8, 30, 30,
- 30, 30, 26, 30, 6, 30, 9, 30, 30, 12,
- 30, 22, 30, 30, 10, 30
- } ;
-
-static yyconst short int yy_accept[189] =
- { 0,
- 1, 1, 1, 2, 4, 8, 10, 13, 16, 19,
- 21, 24, 26, 28, 31, 33, 35, 37, 38, 39,
- 40, 41, 42, 42, 43, 44, 45, 47, 49, 50,
- 52, 53, 53, 55, 57, 59, 61, 63, 64, 65,
- 66, 67, 68, 69, 70, 70, 72, 74, 76, 78,
- 79, 80, 81, 82, 83, 84, 85, 86, 87, 89,
- 91, 93, 95, 97, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 107, 108, 110, 112, 114, 116, 118,
- 120, 121, 123, 124, 125, 126, 127, 128, 129, 131,
- 131, 132, 134, 136, 138, 140, 142, 144, 145, 146,
-
- 148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
- 158, 158, 158, 160, 162, 164, 166, 168, 169, 170,
- 172, 174, 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 185, 185, 187, 189, 191, 193, 194, 195,
- 196, 197, 198, 199, 200, 201, 202, 203, 204, 204,
- 204, 206, 208, 210, 211, 212, 213, 214, 215, 217,
- 218, 219, 220, 221, 222, 223, 224, 226, 228, 230,
- 232, 234, 235, 236, 238, 240, 241, 242, 243, 245,
- 247, 249, 250, 252, 254, 255, 257, 257
- } ;
-
-static yyconst int yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 1, 1, 1, 1, 1, 1, 1, 5,
- 6, 7, 1, 1, 1, 1, 8, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 10, 1, 1,
- 1, 1, 1, 1, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 20, 34, 20,
- 1, 1, 1, 1, 35, 1, 20, 20, 20, 20,
-
- 36, 20, 20, 20, 20, 20, 20, 20, 37, 20,
- 20, 20, 20, 20, 38, 20, 20, 20, 20, 20,
- 20, 20, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static yyconst int yy_meta[39] =
- { 0,
- 1, 1, 2, 1, 1, 1, 1, 1, 3, 1,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3
- } ;
-
-static yyconst short int yy_base[190] =
- { 0,
- 0, 0, 242, 581, 239, 581, 581, 234, 232, 32,
- 33, 213, 0, 29, 209, 205, 195, 228, 224, 222,
- 581, 581, 217, 36, 0, 211, 54, 79, 194, 0,
- 103, 40, 0, 124, 149, 185, 0, 211, 195, 31,
- 204, 199, 202, 200, 205, 173, 198, 175, 222, 175,
- 177, 182, 181, 40, 181, 188, 190, 191, 247, 272,
- 161, 296, 160, 172, 167, 163, 163, 163, 165, 174,
- 167, 157, 175, 173, 143, 321, 142, 345, 141, 370,
- 161, 0, 146, 157, 149, 149, 398, 146, 0, 45,
- 50, 132, 131, 414, 130, 439, 128, 28, 150, 0,
-
- 140, 146, 143, 142, 125, 46, 140, 122, 122, 135,
- 141, 140, 110, 108, 464, 107, 489, 129, 128, 0,
- 0, 0, 111, 124, 111, 121, 103, 116, 115, 118,
- 94, 55, 65, 89, 87, 514, 86, 108, 111, 105,
- 94, 99, 86, 103, 82, 83, 82, 94, 98, 97,
- 67, 66, 539, 82, 73, 72, 71, 74, 0, 74,
- 66, 72, 60, 78, 78, 69, 48, 47, 0, 0,
- 0, 69, 65, 0, 0, 70, 51, 48, 33, 0,
- 0, 43, 0, 0, 28, 0, 581, 43, 577
- } ;
-
-static yyconst short int yy_def[190] =
- { 0,
- 187, 1, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 188, 188, 188, 188, 188, 188, 187, 187, 187,
- 187, 187, 187, 187, 188, 188, 188, 14, 188, 188,
- 188, 187, 188, 188, 27, 35, 188, 188, 188, 188,
- 188, 188, 188, 188, 187, 188, 34, 47, 47, 188,
- 188, 188, 188, 188, 188, 188, 188, 189, 188, 46,
- 60, 60, 62, 188, 188, 188, 188, 188, 188, 188,
- 188, 188, 187, 189, 59, 59, 76, 76, 78, 78,
- 188, 188, 188, 188, 188, 188, 188, 188, 188, 187,
- 189, 76, 76, 76, 94, 94, 96, 188, 188, 188,
-
- 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
- 187, 187, 94, 94, 94, 115, 115, 188, 188, 188,
- 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
- 188, 187, 187, 115, 115, 115, 136, 188, 188, 188,
- 188, 188, 188, 188, 188, 188, 188, 188, 187, 187,
- 136, 136, 136, 188, 188, 188, 188, 188, 188, 188,
- 188, 188, 188, 188, 187, 187, 153, 153, 188, 188,
- 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
- 188, 188, 188, 188, 188, 188, 0, 187, 187
- } ;
-
-static yyconst short int yy_nxt[620] =
- { 0,
- 4, 5, 6, 7, 8, 9, 4, 10, 11, 4,
- 12, 13, 13, 14, 13, 13, 13, 14, 13, 13,
- 13, 13, 14, 15, 16, 13, 13, 13, 14, 17,
- 13, 13, 13, 14, 4, 13, 14, 13, 21, 22,
- 23, 24, 27, 23, 24, 25, 27, 45, 32, 52,
- 68, 27, 69, 90, 111, 53, 186, 27, 91, 112,
- 118, 119, 27, 132, 149, 27, 28, 34, 185, 126,
- 179, 34, 127, 133, 150, 184, 34, 166, 149, 183,
- 182, 181, 34, 180, 179, 167, 165, 34, 178, 177,
- 34, 35, 36, 176, 175, 174, 36, 173, 172, 171,
-
- 170, 36, 169, 167, 151, 166, 165, 36, 164, 163,
- 162, 161, 36, 160, 159, 36, 38, 158, 157, 156,
- 39, 155, 154, 153, 151, 40, 134, 148, 147, 146,
- 145, 41, 42, 144, 143, 43, 44, 46, 142, 141,
- 140, 46, 139, 138, 136, 134, 46, 113, 133, 132,
- 131, 130, 46, 129, 128, 125, 124, 46, 123, 122,
- 46, 47, 48, 121, 120, 117, 48, 115, 113, 92,
- 110, 48, 102, 101, 100, 99, 98, 48, 96, 94,
- 92, 91, 48, 90, 89, 48, 59, 88, 87, 86,
- 59, 85, 84, 83, 82, 59, 81, 80, 78, 74,
-
- 72, 59, 71, 70, 67, 66, 59, 65, 64, 59,
- 60, 61, 62, 58, 57, 61, 56, 55, 54, 51,
- 61, 50, 49, 37, 33, 32, 61, 20, 19, 18,
- 31, 61, 30, 29, 61, 63, 26, 20, 19, 63,
- 18, 187, 187, 187, 63, 187, 187, 187, 187, 187,
- 63, 187, 187, 187, 187, 63, 187, 187, 63, 49,
- 75, 187, 187, 187, 75, 187, 187, 187, 187, 75,
- 187, 187, 187, 187, 187, 75, 187, 187, 187, 187,
- 75, 187, 187, 75, 76, 77, 187, 187, 187, 77,
- 187, 187, 187, 187, 77, 187, 187, 187, 187, 187,
-
- 77, 187, 187, 187, 187, 77, 187, 187, 77, 79,
- 187, 187, 187, 79, 187, 187, 187, 187, 79, 187,
- 187, 187, 187, 187, 79, 187, 187, 187, 187, 79,
- 187, 187, 79, 62, 93, 187, 187, 187, 93, 187,
- 187, 187, 187, 93, 187, 187, 187, 187, 187, 93,
- 187, 187, 187, 187, 93, 187, 187, 93, 95, 187,
- 187, 187, 95, 187, 187, 187, 187, 95, 187, 187,
- 187, 187, 187, 95, 187, 187, 187, 187, 95, 187,
- 187, 95, 78, 97, 187, 187, 187, 97, 187, 187,
- 187, 187, 97, 187, 187, 187, 187, 187, 97, 187,
-
- 187, 187, 187, 97, 187, 187, 97, 80, 103, 104,
- 187, 105, 106, 187, 187, 187, 187, 187, 187, 187,
- 107, 187, 108, 187, 187, 187, 109, 114, 187, 187,
- 187, 114, 187, 187, 187, 187, 114, 187, 187, 187,
- 187, 187, 114, 187, 187, 187, 187, 114, 187, 187,
- 114, 94, 116, 187, 187, 187, 116, 187, 187, 187,
- 187, 116, 187, 187, 187, 187, 187, 116, 187, 187,
- 187, 187, 116, 187, 187, 116, 96, 135, 187, 187,
- 187, 135, 187, 187, 187, 187, 135, 187, 187, 187,
- 187, 187, 135, 187, 187, 187, 187, 135, 187, 187,
-
- 135, 115, 137, 187, 187, 187, 137, 187, 187, 187,
- 187, 137, 187, 187, 187, 187, 187, 137, 187, 187,
- 187, 187, 137, 187, 187, 137, 117, 152, 187, 187,
- 187, 152, 187, 187, 187, 187, 152, 187, 187, 187,
- 187, 187, 152, 187, 187, 187, 187, 152, 187, 187,
- 152, 136, 168, 187, 187, 187, 168, 187, 187, 187,
- 187, 168, 187, 187, 187, 187, 187, 168, 187, 187,
- 187, 187, 168, 187, 187, 168, 153, 73, 187, 73,
- 3, 187, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
-
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 187, 187, 187, 187, 187, 187, 187, 187
- } ;
-
-static yyconst short int yy_chk[620] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 10, 10,
- 11, 11, 14, 24, 24, 188, 14, 32, 32, 40,
- 54, 14, 54, 90, 90, 40, 185, 14, 91, 91,
- 98, 98, 14, 132, 132, 14, 14, 27, 182, 106,
- 179, 27, 106, 133, 133, 178, 27, 166, 166, 177,
- 176, 173, 27, 172, 168, 167, 165, 27, 164, 163,
- 27, 27, 28, 162, 161, 160, 28, 158, 157, 156,
-
- 155, 28, 154, 152, 151, 150, 149, 28, 148, 147,
- 146, 145, 28, 144, 143, 28, 31, 142, 141, 140,
- 31, 139, 138, 137, 135, 31, 134, 131, 130, 129,
- 128, 31, 31, 127, 126, 31, 31, 34, 125, 124,
- 123, 34, 119, 118, 116, 114, 34, 113, 112, 111,
- 110, 109, 34, 108, 107, 105, 104, 34, 103, 102,
- 34, 34, 35, 101, 99, 97, 35, 95, 93, 92,
- 88, 35, 86, 85, 84, 83, 81, 35, 79, 77,
- 75, 74, 35, 73, 72, 35, 46, 71, 70, 69,
- 46, 68, 67, 66, 65, 46, 64, 63, 61, 58,
-
- 57, 46, 56, 55, 53, 52, 46, 51, 50, 46,
- 46, 47, 48, 45, 44, 47, 43, 42, 41, 39,
- 47, 38, 36, 29, 26, 23, 47, 20, 19, 18,
- 17, 47, 16, 15, 47, 49, 12, 9, 8, 49,
- 5, 3, 0, 0, 49, 0, 0, 0, 0, 0,
- 49, 0, 0, 0, 0, 49, 0, 0, 49, 49,
- 59, 0, 0, 0, 59, 0, 0, 0, 0, 59,
- 0, 0, 0, 0, 0, 59, 0, 0, 0, 0,
- 59, 0, 0, 59, 59, 60, 0, 0, 0, 60,
- 0, 0, 0, 0, 60, 0, 0, 0, 0, 0,
-
- 60, 0, 0, 0, 0, 60, 0, 0, 60, 62,
- 0, 0, 0, 62, 0, 0, 0, 0, 62, 0,
- 0, 0, 0, 0, 62, 0, 0, 0, 0, 62,
- 0, 0, 62, 62, 76, 0, 0, 0, 76, 0,
- 0, 0, 0, 76, 0, 0, 0, 0, 0, 76,
- 0, 0, 0, 0, 76, 0, 0, 76, 78, 0,
- 0, 0, 78, 0, 0, 0, 0, 78, 0, 0,
- 0, 0, 0, 78, 0, 0, 0, 0, 78, 0,
- 0, 78, 78, 80, 0, 0, 0, 80, 0, 0,
- 0, 0, 80, 0, 0, 0, 0, 0, 80, 0,
-
- 0, 0, 0, 80, 0, 0, 80, 80, 87, 87,
- 0, 87, 87, 0, 0, 0, 0, 0, 0, 0,
- 87, 0, 87, 0, 0, 0, 87, 94, 0, 0,
- 0, 94, 0, 0, 0, 0, 94, 0, 0, 0,
- 0, 0, 94, 0, 0, 0, 0, 94, 0, 0,
- 94, 94, 96, 0, 0, 0, 96, 0, 0, 0,
- 0, 96, 0, 0, 0, 0, 0, 96, 0, 0,
- 0, 0, 96, 0, 0, 96, 96, 115, 0, 0,
- 0, 115, 0, 0, 0, 0, 115, 0, 0, 0,
- 0, 0, 115, 0, 0, 0, 0, 115, 0, 0,
-
- 115, 115, 117, 0, 0, 0, 117, 0, 0, 0,
- 0, 117, 0, 0, 0, 0, 0, 117, 0, 0,
- 0, 0, 117, 0, 0, 117, 117, 136, 0, 0,
- 0, 136, 0, 0, 0, 0, 136, 0, 0, 0,
- 0, 0, 136, 0, 0, 0, 0, 136, 0, 0,
- 136, 136, 153, 0, 0, 0, 153, 0, 0, 0,
- 0, 153, 0, 0, 0, 0, 0, 153, 0, 0,
- 0, 0, 153, 0, 0, 153, 153, 189, 0, 189,
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
-
- 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 187, 187, 187, 187, 187, 187, 187, 187
- } ;
-
-static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
-static char *yy_full_match;
-static int yy_lp;
-#define REJECT \
-{ \
-*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
-yy_cp = yy_full_match; /* restore poss. backed-over text */ \
-++yy_lp; \
-goto find_rule; \
-}
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-char *yytext;
-#define INITIAL 0
-/*
-* Lex
-*/
-#include <string.h>
-#include <yyTemporal.h>
-
-extern const char *myinputptr; /* current position in myinput */
-extern long myinputlim; /* end of data */
-
-int lineno;
-char lexOut[1000];
-char sqlOutLex[1000];
-
-#undef YY_INPUT
-extern int my_yyinput(char* buf, int max_size);
-#define YY_INPUT(buffer, result, size) (result=my_yyinput(buffer,size))
-
-void initLexOut()
-{
- for(int i=0; i<1000; ++i)
- {
- lexOut[i] = '\0';
- sqlOutLex[i] = '\0';
- }
- return;
-}
-
-int my_yyinput(char* buf, int max_size)
-{
- int n = max_size;
-// int s = myinputlim - (int)myinputptr;
- long s = myinputlim - (long)myinputptr;
- if(max_size>s)
- n = s;
-
- //int n = min(max_size, myinputlim - (int)myinputptr);
- if(n>0)
- {
- initLexOut();
- memcpy(buf, myinputptr, n);
- myinputptr += n;
- }
- return n;
-}
-
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
-#else
-extern int yywrap YY_PROTO(( void ));
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr ));
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput YY_PROTO(( void ));
-#else
-static int input YY_PROTO(( void ));
-#endif
-#endif
-
-#if YY_STACK_USED
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PROTO(( int new_state ));
-#endif
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PROTO(( void ));
-#endif
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PROTO(( void ));
-#endif
-
-#else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
-#endif
-
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( yy_current_buffer->yy_is_interactive ) \
- { \
- int c = '*', n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-#endif
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL int yylex YY_PROTO(( void ))
-#endif
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-#define YY_RULE_SETUP \
- YY_USER_ACTION
-
-YY_DECL
- {
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
-
-
-
-
- if ( yy_init )
- {
- yy_init = 0;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yy_start )
- yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( ! yy_current_buffer )
- yy_current_buffer =
- yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_load_buffer_state();
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yy_start;
- yy_state_ptr = yy_state_buf;
- *yy_state_ptr++ = yy_current_state;
-yy_match:
- do
- {
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 188 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- *yy_state_ptr++ = yy_current_state;
- ++yy_cp;
- }
- while ( yy_base[yy_current_state] != 581 );
-
-yy_find_action:
- yy_current_state = *--yy_state_ptr;
- yy_lp = yy_accept[yy_current_state];
-/* find_rule: we branch to this label when backing up */
- for ( ; ; ) /* until we find what rule we matched */
- {
- if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
- {
- yy_act = yy_acclist[yy_lp];
- {
- yy_full_match = yy_cp;
- break;
- }
- }
- --yy_cp;
- yy_current_state = *--yy_state_ptr;
- yy_lp = yy_accept[yy_current_state];
- }
-
- YY_DO_BEFORE_ACTION;
-
- if ( yy_act != YY_END_OF_BUFFER )
- {
- int yyl;
- for ( yyl = 0; yyl < yyleng; ++yyl )
- if ( yytext[yyl] == '\n' )
- ++yylineno;
- }
-
-do_action: /* This label is used only to access EOF actions. */
-
-
- switch ( yy_act )
- { /* beginning of action switch */
-case 1:
-YY_RULE_SETUP
-{ ; }
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-{ ; }
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-{ strncat(sqlOutLex, yytext, strlen(yytext)); };
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-{ strncat(sqlOutLex, yytext, strlen(yytext)); };
- YY_BREAK
-case 5:
-case 6:
-case 7:
-case 8:
-case 9:
-case 10:
-case 11:
-case 12:
-YY_RULE_SETUP
-{ strncat(lexOut, yytext, strlen(yytext));
- strncat(lexOut, ";", 1);
- return TEMPORALRELATION; }
- YY_BREAK
-case 13:
-case 14:
-case 15:
-case 16:
-case 17:
-case 18:
-case 19:
-case 20:
-case 21:
-case 22:
-YY_RULE_SETUP
-{ strncat(lexOut, yytext, strlen(yytext));
- return CHRONON; }
- YY_BREAK
-case 23:
-YY_RULE_SETUP
-{ strncat(lexOut, yytext, strlen(yytext)); strncat(lexOut, ";", 1); return NUMBER;}
- YY_BREAK
-case 24:
-YY_RULE_SETUP
-{ strncat(lexOut, yytext, strlen(yytext)); strncat(lexOut, ";", 1); return NUMBER; }
- YY_BREAK
-case 25:
-YY_RULE_SETUP
-{ strncat(lexOut, yytext, strlen(yytext)); strncat(lexOut, ";", 1); return NUMBER; }
- YY_BREAK
-case 26:
-YY_RULE_SETUP
-{ strncat(lexOut, yytext, strlen(yytext)); strncat(lexOut, ";", 1); return MASK;}
- YY_BREAK
-case 27:
-YY_RULE_SETUP
-{strncat(sqlOutLex, yytext, strlen(yytext)); return OR;}
- YY_BREAK
-case 28:
-YY_RULE_SETUP
-{strncat(sqlOutLex, yytext, strlen(yytext)); return AND;}
- YY_BREAK
-case 29:
-YY_RULE_SETUP
-{strncat(sqlOutLex, yytext, strlen(yytext)); return NOT;}
- YY_BREAK
-case 30:
-YY_RULE_SETUP
-{ strncat(lexOut, yytext, strlen(yytext)); strncat(lexOut, ";", 1); return NAME; }
- YY_BREAK
-case 31:
-YY_RULE_SETUP
-{
-#if TePLATFORM != TePLATFORMCODE_AIX
- int yyinput();
-#endif
- unsigned char c1=0,c2=yyinput();
- while (1)
- {
- if ((char)c2==EOF) break;
- if ((c1=='*') && (c2=='/')) break;
- if (c2=='\n') {lineno++;}
- c1=c2;
- c2=yyinput();
- }
- }
- YY_BREAK
-case 32:
-YY_RULE_SETUP
-{
-#if TePLATFORM != TePLATFORMCODE_AIX
- int yyinput();
-#endif
- unsigned char c1=yyinput();
- while (1)
- {
- if (c1=='\n') {lineno++;break;}
- c1=yyinput();
- }
- }
- YY_BREAK
-case 33:
-YY_RULE_SETUP
-{ lineno++; }
- YY_BREAK
-case 34:
-YY_RULE_SETUP
-{ return yytext[0]; }
- YY_BREAK
-case YY_STATE_EOF(INITIAL):
-{ return 0; }
- YY_BREAK
-case 35:
-YY_RULE_SETUP
-ECHO;
- YY_BREAK
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = yyin;
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state );
-
- yy_bp = yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yy_c_buf_p;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap() )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[yy_n_chars];
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of yylex */
-
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-
-static int yy_get_next_buffer()
- {
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = yytext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( yy_current_buffer->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_current_buffer->yy_n_chars = yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
-
- int yy_c_buf_p_offset =
- (int) (yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = yy_current_buffer->yy_buf_size -
- number_to_move - 1;
-#endif
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- yy_n_chars, num_to_read );
-
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- if ( yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- yy_n_chars += number_to_move;
- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
-
- return ret_val;
- }
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-static yy_state_type yy_get_previous_state()
- {
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
- yy_current_state = yy_start;
- yy_state_ptr = yy_state_buf;
- *yy_state_ptr++ = yy_current_state;
-
- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 188 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- *yy_state_ptr++ = yy_current_state;
- }
-
- return yy_current_state;
- }
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-
-#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
-#else
-static yy_state_type yy_try_NUL_trans( yy_current_state )
-yy_state_type yy_current_state;
-#endif
- {
- register int yy_is_jam;
-
- register YY_CHAR yy_c = 1;
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 188 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 187);
- if ( ! yy_is_jam )
- *yy_state_ptr++ = yy_current_state;
-
- return yy_is_jam ? 0 : yy_current_state;
- }
-
-
-#ifndef YY_NO_UNPUT
-#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp )
-#else
-static void yyunput( c, yy_bp )
-int c;
-register char *yy_bp;
-#endif
- {
- register char *yy_cp = yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = yy_n_chars + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
- register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
-
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- yy_current_buffer->yy_n_chars =
- yy_n_chars = yy_current_buffer->yy_buf_size;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
- if ( c == '\n' )
- --yylineno;
-
- yytext_ptr = yy_bp;
- yy_hold_char = *yy_cp;
- yy_c_buf_p = yy_cp;
- }
-#endif /* ifndef YY_NO_UNPUT */
-
-
-#ifdef __cplusplus
-static int yyinput()
-#else
-static int input()
-#endif
- {
- int c;
-
- *yy_c_buf_p = yy_hold_char;
-
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- /* This was really a NUL. */
- *yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yy_c_buf_p - yytext_ptr;
- ++yy_c_buf_p;
-
- switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( yyin );
-
- /* fall through */
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- return EOF;
-
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput();
-#else
- return input();
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
-
- if ( c == '\n' )
- ++yylineno;
-
- return c;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yyrestart( FILE *input_file )
-#else
-void yyrestart( input_file )
-FILE *input_file;
-#endif
- {
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_init_buffer( yy_current_buffer, input_file );
- yy_load_buffer_state();
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
-#else
-void yy_switch_to_buffer( new_buffer )
-YY_BUFFER_STATE new_buffer;
-#endif
- {
- if ( yy_current_buffer == new_buffer )
- return;
-
- if ( yy_current_buffer )
- {
- /* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- yy_current_buffer = new_buffer;
- yy_load_buffer_state();
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( void )
-#else
-void yy_load_buffer_state()
-#endif
- {
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- yyin = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
-
-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
-#else
-YY_BUFFER_STATE yy_create_buffer( file, size )
-FILE *file;
-int size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file );
-
- return b;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b )
-#else
-void yy_delete_buffer( b )
-YY_BUFFER_STATE b;
-#endif
- {
- if ( ! b )
- return;
-
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yy_flex_free( (void *) b->yy_ch_buf );
-
- yy_flex_free( (void *) b );
- }
-
-
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
-//extern int isatty YY_PROTO(( int ));
-#endif
-#endif
-#endif
-
-#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
-#else
-void yy_init_buffer( b, file )
-YY_BUFFER_STATE b;
-FILE *file;
-#endif
-
-
- {
- yy_flush_buffer( b );
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
-#if YY_ALWAYS_INTERACTIVE
- b->yy_is_interactive = 1;
-#else
-#if YY_NEVER_INTERACTIVE
- b->yy_is_interactive = 0;
-#else
-// b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-#endif
-#endif
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_flush_buffer( YY_BUFFER_STATE b )
-#else
-void yy_flush_buffer( b )
-YY_BUFFER_STATE b;
-#endif
-
- {
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == yy_current_buffer )
- yy_load_buffer_state();
- }
-
-
-#ifndef YY_NO_SCAN_BUFFER
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
-#else
-YY_BUFFER_STATE yy_scan_buffer( base, size )
-char *base;
-yy_size_t size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b );
-
- return b;
- }
-#endif
-
-
-#ifndef YY_NO_SCAN_STRING
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
-#else
-YY_BUFFER_STATE yy_scan_string( yy_str )
-yyconst char *yy_str;
-#endif
- {
- int len;
- for ( len = 0; yy_str[len]; ++len )
- ;
-
- return yy_scan_bytes( yy_str, len );
- }
-#endif
-
-
-#ifndef YY_NO_SCAN_BYTES
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
-#else
-YY_BUFFER_STATE yy_scan_bytes( bytes, len )
-yyconst char *bytes;
-int len;
-#endif
- {
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
- buf = (char *) yy_flex_alloc( n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
-
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n );
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
- }
-#endif
-
-
-#ifndef YY_NO_PUSH_STATE
-#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state )
-#else
-static void yy_push_state( new_state )
-int new_state;
-#endif
- {
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
- {
- yy_size_t new_size;
-
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
-
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
-
- else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
-
- if ( ! yy_start_stack )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
-
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
-
- BEGIN(new_state);
- }
-#endif
-
-
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state()
- {
- if ( --yy_start_stack_ptr < 0 )
- YY_FATAL_ERROR( "start-condition stack underflow" );
-
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
- }
-#endif
-
-
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state()
- {
- return yy_start_stack[yy_start_stack_ptr - 1];
- }
-#endif
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( yyconst char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
- }
-
-
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
- yyleng = n; \
- } \
- while ( 0 )
-
-
-/* Internal utility routines. */
-
-#ifndef yytext_ptr
-#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
-#else
-static void yy_flex_strncpy( s1, s2, n )
-char *s1;
-yyconst char *s2;
-int n;
-#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
-#endif
-
-#ifdef YY_NEED_STRLEN
-#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
-#else
-static int yy_flex_strlen( s )
-yyconst char *s;
-#endif
- {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
- }
-#endif
-
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( yy_size_t size )
-#else
-static void *yy_flex_alloc( size )
-yy_size_t size;
-#endif
- {
- return (void *) malloc( size );
- }
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, yy_size_t size )
-#else
-static void *yy_flex_realloc( ptr, size )
-void *ptr;
-yy_size_t size;
-#endif
- {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
- }
-
-#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
-#else
-static void yy_flex_free( ptr )
-void *ptr;
-#endif
- {
- free( ptr );
- }
-
-#if YY_MAIN
-int main()
- {
- yylex();
- return 0;
- }
-#endif
-
diff --git a/src/terralib/kernel/showseq.h b/src/terralib/kernel/showseq.h
deleted file mode 100644
index 04276a8..0000000
--- a/src/terralib/kernel/showseq.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Template zur Anzeige von Sequenzen
-// Template for the display of sequences (file include/showseq)
-#ifndef SHOWSEQ_H
-#define SHOWSEQ_H
-
-#include<iostream>
-
-namespace br_stl {
-
-template<class Container>
-void showSequence(const Container& s, const char* sep = " ",
- std::ostream& where = std::cout) {
- typename Container::const_iterator iter = s.begin();
- while(iter != s.end())
- where << *iter++ << sep;
- where << std::endl;
-}
-
-
-} // namespace br_stl
-
-#endif
-
diff --git a/src/terralib/kernel/yyTemporal.cpp b/src/terralib/kernel/yyTemporal.cpp
deleted file mode 100644
index 7013b55..0000000
--- a/src/terralib/kernel/yyTemporal.cpp
+++ /dev/null
@@ -1,495 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifdef WIN32
-#pragma warning ( disable: 4786 )
-#endif
-
-#ifndef lint
-static char const
-yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";
-#endif
-#include <stdlib.h>
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYLEX yylex()
-#define YYEMPTY -1
-#define yyclearin (yychar=(YYEMPTY))
-#define yyerrok (yyerrflag=0)
-#define YYRECOVERING() (yyerrflag!=0)
-static int yygrowstack();
-#define YYPREFIX "yy"
-#include <stdio.h>
-#include <iostream>
-#include <string.h>
-#include <TeDatabase.h>
-
-extern int yylex();
-extern void initLexOut();
-
-extern char lexOut[1000];
-extern char sqlOutLex[1000];
-
-char sqlOut[1000];
-char tempSql[1000];
-string aux;
-
-const char* myinputptr;
-string myinputptr_aux;
-long myinputlim;
-
-TeDatabase* database_;
-
-int initParse(const string& strIn, TeDatabase* db)
-{
- for(int i=0; i<1000; ++i)
- {
- sqlOut[i] = '\0';
- tempSql[i]= '\0';
- }
-
- //myinputptr = new char();
- //memcpy(myinputptr, strIn.c_str(), strIn.size ());
- myinputptr_aux = strIn;
- myinputptr = myinputptr_aux.c_str();
-
- myinputlim = (long)myinputptr + strIn.size ();
- database_ = db;
- return 1;
-}
-
-void yyerror(char* msg)
-{
- if(strcmp(msg,"syntax error"))
- printf(" Syntax Error : %s\n", msg);
-}
-
-#define YYERRCODE 256
-#define TEMPORALRELATION 257
-#define CHRONON 258
-#define NAME 259
-#define NUMBER 260
-#define MASK 261
-#define OR 262
-#define AND 263
-#define NOT 264
-const short yylhs[] = { -1,
- 0, 0, 0, 0, 0,
-};
-const short yylen[] = { 2,
- 15, 2, 3, 3, 3,
-};
-const short yydefred[] = { 0,
- 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
- 3, 0, 4, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1,
-};
-const short yydgoto[] = { 4,
-};
-const short yysindex[] = { -40,
- -52, -40, -40, -260, -251, 0, -37, -40, -40, -50,
- 0, -253, 0, -246, -45, -242, -43, -243, -41, -241,
- -39, -240, -36, -236, 0,
-};
-const short yyrindex[] = { 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-};
-const short yygindex[] = { 3,
-};
-#define YYTABLESIZE 263
-const short yytable[] = { 3,
- 5, 8, 9, 11, 6, 7, 5, 10, 14, 9,
- 12, 13, 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 25, 24, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 5, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 2, 8, 9, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 5,
-};
-const short yycheck[] = { 40,
- 0, 262, 263, 41, 2, 3, 59, 259, 59, 263,
- 8, 9, 259, 59, 257, 59, 260, 59, 260, 59,
- 261, 258, 59, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 41, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 259, -1,
- -1, -1, -1, 264, 262, 263, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 262,
-};
-#define YYFINAL 4
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 264
-#if YYDEBUG
-const char * const yyname[] = {
-"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'('","')'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"TEMPORALRELATION",
-"CHRONON","NAME","NUMBER","MASK","OR","AND","NOT",
-};
-const char * const yyrule[] = {
-"$accept : exp",
-"exp : NAME ';' NAME ';' NAME ';' TEMPORALRELATION ';' NUMBER ';' NUMBER ';' MASK ';' CHRONON",
-"exp : NOT exp",
-"exp : '(' exp ')'",
-"exp : exp AND exp",
-"exp : exp OR exp",
-};
-#endif
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-#if YYDEBUG
-#include <stdio.h>
-#endif
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-#define YYINITSTACKSIZE 200
-int yydebug;
-int yynerrs;
-int yyerrflag;
-int yychar;
-short *yyssp;
-YYSTYPE *yyvsp;
-YYSTYPE yyval;
-YYSTYPE yylval;
-short *yyss;
-short *yysslim;
-YYSTYPE *yyvs;
-int yystacksize;
-
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack()
-{
- int newsize, i;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = yystacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
- i = yyssp - yyss;
- newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
- (short *)malloc(newsize * sizeof *newss);
- if (newss == NULL)
- return -1;
- yyss = newss;
- yyssp = newss + i;
- newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
- (YYSTYPE *)malloc(newsize * sizeof *newvs);
- if (newvs == NULL)
- return -1;
- yyvs = newvs;
- yyvsp = newvs + i;
- yystacksize = newsize;
- yysslim = yyss + newsize - 1;
- return 0;
-}
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-#ifndef YYPARSE_PARAM
-#if defined(__cplusplus) || __STDC__
-#define YYPARSE_PARAM_ARG void
-#define YYPARSE_PARAM_DECL
-#else /* ! ANSI-C/C++ */
-#define YYPARSE_PARAM_ARG
-#define YYPARSE_PARAM_DECL
-#endif /* ANSI-C/C++ */
-#else /* YYPARSE_PARAM */
-#ifndef YYPARSE_PARAM_TYPE
-#define YYPARSE_PARAM_TYPE void *
-#endif
-#if defined(__cplusplus) || __STDC__
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL
-#else /* ! ANSI-C/C++ */
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;
-#endif /* ANSI-C/C++ */
-#endif /* ! YYPARSE_PARAM */
-
-int
-yyparse (string& sql/*, YYPARSE_PARAM_ARG*/)
- YYPARSE_PARAM_DECL
-{
- register int yym, yyn, yystate;
- string aux = "";
-#if YYDEBUG
- register const char *yys;
-
- if ((yys = getenv("YYDEBUG")))
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = (-1);
-
- if (yyss == NULL && yygrowstack()) goto yyoverflow;
- yyssp = yyss;
- yyvsp = yyvs;
- *yyssp = yystate = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate])) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yyssp >= yysslim && yygrowstack())
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- yychar = (-1);
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-#if defined(lint) || defined(__GNUC__)
-// yyerror("syntax error");
- ++yynerrs;
-#endif
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
-#endif
- if (yyssp >= yysslim && yygrowstack())
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yyssp);
-#endif
- if (yyssp <= yyss) goto yyabort;
- --yyssp;
- --yyvsp;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = (-1);
- goto yyloop;
- }
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- yyval = yyvsp[1-yym];
- switch (yyn)
- {
-case 1:
-{
- strncat(sqlOut, sqlOutLex, strlen(sqlOutLex));
- aux = database_->getSQLTemporalWhere (string(lexOut));
- memcpy(tempSql, aux.c_str(), aux.size());
- strncat(sqlOut, tempSql, strlen(tempSql));
- initLexOut();
- }
-break;
- }
- yyssp -= yym;
- yystate = *yyssp;
- yyvsp -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yyssp = YYFINAL;
- *++yyvsp = yyval;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
-#endif
- if (yyssp >= yysslim && yygrowstack())
- {
- goto yyoverflow;
- }
- *++yyssp = yystate;
- *++yyvsp = yyval;
- goto yyloop;
-yyoverflow:
-// yyerror("yacc stack overflow");
-yyabort:
- return (1);
-yyaccept:
- {
- sql = string(sqlOut);
- //delete(myinputptr); cai!!!!
- return (0);
- }
-}
diff --git a/src/terralib/kernel/yyTemporal.h b/src/terralib/kernel/yyTemporal.h
deleted file mode 100644
index 0ddc760..0000000
--- a/src/terralib/kernel/yyTemporal.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#ifndef YYERRCODE
-#define YYERRCODE 256
-#endif
-
-#define TEMPORALRELATION 257
-#define CHRONON 258
-#define NAME 259
-#define NUMBER 260
-#define MASK 261
-#define OR 262
-#define AND 263
-#define NOT 264
diff --git a/src/terralib/utils/TeColorUtils.cpp b/src/terralib/utils/TeColorUtils.cpp
deleted file mode 100644
index 9af5ca1..0000000
--- a/src/terralib/utils/TeColorUtils.cpp
+++ /dev/null
@@ -1,780 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-#include <TeColorUtils.h>
-#include <TeDatabase.h>
-#include <TeAsciiFile.h>
-
-bool getColors(std::vector<std::string>& ramps, int nc, std::vector<TeColor> &colors)
-{
- if (ramps.empty())
- ramps.push_back("RED");
-
- TeColor RGB;
- map<string, TeColor> mapcor;
-
- RGB.name_ = "RED";
- RGB.red_ = 240;
- RGB.green_ = 0;
- RGB.blue_ = 0;
- mapcor["RED"] = RGB;
-
- RGB.name_ = "GREEN";
- RGB.red_ = 0;
- RGB.green_ = 240;
- RGB.blue_ = 0;
- mapcor["GREEN"] = RGB;
-
- RGB.name_ = "BLUE";
- RGB.red_ = 0;
- RGB.green_ = 0;
- RGB.blue_ = 240;
- mapcor["BLUE"] = RGB;
-
- RGB.name_ = "YELLOW";
- RGB.red_ = 255;
- RGB.green_ = 255;
- RGB.blue_ = 100;
- mapcor["YELLOW"] = RGB;
-
- RGB.name_ = "CYAN";
- RGB.red_ = 100;
- RGB.green_ = 255;
- RGB.blue_ = 255;
- mapcor["CYAN"] = RGB;
-
- RGB.name_ = "MAGENTA";
- RGB.red_ = 255;
- RGB.green_ = 100;
- RGB.blue_ = 255;
- mapcor["MAGENTA"] = RGB;
-
- RGB.name_ = "ORANGE";
- RGB.red_ = 255;
- RGB.green_ = 140;
- RGB.blue_ = 0;
- mapcor["ORANGE"] = RGB;
-
- RGB.name_ = "GRAY";
- RGB.red_ = 240;
- RGB.green_ = 240;
- RGB.blue_ = 240;
- mapcor["GRAY"] = RGB;
-
- RGB.name_ = "BLACK";
- RGB.red_ = 0;
- RGB.green_ = 0;
- RGB.blue_ = 0;
- mapcor["BLACK"] = RGB;
-
- int ii, jj;
- int n = 200;
-
- TeColor cfrom = mapcor[ramps[0]];
- TeColor cto, cor;
-
- vector<TeColor> allColors;
- if (ramps.size() == 1)
- {
- cto.red_ = cfrom.red_ / 5;
- cto.green_ = cfrom.green_ / 5;
- cto.blue_ = cfrom.blue_ / 5;
- double dr = (double)(cto.red_ - cfrom.red_) / (double)n;
- double dg = (double)(cto.green_ - cfrom.green_) / (double)n;
- double db = (double)(cto.blue_ - cfrom.blue_) / (double)n;
-
- for(jj=0; jj<n; jj++)
- {
- cor.red_ = cfrom.red_ + (int)(dr * (double)jj);
- cor.green_ = cfrom.green_ + (int)(dg * (double)jj);
- cor.blue_ = cfrom.blue_ + (int)(db * (double)jj);
- allColors.push_back(cor);
- }
- }
- else
- {
- ii = 1;
- while(ii < (int)ramps.size())
- {
- cto = mapcor[ramps[ii]];
-
- double dr = (double)(cto.red_ - cfrom.red_) / (double)n;
- double dg = (double)(cto.green_ - cfrom.green_) / (double)n;
- double db = (double)(cto.blue_ - cfrom.blue_) / (double)n;
-
- for(jj=0; jj<n; jj++)
- {
- cor.red_ = cfrom.red_ + (int)(dr * (double)jj);
- cor.green_ = cfrom.green_ + (int)(dg * (double)jj);
- cor.blue_ = cfrom.blue_ + (int)(db * (double)jj);
- allColors.push_back(cor);
- }
- cfrom = cto;
- ii++;
- }
- }
- double step = 0.;
- if (nc > 1)
- step = (double)(allColors.size()) / (double)(nc-1);
- for (int i=0; i<nc; i++)
- {
- int ind = (int)(step * (double)i + .5);
- if (ind > (int)(allColors.size() - 1))
- ind = allColors.size() - 1;
- colors.push_back(allColors[ind]);
- }
- allColors.clear();
- return true;
-}
-
-
-void generateColorBarMap(vector<ColorBar>& inputColorVec, int ncores, map<int, vector<TeColor> >& colorMap)
-{
- if(inputColorVec.empty())
- {
- TeColor c(255, 0, 0);
- ColorBar b;
- b.color(c);
-// b.distance_ = 1.;
- b.distance_ = 0.;
- inputColorVec.push_back(b);
-
- c.init(60, 0, 0);
- b.color(c);
- b.distance_ = 1.;
- inputColorVec.push_back(b);
- }
-
- int i, nc;
- if(inputColorVec.empty())
- return;
-
- double totalDistance = inputColorVec[inputColorVec.size()-1].distance_;
- double dd = (double)ncores / totalDistance;
-
- colorMap.clear();
- for(i=0; i<(int)inputColorVec.size()-1; ++i)
- {
- nc = TeRound(dd * (fabs(inputColorVec[i+1].distance_) - fabs(inputColorVec[i].distance_)));
- TeColor corFrom, corTo;
- hsv2Rgb(corFrom,inputColorVec[i].h_, inputColorVec[i].s_, inputColorVec[i].v_);
- hsv2Rgb(corTo,inputColorVec[i+1].h_, inputColorVec[i+1].s_, inputColorVec[i+1].v_);
-// TeColor corFrom = inputColorVec[i].cor_;
-// TeColor corTo = inputColorVec[i+1].cor_;
- colorMap[i] = getColors(corFrom, corTo, nc);
- }
- vector<TeColor> vv;
- colorMap[i] = vv;
-}
-
-vector<TeColor> getColors(TeColor cfrom, TeColor cto, int nc)
-{
- int n = 255, i, j;
- vector<TeColor> colorVec;
- TeColor cor;
-
- vector<TeColor> allColors;
- double dr = (double)(cto.red_ - cfrom.red_) / (double)n;
- double dg = (double)(cto.green_ - cfrom.green_) / (double)n;
- double db = (double)(cto.blue_ - cfrom.blue_) / (double)n;
-
- for(j=0; j<n; j++)
- {
- cor.red_ = cfrom.red_ + (int)(dr * (double)j);
- cor.green_ = cfrom.green_ + (int)(dg * (double)j);
- cor.blue_ = cfrom.blue_ + (int)(db * (double)j);
- allColors.push_back(cor);
- }
- double step = 0.;
- if (nc > 1)
- step = (double)(allColors.size()) / (double)(nc-1);
- for (i=0; i<nc; ++i)
- {
- int ind = (int)(step * (double)i + .5);
- if (ind > (int)(allColors.size() - 1))
- ind = allColors.size() - 1;
- colorVec.push_back(allColors[ind]);
- }
- allColors.clear();
- return colorVec;
-}
-
-vector<ColorBar> getColorBarVector(string& groupingColors, const bool& first)
-{
- vector<ColorBar> cbVec;
- char buf[1000];
- string ss;
- TeColor cor(255, 255, 255);
-
- if(groupingColors.empty())
- groupingColors = "R-";
- if(groupingColors.size() == 1)
- groupingColors += "-";
-
- size_t t = groupingColors.find(";");
- string s = groupingColors.c_str();
-
- if(t == string::npos)
- {
- size_t a = s.find("-");
-
- double dist = -1.;
- while(a != string::npos)
- {
- memset(buf, '\0', 1000);
- s.copy(buf, a);
- ss = buf;
-
- a++;
- memset(buf, '\0', 1000);
- s.copy(buf, s.size()-a, a);
- s = buf;
- a = s.find("-");
-
- if("R" == ss)
- cor.init(240, 0, 0);
- else if("G" == ss)
- cor.init(0, 240, 0);
- else if("B" == ss)
- cor.init(0, 0, 240);
- else if("Cy" == ss)
- cor.init(100, 255, 255);
- else if("Or" == ss)
- cor.init(255, 140, 0);
- else if("Mg" == ss)
- cor.init(255, 100, 255);
- else if("Y" == ss)
- cor.init(255, 255, 100);
- else
- cor.init(240, 240, 240);
-
- ColorBar cb;
- cb.color(cor);
- dist += 1.;
- cb.distance_ = dist;
-
-// cbVec.push_back(cb);
-//
-// if(a == string::npos)
-// {
-// ss = s;
-// if("R" == ss)
-// cor.init(240, 0, 0);
-// else if("G" == ss)
-// cor.init(0, 240, 0);
-// else if("B" == ss)
-// cor.init(0, 0, 240);
-// else if("Cy" == ss)
-// cor.init(100, 255, 255);
-// else if("Or" == ss)
-// cor.init(255, 140, 0);
-// else if("Mg" == ss)
-// cor.init(255, 100, 255);
-// else if("Y" == ss)
-// cor.init(255, 255, 100);
-// else if("W" == ss)
-// cor.init(240, 240, 240);
-// else
-// cor.init(0, 0, 0);
-// }
-// else
-// cor.init(cor.red_/5, cor.green_/5, cor.blue_/5);
-//
-// cb.color(cor);
-// dist += 1.;
-// cb.distance_ = dist;
-//
- cbVec.push_back(cb);
- }
- if(cbVec.size() == 1)
- {
- cor.init(cor.red_/5, cor.green_/5, cor.blue_/5);
- ColorBar cb;
- cb.color(cor);
- dist += 1.;
- cb.distance_ = dist;
- cbVec.push_back(cb);
- }
- }
- else
- {
- t = groupingColors.find("|");
- if(first)
- {
- if(t != string::npos)
- {
- memset(buf, '\0', 1000);
- s.copy(buf, t, 0);
- s = buf;
- }
- }
- else
- {
- if(t != string::npos)
- {
- memset(buf, '\0', 1000);
- s.copy(buf, s.size()-t-1, t+1);
- s = buf;
- }
- else // error
- {
- ColorBar cb;
- cbVec.clear();
- TeColor c;
- hsv2Rgb(c, 0, 255, 255);
- cb.color(c);
- cb.distance_ = 0.;
- cbVec.push_back(cb);
- hsv2Rgb(c, 240, 255, 255);
- cb.color(c);
- cb.distance_ = 1.;
- cbVec.push_back(cb);
- return cbVec;
- }
- }
-
- size_t a = s.find("-");
-
- while(a != string::npos)
- {
- if(a == 0) // hue = -1
- a = s.find("-", 1);
- int cc = 0;
- memset(buf, '\0', 1000);
- s.copy(buf, a);
- ss = buf;
-
- a++;
- memset(buf, '\0', 1000);
- s.copy(buf, s.size()-a, a);
- s = buf;
- a = s.find("-");
- if(a == 0) // hue = -1
- a = s.find("-", 1);
-
- string sss;
- vector<double> vVec;
- size_t aa = ss.find(";");
- while(aa != string::npos)
- {
- cc++;
- memset(buf, '\0', 1000);
- ss.copy(buf, aa);
- sss = buf;
- double v = atof(sss.c_str());
- vVec.push_back(v);
-
- aa++;
- memset(buf, '\0', 1000);
- ss.copy(buf, ss.size()-aa, aa);
- ss = buf;
- aa = ss.find(";");
- }
- ColorBar cb;
- double brilho, dist = atof(ss.c_str());
- cb.distance_ = dist;
-
- if(vVec.empty()) // error in group color
- {
- cbVec.clear();
- TeColor c;
- hsv2Rgb(c, 0, 255, 255);
- cb.color(c);
- cb.distance_ = 0.;
- cbVec.push_back(cb);
- hsv2Rgb(c, 240, 255, 255);
- cb.color(c);
- cb.distance_ = 1.;
- cbVec.push_back(cb);
- return cbVec;
- }
-
- if(vVec.size() >= 4)
- {
- cor.init((int)vVec[0], (int)vVec[1], (int)vVec[2]);
- brilho = vVec[3];
- cb.color(cor);
- }
- else
- {
- int h = (int)vVec[0];
- int s = (int)vVec[1];
- int v = (int)vVec[2];
- TeColor c;
- hsv2Rgb(c, h, s, v);
- cb.color(c);
- }
-
- cbVec.push_back(cb);
-
- if(a == string::npos)
- {
- cc = 0;
- vVec.clear();
- ss = s;
- size_t aa = ss.find(";");
- while(aa != string::npos)
- {
- cc++;
- memset(buf, '\0', 1000);
- ss.copy(buf, aa);
- sss = buf;
- double v = atof(sss.c_str());
- vVec.push_back(v);
-
- aa++;
- memset(buf, '\0', 1000);
- ss.copy(buf, ss.size()-aa, aa);
- ss = buf;
- aa = ss.find(";");
- }
- ColorBar cb;
- double brilho, dist = atof(ss.c_str());
- cb.distance_ = dist;
-
- if(vVec.size() >= 4)
- {
- cor.init((int)vVec[0], (int)vVec[1], (int)vVec[2]);
- brilho = vVec[3];
- cb.color(cor);
- }
- else
- {
- int h = (int)vVec[0];
- int s = (int)vVec[1];
- int v = (int)vVec[2];
- TeColor c;
- hsv2Rgb(c, h, s, v);
- cb.color(c);
- }
-
- cbVec.push_back(cb);
- }
- }
- }
- return cbVec;
-}
-
-
-vector<TeColor> getColors(vector<ColorBar>& iVec, int ncores)
-{
- vector<TeColor> cVec;
- vector<TeColor> outVec;
- map<int, vector<TeColor> > colorMap;
-
- generateColorBarMap(iVec, ncores * 255, colorMap);
-
- map<int, vector<TeColor> > :: iterator it = colorMap.begin();
-
- while(it != colorMap.end())
- {
- vector<TeColor>& cores = it->second;
- vector<TeColor> :: iterator i = cores.begin();
-
- while(i != cores.end())
- {
- cVec.push_back(*i);
- i++;
- }
- it++;
- }
-
- int s = (int)cVec.size();
- double d, dd = (double)s /(double)(ncores-1);
- int i = 0, j;
-
- while(i < ncores)
- {
- d = dd * (double)i;
- j = TeRound(d);
- if(j >= s)
- j = s - 1;
- if((int)cVec.size() > j)
- outVec.push_back(cVec[j]);
- i++;
- }
- return outVec;
-}
-
-string getColors(vector<ColorBar>& aVec, vector<ColorBar>& bVec, int groupingMode)
-{
- string s, ss;
- vector<ColorBar> colorBarVec = aVec;
- vector<ColorBar> :: iterator it;
-
- int r, g, b;
- double d;
-// double br, d;
-
- it = colorBarVec.begin();
- while(it != colorBarVec.end())
- {
- ColorBar cb = (*it);
- TeColor cor;
- hsv2Rgb(cor, cb.h_, cb.s_, cb.v_);
- r = cor.red_;
- g = cor.green_;
- b = cor.blue_;
- d = cb.distance_;
-
- s += Te2String(cb.h_) + ";" + Te2String(cb.s_) + ";" + Te2String(cb.v_) + ";" + Te2String(d, 2);
- if(s.size() > 255)
- {
- s = ss;
- break;
- }
-
- ss = s;
- it++;
- if(it != colorBarVec.end())
- s += "-";
- }
-
- if(groupingMode == TeStdDeviation)
- {
- s += "|";
-
- colorBarVec = bVec;
- it = colorBarVec.begin();
- while(it != colorBarVec.end())
- {
- ColorBar cb = (*it);
- TeColor cor;
- hsv2Rgb(cor, cb.h_, cb.s_, cb.v_);
- r = cor.red_;
- g = cor.green_;
- b = cor.blue_;
- d = cb.distance_;
-
- s += Te2String(cb.h_) + ";" + Te2String(cb.s_) + ";" + Te2String(cb.v_) + ";" + Te2String(d, 2);
- if(s.size() > 255)
- {
- s = ss;
- break;
- }
-
- ss = s;
- it++;
- if(it != colorBarVec.end())
- s += "-";
- }
- }
-
- return s;
-}
-
-void rgb2Hsv(const TeColor& c, int& h, int& s, int& v)
-{
- double r = (double)(c.red_ / 255.);
- double g = (double)(c.green_ / 255.);
- double b = (double)(c.blue_ / 255.);
-
- double hh, ss, vv;
- RGBtoHSV(r, g, b, hh, ss, vv);
-
- h = TeRound(hh);
- s = TeRound(255. * ss);
- v = TeRound(255. * vv);
-}
-
-// r,g,b values are from 0 to 1
-// h = [0,360], s = [0,1], v = [0,1]
-// if s == 0, then h = -1 (undefined)
-
-void RGBtoHSV(const double& r, const double& g, const double& b, double& h, double& s, double& v )
-{
- if(r == g && g == b) // achromatic (grey)
- {
- h = - 1;
- s = 0;
- v = r;
- return;
- }
-
- double min, max, delta;
-
- min = MIN(r, g);
- min = MIN(min, b);
- max = MAX(r, g);
- max = MAX(max, b);
- v = max; // v
-
- delta = max - min;
-
- if( max != 0 )
- s = delta / max; // s
- else {
- // r = g = b = 0 // s = 0, v is undefined
- s = 0;
- h = -1;
- return;
- }
-
- if( r == max )
- h = ( g - b ) / delta; // between yellow & magenta
- else if( g == max )
- h = 2 + ( b - r ) / delta; // between cyan & yellow
- else
- h = 4 + ( r - g ) / delta; // between magenta & cyan
-
- h *= 60; // degrees
- if( h < 0 )
- h += 360;
-
-}
-
-void hsv2Rgb(TeColor& c, const int& h, const int& s, const int& v)
-{
- double r, g, b;
- double hh = (double)h;
- double ss = (double)s / 255.;
- double vv = (double)v / 255.;
-
- HSVtoRGB(r, g, b, hh, ss, vv);
-
- c.red_ = TeRound(r * 255.);
- c.green_ = TeRound(g * 255.);
- c.blue_ = TeRound(b * 255.);
-}
-
-void HSVtoRGB( double& r, double& g, double& b, const double& h, const double& s, const double& v )
-{
- int i;
- double f, p, q, t, hh = h;
-
- if( s == 0 || h == -1) {
- // achromatic (grey)
- r = g = b = v;
- return;
- }
-
- hh /= 60; // sector 0 to 5
- i = TeRound(floor(hh));
- f = hh - i; // factorial part of h
- p = v * ( 1 - s );
- q = v * ( 1 - s * f );
- t = v * ( 1 - s * ( 1 - f ) );
-
- switch( i ) {
- case 0:
- r = v;
- g = t;
- b = p;
- break;
- case 1:
- r = q;
- g = v;
- b = p;
- break;
- case 2:
- r = p;
- g = v;
- b = t;
- break;
- case 3:
- r = p;
- g = q;
- b = v;
- break;
- case 4:
- r = t;
- g = p;
- b = v;
- break;
- default: // case 5:
- r = v;
- g = p;
- b = q;
- break;
- }
-}
-
-
-unsigned int TeReadColorRampTextFile(const string& fileName, map<string,string>& colorRamps)
-{
- string name;
- string rgb;
- vector<string> aux;
- double r, g, b;
- double h, s, v;
- unsigned int ncolors = 0;
- unsigned int n;
- try
- {
- TeAsciiFile file(fileName);
- do
- {
- string ramp;
- try
- {
- name = file.readLine();
- ncolors = file.readInt();
- file.findNewLine();
- for (n=0; n<ncolors-1; ++n)
- {
- rgb = file.readLine();
- aux.clear();
- TeSplitString(rgb, ",", aux);
- TeTrim(aux[0]);
- TeTrim(aux[1]);
- TeTrim(aux[2]);
- r = atof(aux[0].c_str());
- g = atof(aux[1].c_str());
- b = atof(aux[2].c_str());
- RGBtoHSV(r, g, b, h, s, v);
-
- ramp += Te2String(int(h)) + ";";
- ramp += Te2String(int(s*255.)) + ";";
- ramp += Te2String(int(v)) + ";";
- ramp += Te2String(n) + "-";
- }
- rgb = file.readLine();
- aux.clear();
- TeSplitString(rgb, ",", aux);
- TeTrim(aux[0]);
- TeTrim(aux[1]);
- TeTrim(aux[2]);
- r = atof(aux[0].c_str());
- g = atof(aux[1].c_str());
- b = atof(aux[2].c_str());
- RGBtoHSV(r, g, b, h, s, v);
-
- ramp += Te2String(int(h)) + ";";
- ramp += Te2String(int(s*255.)) + ";";
- ramp += Te2String(int(v))+ ";";
- ramp += Te2String(n);
- ++ncolors;
- TeTrim(name);
- colorRamps[name]=ramp;
- }
- catch(...)
- {
- break;
- }
- }while(true);
- }
- catch(...)
- {
- return 0;
- }
- return colorRamps.size();
-}
diff --git a/src/terralib/utils/TeColorUtils.h b/src/terralib/utils/TeColorUtils.h
deleted file mode 100644
index 625c0f9..0000000
--- a/src/terralib/utils/TeColorUtils.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeColorUtils.h
- \brief This file contains functions to manipulate a structure representing a color
-*/
-#ifndef __TERRALIB_INTERNAL_COLORUTILS_H
-#define __TERRALIB_INTERNAL_COLORUTILS_H
-
-
-#include "TeVisual.h"
-#include "TeUtils.h"
-
-void rgb2Hsv(const TeColor& c, int& h, int& s, int& v);
-void RGBtoHSV(const double& r, const double& g, const double& b, double& h, double& s, double& v );
-void hsv2Rgb(TeColor& c, const int& h, const int& s, const int& v);
-void HSVtoRGB( double& r, double& g, double& b, const double& h, const double& s, const double& v );
-
-struct ColorBar {
- TeColor cor_;
- int h_;
- int s_;
- int v_;
- double distance_;
-
- void color(const TeColor& c){cor_ = c; rgb2Hsv(cor_, h_, s_, v_);}
-
- ColorBar& operator= (const ColorBar& cb)
- {
- cor_ = cb.cor_;
- h_ = cb.h_;
- s_ = cb.s_;
- v_ = cb.v_;
- distance_ = cb.distance_;
-
- return *this;
- }
-
- bool operator<= (const ColorBar& cb) const
- {
- return (distance_ <= cb.distance_);
- }
-
- bool operator< (const ColorBar& cb) const
- {
- return (distance_ < cb.distance_);
- }
-};
-
-#include <vector>
-#include <string>
-#include <map>
-
-//! Generates a graduated color scale following a sequence of basic colors
-/*!
- The possible basic colors are "RED", "GREEN", "BLUE", "YELLOW", "CYAN", "MAGENTA", "GRAY" and "BLACK"
- \param ramps vector with the sequence color ramps used to build the scale
- \param nc desired number of colors on the scale
- \param colors resulting color scale
- \returns true if color scale was successfully generated and false otherwise
-*/
-bool getColors(std::vector<std::string>& ramps, int nc, std::vector<TeColor>& colors);
-vector<TeColor> getColors(TeColor cfrom, TeColor cto, int nc);
-vector<TeColor> getColors(vector<ColorBar>& iVec, int ncores);
-string getColors(vector<ColorBar>& aVec, vector<ColorBar>& bVec, int groupingMode);
-void generateColorBarMap(vector<ColorBar>& inputColorVec, int ncores, map<int, vector<TeColor> >& colorMap);
-vector<ColorBar> getColorBarVector(string& scores, const bool& first);
-unsigned int TeReadColorRampTextFile(const string& fileName, map<string,string>& colorRamps);
-
-#endif
-
-
-
diff --git a/src/terralib/utils/TeDatabaseUtils.cpp b/src/terralib/utils/TeDatabaseUtils.cpp
deleted file mode 100644
index 4a3e643..0000000
--- a/src/terralib/utils/TeDatabaseUtils.cpp
+++ /dev/null
@@ -1,582 +0,0 @@
-/************************************************************************************
-TerraView - visualization and exploration of geographical databases using TerraLib.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-This file is part of TerraView. TerraView is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-You should have received a copy of the GNU General Public License
-along with TerraView.
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The software provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use of
-this program and its documentation.
-*************************************************************************************/
-
-#include <TeDatabaseUtils.h>
-#include <TeLayerFunctions.h>
-
-
-bool isTerralibModel(TeDatabase* db)
-{
- vector<string>::iterator it;
- vector<string> tables;
- db->listTables(tables);
-
- for(unsigned int i = 0; i<tables.size(); i++)
- {
- if((it = find(tables.begin(), tables.end(), "te_projection")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_layer")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_layer_table")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_tables_relation")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_representation")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_view")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_theme")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_grouping")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_theme_table")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_legend")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_visual")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_visual_raster")) == tables.end())
- return false;
- if((it = find(tables.begin(), tables.end(), "te_database")) == tables.end())
- return false;
- }
- if(tables.size() == 0)
- return false;
-
- return true;
-}
-
-
-bool TeCopyDatabase(TeDatabase* dbFrom, TeDatabase* dbTo)
-{
- // -- Step 1 : copies the external tables
- TeAttrTableVector externs;
- dbFrom->getAttrTables(externs,TeAttrExternal);
- if (!externs.empty())
- {
- TeDatabasePortal* portal = dbFrom->getPortal();
- if (!portal)
- {
- // log error here
- return false;
- }
-
- for (unsigned int nt=0; nt < externs.size(); nt++)
- {
- TeTable table = externs[nt];
- table.setId(-1);
- string sql = "select * from " + table.name();
- if (!portal->query(sql) || portal->numRows() == 0)
- {
- portal->freeResult();
- continue;
- }
- if (!dbTo->createTable(table.name(),table.attributeList()))
- {
- portal->freeResult();
- continue;
- }
- unsigned int nr=0;
- while (portal->fetchRow())
- {
- TeTableRow row;
- for(int i = 0; i < portal->numFields(); i++)
- row.push_back(portal->getData(i));
- table.add(row);
- nr++;
- if (nr % 200)
- {
- dbTo->insertTable(table);
- table.clear();
- nr = 0;
- }
- }
- if (table.size() >0)
- dbTo->insertTable(table);
- table.clear();
- dbTo->insertTableInfo(-1,table);
- portal->freeResult();
- }
- delete portal;
- }
-
- // -- Step 2: Copies the layers
- if(!dbFrom->loadLayerSet())
- {
- // log error here
- return false;
- }
-
- TeLayerMap& fromLayerMap = dbFrom->layerMap();
- TeLayerMap::iterator itFrom = fromLayerMap.begin();
-
- while(itFrom != fromLayerMap.end())
- {
- TeLayer* fromLayer = (*itFrom).second;
- TeLayer* toLayer = new TeLayer(fromLayer->name(), dbTo, fromLayer->projection());
- map<string, string> tables;
- if (!TeCopyLayerToLayer(fromLayer, toLayer, &tables))
- {
- // log error here: layer couldn�t be copied
- }
- ++itFrom;
- }
- // -- Set 3: Copies the views and themes
- if(!dbFrom->loadViewSet(dbFrom->user()))
- {
- // log error here
- return false;
- }
-
- if(!dbTo->loadLayerSet())
- {
- // log error here
- return false;
- }
-
- TeViewMap& fromViewMap = dbFrom->viewMap();
- TeViewMap::iterator itvFrom = fromViewMap.begin();
- while (itvFrom != fromViewMap.end())
- {
- TeView* fromView = (*itvFrom).second;
- TeView* toView = new TeView();
-
- TeProjection* toViewProjection = 0;
- if (fromView->projection())
- toViewProjection = TeProjectionFactory::make(fromView->projection()->params());
-
- toView->projection(toViewProjection);
- toView->name(fromView->name());
- toView->user(dbTo->user());
- toView->isVisible(fromView->isVisible());
-
- TeBox b;
- toView->setCurrentBox(b);
- toView->setCurrentTheme(-1);
-
- if (!dbTo->insertView(toView))
- {
- // log error here
- ++itvFrom;
- continue;
- }
- dbTo->insertView(toView);
- if(dbTo->projectMap().empty() == false)
- {
- TeProjectMap& pm = dbTo->projectMap();
- TeProject* project = pm.begin()->second;
- project->addView(toView->id());
- }
- dbTo->insertProjectViewRel(1, toView->id());
-
- TeLayerMap& toLayerMap = dbTo->layerMap();
- vector<TeViewNode*>& themeVec = fromView->themes();
- for (unsigned int i = 0; i < themeVec.size(); ++i)
- {
- TeTheme* themeFrom = (TeTheme*) themeVec[i];
- string fromLayerName = themeFrom->layer()->name();
- TeLayer* toLayer = 0;
- TeLayerMap::iterator itTo = toLayerMap.begin();
- while(itTo != toLayerMap.end())
- {
- if(itTo->second->name() == fromLayerName)
- {
- toLayer = itTo->second;
- break;
- }
- ++itTo;
- }
-
- if (!toLayer )
- {
- // log error here
- continue;
- }
-
- TeTheme* themeTo = new TeTheme(themeFrom->name(), toLayer);
- toView->add(themeTo);
-
- themeTo->outOfCollectionLegend(themeFrom->outOfCollectionLegend());
- themeTo->withoutDataConnectionLegend(themeFrom->withoutDataConnectionLegend ());
- themeTo->defaultLegend(themeFrom->defaultLegend());
- themeTo->pointingLegend(themeFrom->pointingLegend());
- themeTo->queryLegend(themeFrom->queryLegend());
-
- TeAttrTableVector tftablevec = themeFrom->attrTables();
- TeAttrTableVector tttablevec;
-
- for (unsigned int nt=0; nt<tftablevec.size(); nt++)
- {
- TeTable attTable(tftablevec[nt].name());
- dbTo->loadTableInfo(attTable);
- tttablevec.push_back(attTable);
- }
- themeTo->setAttTables(tttablevec);
- themeTo->attributeRest(themeFrom->attributeRest());
- themeTo->temporalRest(themeFrom->temporalRest());
- themeTo->spatialRest(themeFrom->spatialRest());
- themeTo->visibleRep(themeFrom->visibleRep());
- if(!themeTo->save() || !themeTo->buildCollection())
- {
- // log error here
- continue;
- }
- themeTo->generateLabelPositions();
-
- if(themeFrom->grouping().groupMode_ != TeNoGrouping)
- {
- TeGrouping grouping;
- grouping = themeFrom->grouping();
- themeTo->buildGrouping(grouping);
- TeLegendEntryVector& legends = themeFrom->legend();
- for (unsigned int nl=0; nl<legends.size(); nl++)
- themeTo->setGroupingVisual(nl+1,legends[nl].getVisualMap());
- if (!themeTo->saveGrouping())
- {
- // log error here
- }
- }
- } // end for each theme
- ++itvFrom;
- } // end for each view
- return true;
-}
-
-vector<string> getObjects(TeTheme* theme, int sel)
-{
- vector<string> svec;
- if(!theme)
- return svec;
-
- TeDatabase* db = 0;
- if(theme->getProductId() == TeEXTERNALTHEME)
- db = static_cast<TeExternalTheme*>(theme)->getSourceDatabase();
- else if(theme->getProductId() == TeTHEME)
- db = static_cast<TeTheme*>(theme)->layer()->database();
-
- if(db == 0)
- return svec;
-
- string C = theme->collectionTable();
- string CA = theme->collectionAuxTable();
- string input;
-
- if(sel == TeSelectedByPointing)
- input += " WHERE " + C + ".c_object_status = 1 OR " + C + ".c_object_status = 3";
- else if(sel == TeNotSelectedByPointing)
- input += " WHERE " + C + ".c_object_status = 0 OR " + C + ".c_object_status = 2";
- else if(sel == TeSelectedByQuery)
- input += " WHERE " + C + ".c_object_status = 2 OR " + C + ".c_object_status = 3";
- else if(sel == TeNotSelectedByQuery)
- input += " WHERE " + C + ".c_object_status = 0 OR " + C + ".c_object_status = 1";
- else if(sel == TeSelectedByPointingAndQuery)
- input += " WHERE " + C + ".c_object_status = 3";
- else if(sel == TeSelectedByPointingOrQuery)
- input += " WHERE " + C + ".c_object_status <> 0";
- else if(sel == TeGrouped)
- input += " WHERE " + C + ".c_legend_id <> 0";
- else if(sel == TeNotGrouped)
- input += " WHERE " + C + ".c_legend_id = 0";
-
- string query = "SELECT " + C + ".c_object_id FROM " + C + " LEFT JOIN " + CA;
- query += " ON " + C + ".c_object_id = " + CA + ".object_id" + input;
-
- TeDatabasePortal* portal = db->getPortal();
- if (portal->query(query) == false)
- {
- delete portal;
- return svec;
- }
- while (portal->fetchRow())
- svec.push_back(portal->getData(0));
-
- delete portal;
- return svec;
-}
-
-vector<string> getItems(TeTheme* theme, int sel)
-{
- vector<string> svec;
- if(!theme)
- return svec;
-
- TeDatabase* db = 0;
- if(theme->getProductId() == TeEXTERNALTHEME)
- db = static_cast<TeExternalTheme*>(theme)->getSourceDatabase();
- else if(theme->getProductId() == TeTHEME)
- db = static_cast<TeTheme*>(theme)->layer()->database();
-
- if(db == 0)
- return svec;
-
- string C = theme->collectionTable();
- string CA = theme->collectionAuxTable();
- string input;
-
- if(sel == TeSelectedByPointing)
- input += " WHERE " + CA + ".grid_status = 1 OR " + CA + ".grid_status = 3";
- else if(sel == TeNotSelectedByPointing)
- input += " WHERE " + CA + ".grid_status = 0 OR " + CA + ".grid_status = 2";
- else if(sel == TeSelectedByQuery)
- input += " WHERE " + CA + ".grid_status = 2 OR " + CA + ".grid_status = 3";
- else if(sel == TeNotSelectedByQuery)
- input += " WHERE " + CA + ".grid_status = 0 OR " + CA + ".grid_status = 1";
- else if(sel == TeSelectedByPointingAndQuery)
- input += " WHERE " + CA + ".grid_status = 3";
- else if(sel == TeSelectedByPointingOrQuery)
- input += " WHERE " + CA + ".grid_status <> 0";
- else if(sel == TeGrouped)
- input += " WHERE " + C + ".c_legend_id <> 0";
- else if(sel == TeNotGrouped)
- input += " WHERE " + C + ".c_legend_id = 0";
-
- string query = "SELECT " + CA + ".unique_id FROM " + C + " LEFT JOIN " + CA;
- query += " ON " + C + ".c_object_id = " + CA + ".object_id" + input;
-
- TeDatabasePortal* portal = db->getPortal();
- if (portal->query(query) == false)
- {
- delete portal;
- return svec;
- }
- while (portal->fetchRow())
- svec.push_back(portal->getData(0));
-
- delete portal;
- return svec;
-}
-
-vector<string> getObjects(TeTheme* theme, vector<string>& itens)
-{
- vector<string> svec;
- if(!theme)
- return svec;
-
- TeDatabase* db = 0;
- if(theme->getProductId() == TeEXTERNALTHEME)
- db = static_cast<TeExternalTheme*>(theme)->getSourceDatabase();
- else if(theme->getProductId() == TeTHEME)
- db = static_cast<TeTheme*>(theme)->layer()->database();
-
- if(db == 0)
- return svec;
-
- TeDatabasePortal* portal = db->getPortal();
- string C = theme->collectionTable();
- string CA = theme->collectionAuxTable();
-
- string query = "SELECT " + C + ".c_object_id FROM " + C + " LEFT JOIN " + CA;
- query += " ON " + C + ".c_object_id = " + CA + ".object_id";
- query += " WHERE " + CA + ".unique_id IN ";
-
- set<string> idSet;
-
- vector< string >::iterator it_begin = itens.begin();
- vector< string >::iterator it_end = itens.end();
-
- vector<string> inVec = generateInClauses(it_begin, it_end, db, false);
- vector<string>::iterator it;
- for(it=inVec.begin(); it!=inVec.end(); ++it)
- {
- if((*it).empty() == false)
- {
- string sel = query + *it;
- if (portal->query(sel) == false)
- {
- delete portal;
- return svec;
- }
- while (portal->fetchRow())
- idSet.insert(portal->getData(0));
- portal->freeResult();
- }
- }
- delete portal;
-
- set<string>::iterator sit;
- for(sit=idSet.begin(); sit!=idSet.end(); ++sit)
- svec.push_back(*sit);
- return svec;
-}
-
-vector<string> getItems(TeTheme* theme, vector<string>& objects)
-{
- vector<string> svec;
- if(!theme)
- return svec;
-
- TeDatabase* db = 0;
- if(theme->getProductId() == TeEXTERNALTHEME)
- db = static_cast<TeExternalTheme*>(theme)->getSourceDatabase();
- else if(theme->getProductId() == TeTHEME)
- db = static_cast<TeTheme*>(theme)->layer()->database();
-
- if(db == 0)
- return svec;
-
- TeDatabasePortal* portal = db->getPortal();
- string C = theme->collectionTable();
- string CA = theme->collectionAuxTable();
-
- string query = "SELECT " + CA + ".unique_id FROM " + C + " LEFT JOIN " + CA;
- query += " ON " + C + ".c_object_id = " + CA + ".object_id";
- query += " WHERE " + C + ".c_object_id IN ";
-
- vector< string >::iterator it_begin = objects.begin();
- vector< string >::iterator it_end = objects.end();
-
- vector<string> inVec = generateInClauses(it_begin, it_end, db);
- vector<string>::iterator it;
- for(it=inVec.begin(); it!=inVec.end(); ++it)
- {
- if((*it).empty() == false)
- {
- string sel = query + *it;
- if (portal->query(sel) == false)
- {
- delete portal;
- return svec;
- }
- while (portal->fetchRow())
- svec.push_back(portal->getData(0));
- portal->freeResult();
- }
- }
- delete portal;
- return svec;
-}
-
-map<string, vector<string> > getObject2ItemsMap(TeTheme* theme, vector<string>& itens)
-{
- map<string, vector<string> > outMap;
- if(!theme)
- return outMap;
-
- TeDatabase* db = 0;
- if(theme->getProductId() == TeEXTERNALTHEME)
- db = static_cast<TeExternalTheme*>(theme)->getSourceDatabase();
- else if(theme->getProductId() == TeTHEME)
- db = static_cast<TeTheme*>(theme)->layer()->database();
-
- if(db == 0)
- return outMap;
-
- TeDatabasePortal* portal = db->getPortal();
- string C = theme->collectionTable();
- string CA = theme->collectionAuxTable();
-
- string query = "SELECT " + C + ".c_object_id, " + CA + ".unique_id FROM " + C + " LEFT JOIN " + CA;
- query += " ON " + C + ".c_object_id = " + CA + ".object_id";
- query += " WHERE " + CA + ".unique_id IN ";
-
- vector< string >::iterator it_begin = itens.begin();
- vector< string >::iterator it_end = itens.end();
-
- vector<string> inVec = generateInClauses(it_begin, it_end, db, false);
- vector<string>::iterator it;
- for(it=inVec.begin(); it!=inVec.end(); ++it)
- {
- if((*it).empty() == false)
- {
- string sel = query + *it;
- if (portal->query(sel) == false)
- {
- delete portal;
- return outMap;
- }
- while (portal->fetchRow())
- outMap[portal->getData(0)].push_back(portal->getData(1));
- portal->freeResult();
- }
- }
- delete portal;
-
- return outMap;
-}
-
-vector<string>
-generateItemsInClauseVec(TeTheme* theme, string& where)
-{
- vector<string> inClauseVector;
- TeDatabase* db = 0;
- string CT = theme->collectionTable();
- string CA = theme->collectionAuxTable();
- string from = " FROM " + CT + " LEFT JOIN " + CA + " ON " + CT + ".c_object_id = " + CA + ".object_id";
-
- if(theme->getProductId()==TeTHEME)
- db = theme->layer()->database();
- else if(theme->getProductId()==TeEXTERNALTHEME)
- db = ((TeExternalTheme*) theme)->getSourceDatabase();
-
- if(db == 0)
- return inClauseVector;
-
- TeDatabasePortal* portal = db->getPortal();
- string sel = "SELECT " + CT + ".c_object_id, " + CA + ".unique_id " + from;
-
- if(where.empty() == false)
- sel += " " + where;
-
- map<string, vector<string> > objMap;
- if(portal->query(sel))
- {
- while(portal->fetchRow())
- objMap[portal->getData(0)].push_back(portal->getData(1));
- }
-
- map<string, vector<string> >::iterator mit;
- vector<string>::iterator it;
-
- int i, chunkSize = 200;
- string inClause;
-
- i = 0;
- bool chunk = true;
- for(mit=objMap.begin(); mit!=objMap.end(); ++mit)
- {
- if (chunk == true)
- {
- chunk = false;
- if (!inClause.empty())
- {
- inClause[inClause.size() - 1] = ')';
- inClauseVector.push_back(inClause);
- inClause.clear();
- }
- inClause = "(";
- }
- for(it=mit->second.begin(); it!=mit->second.end(); ++it)
- {
- inClause += *it + ",";
- i++;
- if (i%chunkSize == 0)
- chunk = true;
- }
- }
- if (!inClause.empty())
- {
- inClause[inClause.size() - 1] = ')';
- inClauseVector.push_back(inClause);
- }
- return inClauseVector;
-}
-
-
-
diff --git a/src/terralib/utils/TeDatabaseUtils.h b/src/terralib/utils/TeDatabaseUtils.h
deleted file mode 100644
index be24446..0000000
--- a/src/terralib/utils/TeDatabaseUtils.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeDatabaseUtils.h
- \brief This file contains some utilitary functions to extended the TerraLib data model for TerraView like applications.
-*/
-#ifndef __TERRALIB_INTERNAL_DATABASEUTILS_H
-#define __TERRALIB_INTERNAL_DATABASEUTILS_H
-
-
-#include <TeDatabase.h>
-#include <TeExternalTheme.h>
-#include <string>
-#include <vector>
-using std::string;
-using std::vector;
-
-
-/** @defgroup DBUtils Utilitary functions
- @ingroup DatabaseUtils
- A set of utilitary functions
- * @{
- */
-/** This function copies the contents of a TerraLib database to another TerraLib database
- \param dbFrom A pointer to the source database
- \param dbTo A pointer to the destination database
-*/
-bool TeCopyDatabase(TeDatabase* dbFrom, TeDatabase* dbTo);
-
-
-/** Returns true whether a database contains the TerraLib data model
- \param db pointer do a TerraLib database
-*/
-bool isTerralibModel(TeDatabase* db);
-
-vector<string> generateItemsInClauseVec(TeTheme* theme, string& where);
-
-vector<string> getObjects(TeTheme* theme, int sel);
-
-vector<string> getItems(TeTheme* theme, int sel);
-
-vector<string> getObjects(TeTheme* theme, vector<string>& itens);
-
-map<string, vector<string> > getObject2ItemsMap(TeTheme* theme, vector<string>& itens);
-
-vector<string> getItems(TeTheme* theme, vector<string>& objcts);
-
-//! Breaks a collection of strings into a series of IN clauses to be used in query expressions
-/*
- \params begin Iterator that p oints to the beginning of the collection
- \params end Iterator that points to the end of the collection
- \param db pointer to the database where the query expression will be applied
- \param addPlicae flat to indicate that the character ' should enclose each string
-*/
-template <typename Iterator>
-vector<string>
-generateInClauses(Iterator& begin, Iterator& end, TeDatabase* db, bool addPlicae=true)
-{
- int i, chunkSize = 200;
- string inClause;
- vector<string> inClauseVector;
-
- Iterator temp = begin;
- i = 0;
- while (temp != end)
- {
- if (i%chunkSize == 0)
- {
- if (!inClause.empty())
- {
- inClause[inClause.size() - 1] = ')';
- inClauseVector.push_back(inClause);
- inClause.clear();
- }
- inClause = "(";
- }
-
- if (addPlicae)
- inClause += "'" + db->escapeSequence(*temp) + "',";
- else
- inClause += db->escapeSequence(*temp) + ",";
- i++;
- ++temp;
- }
- if (!inClause.empty())
- {
- inClause[inClause.size() - 1] = ')';
- inClauseVector.push_back(inClause);
- }
- return inClauseVector;
-}
-
-template <typename Iterator>
-vector<string>
-generateItemsInClauses(Iterator& begin, Iterator& end, TeTheme* theme)
-{
- vector<string> itenVec;
- Iterator temp = begin;
- while (temp != end)
- {
- itenVec.push_back(*temp);
- temp++;
- }
-
- map<string, vector<string> > objMap = getObject2ItemsMap(theme, itenVec);
- map<string, vector<string> >::iterator mit;
- vector<string>::iterator it;
-
- int i, chunkSize = 200;
- string inClause;
- vector<string> inClauseVector;
-
- i = 0;
- bool chunk = true;
- for(mit=objMap.begin(); mit!=objMap.end(); ++mit)
- {
- if (chunk == true)
- {
- chunk = false;
- if (!inClause.empty())
- {
- inClause[inClause.size() - 1] = ')';
- inClauseVector.push_back(inClause);
- inClause.clear();
- }
- inClause = "(";
- }
- for(it=mit->second.begin(); it!=mit->second.end(); ++it)
- {
- inClause += *it + ",";
- i++;
- if (i%chunkSize == 0)
- chunk = true;
- }
- }
- if (!inClause.empty())
- {
- inClause[inClause.size() - 1] = ')';
- inClauseVector.push_back(inClause);
- }
- return inClauseVector;
-}
-
-
-//@}
-
-#endif
-
diff --git a/src/terralib/utils/TeUpdateDBVersion.cpp b/src/terralib/utils/TeUpdateDBVersion.cpp
deleted file mode 100644
index 036709c..0000000
--- a/src/terralib/utils/TeUpdateDBVersion.cpp
+++ /dev/null
@@ -1,1504 +0,0 @@
-/************************************************************************************
-TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-
-#include "TeUpdateDBVersion.h"
-
-bool needUpdateDB(TeDatabase* db, string& DBversion)
-{
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- string sql = " SELECT db_version FROM te_database ";
- //The database does not have the te_database connection
- if(!portal->query(sql))
- {
- DBversion = "";
- delete portal;
- return false;
- }
-
- if(!portal->fetchRow())
- {
- DBversion = "";
- delete portal;
- return true;
- }
-
- DBversion = portal->getData(0);
- if(DBversion==TeDBVERSION)
- {
- delete portal;
- return false;
- }
-
- delete portal;
- return true;
-}
-
-
-bool updateDBVersion(TeDatabase* db, string& DBversion, string& errorMessage)
-{
- //from old version to 3.0
- db->beginTransaction();
- if(DBversion=="")
- {
- if(!updateDB30To301(db, errorMessage))
- {
- db->rollbackTransaction();
- return false;
- }
-
- if(!updateDB20To30(db, errorMessage))
- {
- db->rollbackTransaction();
- return false;
- }
-
- DBversion = "3.0.1";
- }
-
- //from 3.0 to 3.0.1
- if(DBversion=="3.0")
- {
- if(!updateDB30To301(db, errorMessage))
- {
- db->rollbackTransaction();
- return false;
- }
-
- DBversion = "3.0.1";
- }
-
- //from 3.0.1 to 3.0.2
- if(DBversion=="3.0.1")
- {
- if(!updateDB301To302(db, errorMessage))
- {
- db->rollbackTransaction();
- return false;
- }
-
- DBversion = "3.0.2";
- }
-
- //from 3.0.2 to 3.1.0
- if(DBversion=="3.0.2")
- {
- if(!updateDB302To310(db, errorMessage))
- {
- db->rollbackTransaction();
- return false;
- }
-
- DBversion = "3.1.0";
- }
-
- if(DBversion=="3.1.0")
- {
- if(!updateDB310To311(db, errorMessage))
- {
- db->rollbackTransaction();
- return false;
- }
-
- DBversion = "3.1.1";
- }
-
- if(DBversion=="3.1.1")
- {
- if(!updateDB311To320(db, errorMessage))
- {
- db->rollbackTransaction();
- return false;
- }
- DBversion = "3.2.0";
- }
-
- if(DBversion=="3.2.0")
- {
- if(!updateDB320To3201(db, errorMessage))
- {
- db->rollbackTransaction();
- return false;
- }
- DBversion = "3.2.0.1";
- }
-
- if(DBversion!=TeDBVERSION)
- {
- db->rollbackTransaction();
- return false;
- }
-
- string del= "DELETE FROM te_database";
- if(!db->execute(del))
- {
- db->rollbackTransaction();
- return false;
- }
-
- string ins = "INSERT INTO te_database (db_version) VALUES ('"+ TeDBVERSION +"')";
- if(!db->execute(ins))
- {
- db->rollbackTransaction();
- return false;
- }
-
- db->commitTransaction();
- return true;
-}
-
-
-bool updateDB20To30(TeDatabase* db, string& errorMessage)
-{
- TeAttribute fattr;
-
- // ----- te_grouping
-
- if(db->columnExist("te_grouping", "grouping_function", fattr) == false)
- {
- TeAttributeRep atRep;
- atRep.type_ = TeSTRING;
- atRep.name_ = "grouping_function";
- atRep.numChar_ = 10;
- if(db->addColumn("te_grouping", atRep) == false)
- {
- errorMessage = "The column grouping_function could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
-
- string upd;
- if(db->columnExist("te_theme_application", "group_function", fattr))
- {
- upd = " UPDATE te_grouping g, te_theme_application ta ";
- upd += " SET g.grouping_function = ta.group_function ";
- upd += " WHERE ta.theme_id = g.theme_id ";
-
- if(!db->execute (upd))
- {
- errorMessage = db->errorMessage();
- return false;
- }
-
- db->deleteColumn("te_theme_application", "group_function");
- }
- else
- {
- upd = " UPDATE te_grouping g ";
- upd += " SET g.grouping_function = 'AVG' ";
-
- if(!db->execute (upd))
- {
- errorMessage = db->errorMessage();
- return false;
- }
- }
- }
-
- // ----- te_theme_application
-
- if(db->columnExist("te_theme_application", "chart_function", fattr) == false)
- {
- TeAttributeRep atRep;
- atRep.type_ = TeSTRING;
- atRep.name_ = "chart_function";
- atRep.numChar_ = 10;
- if(db->addColumn("te_theme_application", atRep) == false)
- {
- errorMessage = "The column chart_function could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- db->execute("UPDATE te_theme_application SET chart_function = 'AVG'");
- }
-
- // ----- te_theme
- if(db->columnExist("te_theme", "visible_rep", fattr) == false)
- {
- TeAttributeRep atRep;
- atRep.type_ = TeINT;
- atRep.name_ = "visible_rep";
- if(db->addColumn("te_theme", atRep) == false)
- {
- errorMessage = "The column visible_rep could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
-
- atRep.name_ = "enable_visibility";
- if(db->addColumn("te_theme", atRep) == false)
- {
- errorMessage = "The column enable_visibility could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
-
- string upd = " UPDATE te_theme t, te_theme_application ta ";
- upd += " SET t.visible_rep = ta.visible_rep ";
- upd += " WHERE ta.theme_id = t.theme_id ";
- if(!db->execute (upd))
- {
- errorMessage = db->errorMessage();
- return false;
- }
-
- upd = " UPDATE te_theme t, te_theme_application ta ";
- upd += " SET t.enable_visibility = ta.enable_visibility ";
- upd += " WHERE ta.theme_id = t.theme_id ";
- if(!db->execute (upd))
- {
- errorMessage = db->errorMessage();
- return false;
- }
-
- db->deleteColumn("te_theme_application", "visible_rep");
- db->deleteColumn("te_theme_application", "enable_visibility");
- }
-
- //if for ADO passar todas as tabelas para aceitar comprimento iguel a zero!!!
- if(db->dbmsName() == "Ado")
- {
- //te_layer
- //te_layer_table
- db->allowEmptyString ("te_layer_table", "attr_initial_time");
- db->allowEmptyString ("te_layer_table", "attr_final_time");
- db->allowEmptyString ("te_layer_table", "user_name");
-
- //te_representation
- db->allowEmptyString ("te_representation", "description");
-
- //te_view
- db->allowEmptyString ("te_view", "user_name");
-
- //te_visual
- db->allowEmptyString ("te_visual", "lib_name");
- db->allowEmptyString ("te_visual", "contour_lib_name");
- db->allowEmptyString ("te_visual", "family");
-
- //te_legend
- db->allowEmptyString ("te_legend", "lower_value");
- db->allowEmptyString ("te_legend", "upper_value");
- db->allowEmptyString ("te_legend", "label");
-
- //te_theme
- db->allowEmptyString ("te_theme", "generate_attribute_where");
- db->allowEmptyString ("te_theme", "generate_spatial_where");
- db->allowEmptyString ("te_theme", "generate_temporal_where");
- db->allowEmptyString ("te_theme", "collection_table");
-
- //te_grouping
- db->allowEmptyString ("te_grouping", "grouping_attr");
- db->allowEmptyString ("te_grouping", "grouping_norm_attr");
- db->allowEmptyString ("te_grouping", "grouping_function");
-
- //te_theme_application
- db->allowEmptyString ("te_theme_application", "refine_attribute_where");
- db->allowEmptyString ("te_theme_application", "refine_spatial_where");
- db->allowEmptyString ("te_theme_application", "refine_temporal_where");
- db->allowEmptyString ("te_theme_application", "grouping_color");
- db->allowEmptyString ("te_theme_application", "pie_dimension_attr");
- db->allowEmptyString ("te_theme_application", "text_table");
- db->allowEmptyString ("te_theme_application", "chart_function");
- }
-
- //------------ auxiliary collection
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- string sql = " SELECT theme_id, visible_rep FROM te_theme ";
- if(!portal->query(sql))
- {
- delete portal;
- return true;
- }
-
- while(portal->fetchRow ())
- {
- string themeId = portal->getData(0);
- int visRep = atoi(portal->getData(1));
-
- string collExtTable = "te_collection_"+ themeId +"_aux";
-
- if ((db->tableExist("te_collection_"+ themeId)) &&
- ((visRep & TeRASTER) != TeRASTER) &&
- (!db->tableExist(collExtTable)))
- {
- TeTheme* theme = new TeTheme();
- theme->id(atoi(themeId.c_str()));
- if(!db->loadTheme (theme))
- {
- delete portal;
- return false;
- }
-
- string up = "UPDATE " + theme->collectionTable() + " SET c_object_status = 0";
- up += " WHERE c_object_status <> " + Te2String(theme->pointingLegend().id());
- up += " AND c_object_status <> " + Te2String(theme->queryLegend().id());
- up += " AND c_object_status <> " + Te2String(theme->queryAndPointingLegend().id());
- db->execute(up);
-
- up = "UPDATE " + theme->collectionTable() + " SET c_object_status = 1";
- up += " WHERE c_object_status = " + Te2String(theme->pointingLegend().id());
- db->execute(up);
-
- up = "UPDATE " + theme->collectionTable() + " SET c_object_status = 2";
- up += " WHERE c_object_status = " + Te2String(theme->queryLegend().id());
- db->execute(up);
-
- up = "UPDATE " + theme->collectionTable() + " SET c_object_status = 3";
- up += " WHERE c_object_status = " + Te2String(theme->queryAndPointingLegend().id());
- db->execute(up);
-
- if ((!theme->createCollectionAuxTable()) || (!theme->populateCollectionAux()))
- {
- errorMessage = "Fail to mount the auxiliary table of the collection!\n";
- errorMessage += db->errorMessage();
- delete portal;
- return false;
- }
-
- theme->collectionAuxTable(collExtTable);
- theme->addThemeTable(collExtTable);
-
- string oldTCE = theme->collectionTable() + "_ext";
- if (db->tableExist(oldTCE))
- {
- string delTable = "DROP TABLE " + oldTCE;
- db->execute(delTable);
- }
- }
-
- }
- //------------ end auxiliary collection
-
- portal->freeResult();
-
- //------------ text table
- // if text table have not text visual table associated, create it
- string sel = "SELECT geom_table FROM te_representation WHERE";
- sel += " geom_type = " + Te2String(TeTEXT);
- if(portal->query(sel))
- {
- while(portal->fetchRow())
- {
- string table = portal->getData(0);
- string tvis = table + "_txvisual";
- if(!db->tableExist(tvis))
- {
- TeAttributeList atl;
- TeAttribute at;
-
- at.rep_.name_ = "geom_id";
- at.rep_.type_ = TeINT;
- at.rep_.numChar_ = 0;
- at.rep_.isPrimaryKey_ = true;
- atl.push_back(at);
-
- at.rep_.isPrimaryKey_ = false;
- at.rep_.name_ = "dot_height";
- at.rep_.type_ = TeINT;
- atl.push_back(at);
-
- at.rep_.name_ = "fix_size";
- at.rep_.type_ = TeINT;
- atl.push_back(at);
-
- at.rep_.name_ = "color";
- at.rep_.type_ = TeINT;
- atl.push_back(at);
-
- at.rep_.name_ = "family";
- at.rep_.type_ = TeSTRING;
- at.rep_.numChar_ = 128;
- atl.push_back(at);
-
- at.rep_.name_ = "bold";
- at.rep_.type_ = TeINT;
- at.rep_.numChar_ = 0;
- atl.push_back(at);
-
- at.rep_.name_ = "italic";
- at.rep_.type_ = TeINT;
- atl.push_back(at);
-
- db->createTable(tvis, atl);
- string fk = "fk_" + tvis;
- db->createRelation(fk, tvis, "geom_id", table, "geom_id", true);
- string ins = "INSERT INTO " + tvis + " (geom_id) SELECT geom_id FROM " + table;
- db->execute(ins);
-
- string popule = "UPDATE " + tvis;
- popule += " SET dot_height = 12";
- popule += ", fix_size = 0";
- popule += ", color = 16711680";
- popule += ", family = 'verdana'";
- popule += ", bold = 1";
- popule += ", italic = 0";
- if(!db->execute(popule))
- {
- errorMessage = "Fail to generate the text visual table!\n";
- errorMessage += db->errorMessage();
- delete portal;
- return false;;
- }
- }
- }
- }
- //------------ end text table
- delete portal;
- return true;
-}
-
-
-bool updateDB30To301(TeDatabase* db, string& errorMessage)
-{
- TeAttribute fattr;
-
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- // ----- collection_table
-
- string sql = " SELECT collection_table FROM te_theme ";
- if(!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- while(portal->fetchRow())
- {
- string collName = portal->getData(0);
- if( (db->tableExist(collName)) &&
- (!db->columnExist(collName, "c_object_status", fattr)))
- {
- TeAttributeRep atRep;
- atRep.type_ = TeINT;
- atRep.name_ = "c_object_status";
- if(db->addColumn(collName, atRep) == false)
- {
- errorMessage = "The column c_object_status could not be appended!\n";
- errorMessage += db->errorMessage();
- delete portal;
- return false;
- }
-
- string upd = " UPDATE "+collName+" t1, "+collName+" t2 ";
- upd += " SET t1.c_object_status = t2.c_legend_result ";
- upd += " WHERE t1.c_object_id = t2.c_object_id ";
-
- if(!db->execute (upd))
- {
- errorMessage = db->errorMessage();
- delete portal;
- return false;
- }
-
- db->deleteColumn(collName, "c_legend_result");
- }
- }
-
- delete portal;
- return true;
-}
-
-
-bool updateDB301To302(TeDatabase* db, string& errorMessage)
-{
-
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- // ----- valid attribute table
-
- TeAttrTableVector attrTableVec;
- if(db->getAttrTables(attrTableVec))
- {
- for(unsigned int i=0; i<attrTableVec.size(); ++i)
- {
- TeTable fromTable = attrTableVec[i];
- bool flag = false;
-
- if(fromTable.tableType()==TeAttrMedia)
- continue;
-
- //verify if there is another table with the same name
- for(unsigned int j=0; j<i; ++j)
- {
- if(TeConvertToUpperCase(attrTableVec[j].name())==TeConvertToUpperCase(fromTable.name()))
- {
- flag = true;
- break;
- }
- }
-
- if(flag)
- continue;
-
- if(db->validTable(fromTable)) //fromTable was modified
- {
- TeAttributeList newAttrList = fromTable.attributeList();
- TeAttributeList oldAttrList = attrTableVec[i].attributeList();
- TeAttributeList::iterator newAttIt = newAttrList.begin();
- TeAttributeList::iterator oldAttIt = oldAttrList.begin();
-
- bool change = false;
- while(newAttIt!=newAttrList.end())
- {
- if(((*oldAttIt).rep_.name_) != ((*newAttIt).rep_.name_))
- {
- TeAttributeRep rep = (*newAttIt).rep_;
- if(db->alterTable(fromTable.name(), rep, (*oldAttIt).rep_.name_))
- change = true;
- }
-
- ++newAttIt;
- ++oldAttIt;
- }
-
- if(change)
- {
- // update te_layer_table
- string upd = " UPDATE te_layer_table ";
- upd += " SET unique_id = '"+ fromTable.uniqueName() +"'";
- upd += ", attr_link = '"+ fromTable.linkName() +"'";
- upd += " WHERE attr_table = '"+ fromTable.name() +"'";
-
- if(!db->execute (upd))
- {
- delete portal;
- errorMessage = "Error updating te_layer_table!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
- }//if
- }//for
- portal->freeResult();
- }
-
- // ----- te_grouping table
-
- string sel = " SELECT theme_id, grouping_attr, grouping_attr_type FROM te_grouping ";
- if(!portal->query(sel))
- {
- delete portal;
- return false;
- }
-
- while(portal->fetchRow())
- {
- string themeId, gAttr;
- themeId = portal->getData(0);
- gAttr = portal->getData(1);
- int gTypr = portal->getInt(2);
-
- if(((gAttr.empty()) || (gAttr=="NONE")) && (gTypr==0))
- {
- string del = " DELETE FROM te_grouping WHERE theme_id = "+ themeId;
- db->execute(del);
- }
- }
-
- // ----- te_grouping table
-
- delete portal;
- return true;
-}
-
-bool PostgreSQLUpdateDB302To310(TeDatabase* db, TeGeomRep rep, const string& geomTableName)
-{
- string geomColumnName = "spatial_box";
-
- if(rep & TeRASTER)
- geomColumnName = "block_box";
-
- TeAttribute attr;
-
-// verifies if table already has a box column
- if(db->columnExist(geomTableName, geomColumnName, attr))
- return true;
-
-// add box column
- string sql = "ALTER TABLE " + geomTableName;
- sql += " ADD COLUMN " + geomColumnName + " BOX";
-
- if(!db->execute(sql))
- return false;
-
-// make sure box column exist
- if(!db->columnExist(geomTableName, geomColumnName, attr))
- return false;
-
-// populate column with values from older one
- sql = "UPDATE " + geomTableName;
-
- if(rep & TePOINTS)
- sql += " SET " + geomColumnName + " = box(point(x, y), point(x, y))";
- else
- sql += " SET " + geomColumnName + " = box(point(upper_x, upper_y), point(lower_x, lower_y))";
-
- if(!db->execute(sql))
- return false;
-
-// check if there is no null values
- sql = "SELECT * FROM " + geomTableName;
- sql += " WHERE " + geomColumnName + " IS NULL";
-
- TeDatabasePortal* p = db->getPortal();
-
- if(!p)
- return false;
-
- if(!p->query(sql))
- {
- delete p;
-
- return false;
- }
-
- if(p->fetchRow())
- {
- delete p;
-
- return false;
- }
-
- delete p;
-
-// add not null for box column
- sql = "ALTER TABLE " + geomTableName;
- sql += " ALTER COLUMN " + geomColumnName + " SET NOT NULL";
-
- if(!db->execute(sql))
- return false;
-
-// create GiST index
- if(!db->createSpatialIndex(geomTableName, geomColumnName))
- return false;
-
-// for points is enough
- if(rep & TePOINTS)
- return true;
-
-// drop older B-Tree index
- sql = "DROP INDEX " + geomTableName + "_idx_box";
-
- if(!db->execute(sql))
- return false;
-
-// drop older box column
- sql = "ALTER TABLE " + geomTableName;
- sql += " DROP COLUMN lower_x";
-
- if(!db->execute(sql))
- return false;
-
- sql = "ALTER TABLE " + geomTableName;
- sql += " DROP COLUMN lower_y";
-
- if(!db->execute(sql))
- return false;
-
- sql = "ALTER TABLE " + geomTableName;
- sql += " DROP COLUMN upper_x";
-
- if(!db->execute(sql))
- return false;
-
- sql = "ALTER TABLE " + geomTableName;
- sql += " DROP COLUMN upper_y";
-
- if(!db->execute(sql))
- return false;
-
- return true;
-}
-
-bool updateDB302To310(TeDatabase* db, string& errorMessage)
-{
- // Append the column "grouping_chronon" in the "te_grouping"
- // table if he column doesn�t exist
- TeAttribute attr;
- if(db->columnExist("te_grouping", "grouping_chronon", attr) == false)
- {
- TeAttributeRep atRep;
- atRep.type_ = TeINT;
- atRep.name_ = "grouping_chronon";
- if(db->addColumn("te_grouping", atRep) == false)
- {
- errorMessage = "The column grouping_chronon could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
-
- // Set the new column "grouping_chronon" to no chronon
- string upd = " UPDATE te_grouping ";
- upd += " SET grouping_chronon = 0 ";
- if(!db->execute (upd))
- {
- errorMessage = db->errorMessage();
- return false;
- }
-
- }
-
- if(db->dbmsName() == "MySQL")
- {
- TeAttributeRep rep;
- rep.name_ = "visible_rep";
- rep.type_ = TeINT;
-
- if (db->alterTable("te_theme", rep) == false)
- {
- errorMessage = db->errorMessage();
- return false;
- }
- }
- else if(db->dbmsName() == "PostgreSQL")
- {
- if(!db->execute("BEGIN TRANSACTION"))
- {
- errorMessage = db->errorMessage();
- return false;
- }
-
- if(!db->loadLayerSet())
- {
- db->execute("ROLLBACK TRANSACTION");
- return false;
- }
-
- TeLayerMap& layerMap = db->layerMap();
-
- TeLayerMap::iterator itLayer = layerMap.begin();
-
-// for each layer, find representations to update box columns
- while(itLayer != layerMap.end())
- {
-// update point geometry table
- TeRepresentation* rep = itLayer->second->getRepresentation(TePOINTS);
-
- if(rep)
- {
- string geomTableName = rep->tableName_;
-
- if(!PostgreSQLUpdateDB302To310(db, TePOINTS, geomTableName))
- {
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
- }
-
-// update line geometry table
- rep = itLayer->second->getRepresentation(TeLINES);
-
- if(rep)
- {
- string geomTableName = rep->tableName_;
-
- if(!PostgreSQLUpdateDB302To310(db, TeLINES, geomTableName))
- {
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
- }
-
-// update polygon geometry table
- rep = itLayer->second->getRepresentation(TePOLYGONS);
-
- if(rep)
- {
- string geomTableName = rep->tableName_;
-
- if(!PostgreSQLUpdateDB302To310(db, TePOLYGONS, geomTableName))
- {
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
- }
-
-// update raster geometry table
- rep = itLayer->second->getRepresentation(TeRASTER);
-
- if(rep)
- {
- string rasterGeomTableName = rep->tableName_;
-
- string sql = "SELECT raster_table FROM " + rasterGeomTableName;
-
- TeDatabasePortal* p = db->getPortal();
-
- if(!p)
- {
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
-
- if(!p->query(sql))
- {
- delete p;
-
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
-
- while(p->fetchRow())
- {
- string geomTableName = p->getData(0);
-
- if(!PostgreSQLUpdateDB302To310(db, TeRASTER, geomTableName))
- {
- delete p;
-
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
- }
-
- delete p;
- }
-
-// update cell geometry table
- rep = itLayer->second->getRepresentation(TeCELLS);
-
- if(rep)
- {
- string geomTableName = rep->tableName_;
-
- if(!PostgreSQLUpdateDB302To310(db, TeCELLS, geomTableName))
- {
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
- }
-
-// update node geometry table
- rep = itLayer->second->getRepresentation(TeNODES);
-
- if(rep)
- {
- string geomTableName = rep->tableName_;
-
- if(!PostgreSQLUpdateDB302To310(db, TeNODES, geomTableName))
- {
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
- }
-
- ++itLayer;
- }
-
- if(!db->execute("COMMIT TRANSACTION"))
- {
- errorMessage = db->errorMessage();
- return false;
- }
- }
- else if(db->dbmsName() == "PostGIS")
- {
- if(!db->execute("BEGIN TRANSACTION"))
- {
- errorMessage = db->errorMessage();
- return false;
- }
-
- if(!db->loadLayerSet())
- {
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
-
- TeLayerMap& layerMap = db->layerMap();
-
- TeLayerMap::iterator itLayer = layerMap.begin();
-
-// for each layer, find representations to update box columns
- while(itLayer != layerMap.end())
- {
-// update raster geometry table
- TeRepresentation* rep = itLayer->second->getRepresentation(TeRASTER);
-
- if(rep)
- {
- string rasterGeomTableName = rep->tableName_;
-
- string sql = "SELECT raster_table FROM " + rasterGeomTableName;
-
- TeDatabasePortal* p = db->getPortal();
-
- if(!p)
- {
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
-
- if(!p->query(sql))
- {
- delete p;
-
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
-
- while(p->fetchRow())
- {
- string geomTableName = p->getData(0);
-
- if(!PostgreSQLUpdateDB302To310(db, TeRASTER, geomTableName))
- {
- delete p;
-
- db->execute("ROLLBACK TRANSACTION");
-
- return false;
- }
- }
-
- delete p;
- }
-
- ++itLayer;
- }
-
- if(!db->execute("COMMIT TRANSACTION"))
- {
- errorMessage = db->errorMessage();
- return false;
- }
- }
-
- return true;
-}
-
-bool updateDB310To311(TeDatabase* db, string& errorMessage)
-{
- string sql = " SELECT collection_table FROM te_theme ";
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- if(!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- while(portal->fetchRow())
- {
- string tableName = portal->getData(0);
- if(!db->tableExist(tableName+"_aux"))
- continue;
-
- TeDatabasePortal* portal2 = db->getPortal();
- if(!portal2)
- {
- delete portal;
- return false;
- }
-
- sql = " SELECT * FROM "+ tableName+"_aux WHERE 1=2";
- if(!portal2->query(sql))
- {
- delete portal;
- delete portal2;
- return false;
- }
-
- TeAttributeList attrList;
- for(int i=0; i<portal2->numFields(); ++i)
- {
- if(TeConvertToUpperCase(portal2->getAttribute(i).rep_.name_) != "UNIQUE_ID" )
- attrList.push_back(portal2->getAttribute(i));
- }
-
- delete portal2;
-
- //add new autonumber column
- TeAttribute attr;
- attr.rep_.name_= "unique_id" ;
- attr.rep_.type_= TeINT;
- attr.rep_.isAutoNumber_ = true;
- attr.rep_.isPrimaryKey_ = true;
- attrList.push_back(attr);
-
- //create new table
- if(!db->createTable(tableName+"_aux2", attrList))
- {
- errorMessage = "Error creating table "+ tableName+"_aux2 !\n";
- errorMessage += db->errorMessage();
- delete portal;
- return false;
- }
-
- //insert records
- string ins = " INSERT INTO "+ tableName +"_aux2 ( ";
- string ins2 ="";
- for(unsigned int j=0; j<(attrList.size()-1); ++j)
- {
- if(j>0)
- ins2 += ",";
- ins2 += attrList[j].rep_.name_;
- }
- ins += ins2 +" ) SELECT "+ ins2;
- ins += " FROM "+ tableName+"_aux";
- if(!db->execute(ins))
- {
- errorMessage = "Error inserting table "+ tableName+"_aux2 !\n";
- errorMessage += db->errorMessage();
- delete portal;
- return false;
- }
-
- sql = " DROP TABLE "+ tableName+"_aux";
- if(db->tableExist(tableName+"_aux"))
- {
- if(!db->execute(sql))
- {
- errorMessage = "Error dropping table "+ tableName+"_aux2 !\n";
- errorMessage += db->errorMessage();
- delete portal;
- return false;
- }
- }
-
- if(!db->alterTable(tableName+"_aux2", tableName+"_aux"))
- {
- errorMessage = "Error renaming table "+ tableName+"_aux2 !\n";
- errorMessage += db->errorMessage();
- delete portal;
- return false;
- }
- }
-
- delete portal;
- return true;
-}
-
-bool updateDB311To320(TeDatabase* db, string& errorMessage)
-{
- if (!db->tableExist("te_project"))
- {
- if (!db->createProjectTable())
- {
- errorMessage = "Error creating te_project table\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
-
- if (!db->tableExist("te_project_view"))
- {
- if (!db->createProjectViewTable())
- {
- errorMessage = "Error creating te_project_view table\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
-
- //remove columns of the table te_visual
- TeAttribute attr;
- attr.rep_.name_ = "lib_name";
- attr.rep_.type_ = TeSTRING;
-
- if(db->columnExist("te_visual", attr.rep_.name_,attr))
- {
- //remove column lib_name
- if(!db->deleteColumn("te_visual", attr.rep_.name_))
- {
- errorMessage = "Error removing a column of the te_visual table\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
-
- attr.rep_.name_ = "contour_lib_name";
- if(db->columnExist("te_visual", attr.rep_.name_,attr))
- {
- //remove column lib_name
- if(!db->deleteColumn("te_visual", attr.rep_.name_))
- {
- errorMessage = "Error removing a column of the te_visual table\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
-
- return true;
-}
-
-bool updateDB320To3201(TeDatabase* db, string& errorMessage)
-{
- //--- remove the table te_color_scheme
- db->deleteTable("te_color_scheme");
-
- //--- store the theme box
- //verify if the theme box is stored
- TeAttribute attr;
- attr.rep_.name_ = "lower_x";
- attr.rep_.type_ = TeREAL;
-
- TeAttributeRep atRep;
- if(!db->columnExist("te_theme", attr.rep_.name_,attr))
- {
- //create the columns
- TeAttributeRep atRep;
- atRep.type_ = TeREAL;
- atRep.name_ = "lower_x";
- atRep.decimals_ = 15;
- atRep.defaultValue_ = "0.0";
- if(db->addColumn("te_theme", atRep) == false)
- {
- errorMessage = "The theme box could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
- attr.rep_.name_ = "lower_y";
- if(!db->columnExist("te_theme", attr.rep_.name_,attr))
- {
- atRep.name_ = "lower_y";
- if(db->addColumn("te_theme", atRep) == false)
- {
- errorMessage = "The theme box could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
- attr.rep_.name_ = "upper_x";
- if(!db->columnExist("te_theme", attr.rep_.name_,attr))
- {
- atRep.name_ = "upper_x";
- if(db->addColumn("te_theme", atRep) == false)
- {
- errorMessage = "The theme box could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
- attr.rep_.name_ = "upper_y";
- if(!db->columnExist("te_theme", attr.rep_.name_,attr))
- {
- atRep.name_ = "upper_y";
- if(db->addColumn("te_theme", atRep) == false)
- {
- errorMessage = "The theme box could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
-
- //fill the box theme
- string sql = "SELECT te_theme.name, te_view.user_name ";
- sql += " FROM te_theme INNER JOIN te_view ON te_theme.view_id = te_view.view_id ";
- TeDatabasePortal* portal = db->getPortal();
- if(!portal)
- return false;
-
- if(!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- string originalUser = db->user();
- while(portal->fetchRow())
- {
- string themeName = string(portal->getData(0));
- string userName = string(portal->getData(1));
- db->user(userName);
-
- TeTheme theme(themeName);
- if(!db->loadTheme(&theme))
- {
- delete portal;
- errorMessage = "Error updating theme box!";
- return false;
- }
-
- if(theme.type()==TeTREE)
- continue;
-
- //select the theme box
- TeBox bb;
- if (theme.layer()->hasGeometry(TeRASTER))
- bb = theme.layer()->box();
-
- if (theme.layer()->hasGeometry(TeRASTERFILE))
- updateBox(bb,theme.layer()->getRepresentation(TeRASTERFILE)->box_);
-
- string colTabName = theme.collectionTable();
- if (!colTabName.empty())
- {
- string sqlfrom;
- string geomTable;
- if (theme.layer()->hasGeometry(TePOINTS))
- {
- geomTable = theme.layer()->tableName(TePOINTS);
- sqlfrom = colTabName + " LEFT JOIN " + geomTable;
- sqlfrom += " ON " + colTabName + ".c_object_id = " + geomTable + ".object_id";
- TeBox bpt;
- if(db->getMBRSelectedObjects(geomTable,"spatial_data", sqlfrom, "","",TePOINTS,bpt))
- updateBox(bb,bpt);
- }
- if (theme.layer()->hasGeometry(TeLINES))
- {
- geomTable = theme.layer()->tableName(TeLINES);
- sqlfrom = colTabName + " LEFT JOIN " + geomTable;
- sqlfrom += " ON " + colTabName + ".c_object_id = " + geomTable + ".object_id";
- TeBox bln;
- if (db->getMBRSelectedObjects(geomTable,"spatial_data", sqlfrom, "","",TeLINES,bln))
- updateBox(bb,bln);
- }
- if (theme.layer()->hasGeometry(TePOLYGONS))
- {
- geomTable = theme.layer()->tableName(TePOLYGONS);
- sqlfrom = colTabName + " LEFT JOIN " + geomTable;
- sqlfrom += " ON " + colTabName + ".c_object_id = " + geomTable + ".object_id";
- TeBox bpol;
- if (db->getMBRSelectedObjects(geomTable,"spatial_data", sqlfrom, "","",TePOLYGONS,bpol))
- updateBox(bb,bpol);
- }
-
- if (theme.layer()->hasGeometry(TeCELLS))
- {
- geomTable = theme.layer()->tableName(TeCELLS);
- sqlfrom = colTabName + " LEFT JOIN " + geomTable;
- sqlfrom += " ON " + colTabName + ".c_object_id = " + geomTable + ".object_id";
- TeBox bpol;
- if (db->getMBRSelectedObjects(geomTable,"spatial_data", sqlfrom, "","",TeCELLS,bpol))
- updateBox(bb,bpol);
- }
-
- if (theme.layer()->hasGeometry(TeTEXT))
- {
- geomTable = theme.layer()->tableName(TeTEXT);
- sqlfrom = colTabName + " LEFT JOIN " + geomTable;
- sqlfrom += " ON " + colTabName + ".c_object_id = " + geomTable + ".object_id";
- TeBox bpol;
- if (db->getMBRSelectedObjects(geomTable,"spatial_data", sqlfrom, "","",TeTEXT,bpol))
- updateBox(bb,bpol);
- }
- }
-
- //update theme box
- string update = "UPDATE te_theme SET ";
- update += " lower_x = " + Te2String(bb.x1(), 15);
- update += ", lower_y = " + Te2String(bb.y1(), 15);
- update += ", upper_x = " + Te2String(bb.x2(), 15);
- update += ", upper_y = " + Te2String(bb.y2(), 15);
- update += " WHERE theme_id=" + Te2String (theme.id());
- if(!db->execute(update))
- {
- delete portal;
- errorMessage = "Error updating theme box!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
-
- db->clear();
- portal->freeResult();
- db->user(originalUser);
-
- //--- store the view box and current theme
- //verify if the view box is stored
- attr.rep_.name_ = "lower_x";
- attr.rep_.type_ = TeREAL;
-
- //create the columns
- if(!db->columnExist("te_view", attr.rep_.name_,attr))
- {
- atRep.type_ = TeREAL;
- atRep.name_ = "lower_x";
- atRep.decimals_ = 15;
- atRep.defaultValue_ = "0.0";
- if(db->addColumn("te_view", atRep) == false)
- {
- delete portal;
- errorMessage = "The view box could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
- attr.rep_.name_ = "lower_y";
- if(!db->columnExist("te_view", attr.rep_.name_,attr))
- {
- atRep.name_ = "lower_y";
- if(db->addColumn("te_view", atRep) == false)
- {
- delete portal;
- errorMessage = "The view box could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
- attr.rep_.name_ = "upper_x";
- if(!db->columnExist("te_view", attr.rep_.name_,attr))
- {
- atRep.name_ = "upper_x";
- if(db->addColumn("te_view", atRep) == false)
- {
- delete portal;
- errorMessage = "The view box could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
- attr.rep_.name_ = "upper_y";
- if(!db->columnExist("te_view", attr.rep_.name_,attr))
- {
- atRep.name_ = "upper_y";
- if(db->addColumn("te_view", atRep) == false)
- {
- delete portal;
- errorMessage = "The view box could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
- atRep.type_ = TeINT;
- atRep.name_ = "current_theme";
- atRep.decimals_ = 0;
- attr.rep_.name_ = "current_theme";
- if(!db->columnExist("te_view", attr.rep_.name_,attr))
- {
- if(db->addColumn("te_view", atRep) == false)
- {
- delete portal;
- errorMessage = "The view current theme could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- //create foreign key
- if (!db->createRelation("fk_view_current_theme", "te_view", "current_theme", "te_theme", "theme_id", true))
- {
- delete portal;
- errorMessage = "Error creating foreign key in the view table!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
-
- //fill the box view
- sql = "SELECT view_id, MIN(lower_x), MIN(lower_y), MAX(upper_x), MAX(upper_y) ";
- sql += " FROM te_theme GROUP BY view_id ";
-
- if(!portal->query(sql))
- {
- delete portal;
- return false;
- }
-
- while(portal->fetchRow())
- {
- string viewId = string(portal->getData(0));
- string update = " UPDATE te_view SET ";
- update += " lower_x = "+ string(portal->getData(1));
- update += ", lower_y = "+ string(portal->getData(2));
- update += ", upper_x = "+ string(portal->getData(3));
- update += ", upper_y = "+ string(portal->getData(4));
- update += ", current_theme = NULL ";
- update += " WHERE view_id = "+ viewId;
-
- if(!db->execute(update))
- {
- delete portal;
- errorMessage = "Error updating view box!\n";
- errorMessage += db->errorMessage();
- return false;
- }
- }
-
- //------ Project information
- attr.rep_.name_ = "current_view";
- attr.rep_.type_ = TeINT;
-
- //if there is the column "current_view", delete it and create it again
- if(db->columnExist("te_project", attr.rep_.name_, attr))
- db->deleteColumn("te_project", attr.rep_.name_);
-
- attr.rep_.defaultValue_ = "0";
- if(!db->addColumn("te_project", attr.rep_))
- {
- delete portal;
- errorMessage = "The project view could not be appended!\n";
- errorMessage += db->errorMessage();
- return false;
- }
-
- TeProject project;
- project.setName("TV_Project");
- project.setDescription("TerraView_Default_Project");
- project.setCurrentViewId(-1); // not have project
- if(!db->insertProject(&project))
- {
- delete portal;
- errorMessage = "Error inserting terraView default project!\n";
- errorMessage += db->errorMessage();
- return false;
- }
-
- portal->freeResult();
- if(!portal->query("SELECT view_id FROM te_view"))
- {
- errorMessage = db->errorMessage();
- delete portal;
- return false;
- }
- while(portal->fetchRow())
- {
- string viewId = string(portal->getData(0));
- string ins = "INSERT INTO te_project_view (project_id, view_id) VALUES (";
- ins += Te2String(project.id()) + "," + viewId + ")";
- if(!db->execute(ins))
- {
- errorMessage = db->errorMessage();
- delete portal;
- return false;
- }
- }
-
- delete portal;
- return true;
-}
-
-
diff --git a/src/terralib/utils/TeUpdateDBVersion.h b/src/terralib/utils/TeUpdateDBVersion.h
deleted file mode 100644
index 1ebd340..0000000
--- a/src/terralib/utils/TeUpdateDBVersion.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/************************************************************************************
- TerraLib - a library for developing GIS applications.
-Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
-
-This code is part of the TerraLib library.
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library.
-
-The authors reassure the license terms regarding the warranties.
-They specifically disclaim any warranties, including, but not limited to,
-the implied warranties of merchantability and fitness for a particular purpose.
-The library provided hereunder is on an "as is" basis, and the authors have no
-obligation to provide maintenance, support, updates, enhancements, or modifications.
-In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
-indirect, special, incidental, or consequential damages arising out of the use
-of this library and its documentation.
-*************************************************************************************/
-/*! \file TeUpdateDBVersion.h
- \brief This file contains the routines to update a TerraLib database to its different versions
-*/
-
-#ifndef __TERRALIB_INTERNAL_UPDATEDBVERSION_H
-#define __TERRALIB_INTERNAL_UPDATEDBVERSION_H
-
-#include "TeDatabase.h"
-
-//! verify if the database needs update
-bool needUpdateDB(TeDatabase* db, string& DBversion);
-
-//! update database version
-bool updateDBVersion(TeDatabase* db, string& DBversion, string& errorMessage);
-
-//! update database from release 2.0 to release 3.0
-bool updateDB20To30(TeDatabase* db, string& errorMessage);
-
-//! update database from release 3.0 to release 3.0.1
-bool updateDB30To301(TeDatabase* db, string& errorMessage);
-
-//! update database from release 3.0.1 to release 3.0.2 (3.0 Plus)
-bool updateDB301To302(TeDatabase* db, string& errorMessage);
-
-//! update database from release 3.0.2 to release 3.1.0
-bool updateDB302To310(TeDatabase* db, string& errorMessage);
-
-//! update database from release 3.1.0 to release 3.1.1
-bool updateDB310To311(TeDatabase* db, string& errorMessage);
-
-//! update database from release 3.1.1 to release 3.2.0
-bool updateDB311To320(TeDatabase* db, string& errorMessage);
-
-//! update database from release 3.2.0 to release 3.2.0.1
-bool updateDB320To3201(TeDatabase* db, string& errorMessage);
-
-#endif
-
diff --git a/src/terralib/utils/mtrand.cpp b/src/terralib/utils/mtrand.cpp
deleted file mode 100644
index e6a8807..0000000
--- a/src/terralib/utils/mtrand.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// mtrand.cpp, see include file mtrand.h for information
-
-#include "mtrand.h"
-// non-inline function definitions and static member definitions cannot
-// reside in header file because of the risk of multiple declarations
-
-// initialization of static private members
-unsigned long MTRand_int32::state[n] = {0x0UL};
-int MTRand_int32::p = 0;
-bool MTRand_int32::init = false;
-
-void MTRand_int32::gen_state() { // generate new state vector
- for (int i = 0; i < (n - m); ++i)
- state[i] = state[i + m] ^ twiddle(state[i], state[i + 1]);
- for (int i = n - m; i < (n - 1); ++i)
- state[i] = state[i + m - n] ^ twiddle(state[i], state[i + 1]);
- state[n - 1] = state[m - 1] ^ twiddle(state[n - 1], state[0]);
- p = 0; // reset position
-}
-
-void MTRand_int32::seed(unsigned long s) { // init by 32 bit seed
- state[0] = s & 0xFFFFFFFFUL; // for > 32 bit machines
- for (int i = 1; i < n; ++i) {
- state[i] = 1812433253UL * (state[i - 1] ^ (state[i - 1] >> 30)) + i;
-// see Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier
-// in the previous versions, MSBs of the seed affect only MSBs of the array state
-// 2002/01/09 modified by Makoto Matsumoto
- state[i] &= 0xFFFFFFFFUL; // for > 32 bit machines
- }
- p = n; // force gen_state() to be called for next random number
-}
-
-void MTRand_int32::seed(const unsigned long* array, int size) { // init by array
- seed(19650218UL);
- int i = 1, j = 0;
- for (int k = ((n > size) ? n : size); k; --k) {
- state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1664525UL))
- + array[j] + j; // non linear
- state[i] &= 0xFFFFFFFFUL; // for > 32 bit machines
- ++j; j %= size;
- if ((++i) == n) { state[0] = state[n - 1]; i = 1; }
- }
- for (int k = n - 1; k; --k) {
- state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1566083941UL)) - i;
- state[i] &= 0xFFFFFFFFUL; // for > 32 bit machines
- if ((++i) == n) { state[0] = state[n - 1]; i = 1; }
- }
- state[0] = 0x80000000UL; // MSB is 1; assuring non-zero initial array
- p = n; // force gen_state() to be called for next random number
-}
diff --git a/src/terralib/utils/mtrand.h b/src/terralib/utils/mtrand.h
deleted file mode 100644
index 0f49489..0000000
--- a/src/terralib/utils/mtrand.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// mtrand.h
-// C++ include file for MT19937, with initialization improved 2002/1/26.
-// Coded by Takuji Nishimura and Makoto Matsumoto.
-// Ported to C++ by Jasper Bedaux 2003/1/1 (see http://www.bedaux.net/mtrand/).
-// The generators returning floating point numbers are based on
-// a version by Isaku Wada, 2002/01/09
-//
-// Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. The names of its contributors may not be used to endorse or promote
-// products derived from this software without specific prior written
-// permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Any feedback is very welcome.
-// http://www.math.keio.ac.jp/matumoto/emt.html
-// email: matumoto at math.keio.ac.jp
-//
-// Feedback about the C++ port should be sent to Jasper Bedaux,
-// see http://www.bedaux.net/mtrand/ for e-mail address and info.
-
-#ifndef MTRAND_H
-#define MTRAND_H
-
-class MTRand_int32 { // Mersenne Twister random number generator
-public:
-// default constructor: uses default seed only if this is the first instance
- MTRand_int32() { if (!init) seed(5489UL); init = true; }
-// constructor with 32 bit int as seed
- MTRand_int32(unsigned long s) { seed(s); init = true; }
-// constructor with array of size 32 bit ints as seed
- MTRand_int32(const unsigned long* array, int size) { seed(array, size); init = true; }
-// the two seed functions
- void seed(unsigned long); // seed with 32 bit integer
- void seed(const unsigned long*, int size); // seed with array
-// overload operator() to make this a generator (functor)
- unsigned long operator()() { return rand_int32(); }
-// 2007-02-11: made the destructor virtual; thanks "double more" for pointing this out
- virtual ~MTRand_int32() {} // destructor
-protected: // used by derived classes, otherwise not accessible; use the ()-operator
- unsigned long rand_int32(); // generate 32 bit random integer
-private:
- static const int n = 624, m = 397; // compile time constants
-// the variables below are static (no duplicates can exist)
- static unsigned long state[n]; // state vector array
- static int p; // position in state array
- static bool init; // true if init function is called
-// private functions used to generate the pseudo random numbers
- unsigned long twiddle(unsigned long, unsigned long); // used by gen_state()
- void gen_state(); // generate new state
-// make copy constructor and assignment operator unavailable, they don't make sense
- MTRand_int32(const MTRand_int32&); // copy constructor not defined
- void operator=(const MTRand_int32&); // assignment operator not defined
-};
-
-// inline for speed, must therefore reside in header file
-inline unsigned long MTRand_int32::twiddle(unsigned long u, unsigned long v) {
- return (((u & 0x80000000UL) | (v & 0x7FFFFFFFUL)) >> 1)
- ^ ((v & 1UL) ? 0x9908B0DFUL : 0x0UL);
-}
-
-inline unsigned long MTRand_int32::rand_int32() { // generate 32 bit random int
- if (p == n) gen_state(); // new state vector needed
-// gen_state() is split off to be non-inline, because it is only called once
-// in every 624 calls and otherwise irand() would become too big to get inlined
- unsigned long x = state[p++];
- x ^= (x >> 11);
- x ^= (x << 7) & 0x9D2C5680UL;
- x ^= (x << 15) & 0xEFC60000UL;
- return x ^ (x >> 18);
-}
-
-// generates double floating point numbers in the half-open interval [0, 1)
-class MTRand : public MTRand_int32 {
-public:
- MTRand() : MTRand_int32() {}
- MTRand(unsigned long seed) : MTRand_int32(seed) {}
- MTRand(const unsigned long* seed, int size) : MTRand_int32(seed, size) {}
- ~MTRand() {}
- double operator()() {
- return static_cast<double>(rand_int32()) * (1. / 4294967296.); } // divided by 2^32
-private:
- MTRand(const MTRand&); // copy constructor not defined
- void operator=(const MTRand&); // assignment operator not defined
-};
-
-// generates double floating point numbers in the closed interval [0, 1]
-class MTRand_closed : public MTRand_int32 {
-public:
- MTRand_closed() : MTRand_int32() {}
- MTRand_closed(unsigned long seed) : MTRand_int32(seed) {}
- MTRand_closed(const unsigned long* seed, int size) : MTRand_int32(seed, size) {}
- ~MTRand_closed() {}
- double operator()() {
- return static_cast<double>(rand_int32()) * (1. / 4294967295.); } // divided by 2^32 - 1
-private:
- MTRand_closed(const MTRand_closed&); // copy constructor not defined
- void operator=(const MTRand_closed&); // assignment operator not defined
-};
-
-// generates double floating point numbers in the open interval (0, 1)
-class MTRand_open : public MTRand_int32 {
-public:
- MTRand_open() : MTRand_int32() {}
- MTRand_open(unsigned long seed) : MTRand_int32(seed) {}
- MTRand_open(const unsigned long* seed, int size) : MTRand_int32(seed, size) {}
- ~MTRand_open() {}
- double operator()() {
- return (static_cast<double>(rand_int32()) + .5) * (1. / 4294967296.); } // divided by 2^32
-private:
- MTRand_open(const MTRand_open&); // copy constructor not defined
- void operator=(const MTRand_open&); // assignment operator not defined
-};
-
-// generates 53 bit resolution doubles in the half-open interval [0, 1)
-class MTRand53 : public MTRand_int32 {
-public:
- MTRand53() : MTRand_int32() {}
- MTRand53(unsigned long seed) : MTRand_int32(seed) {}
- MTRand53(const unsigned long* seed, int size) : MTRand_int32(seed, size) {}
- ~MTRand53() {}
- double operator()() {
- return (static_cast<double>(rand_int32() >> 5) * 67108864. +
- static_cast<double>(rand_int32() >> 6)) * (1. / 9007199254740992.); }
-private:
- MTRand53(const MTRand53&); // copy constructor not defined
- void operator=(const MTRand53&); // assignment operator not defined
-};
-
-#endif // MTRAND_H
diff --git a/src/visualisers/Akima474.cc b/src/visualisers/Akima474.cc
index f90aa18..33e4ea8 100644
--- a/src/visualisers/Akima474.cc
+++ b/src/visualisers/Akima474.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Akima474.cc
Implementation of Akima474 class.
diff --git a/src/visualisers/Akima474Method.h b/src/visualisers/Akima474Method.h
index 4e454ce..84f3ab8 100644
--- a/src/visualisers/Akima474Method.h
+++ b/src/visualisers/Akima474Method.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Akima474Method.h
\brief Definition of the Template class Akima474Method.
diff --git a/src/visualisers/Akima760.cc b/src/visualisers/Akima760.cc
index 50bdee4..85ce0f3 100644
--- a/src/visualisers/Akima760.cc
+++ b/src/visualisers/Akima760.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Akima760.cc
Implementation of Akima760 class.
diff --git a/src/visualisers/Akima760Method.cc b/src/visualisers/Akima760Method.cc
index 5a3eec9..14dc4c0 100644
--- a/src/visualisers/Akima760Method.cc
+++ b/src/visualisers/Akima760Method.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Akima760Method.cc
\brief Implementation of the Template class Akima760Method.
diff --git a/src/visualisers/Akima760Method.h b/src/visualisers/Akima760Method.h
index e807d23..da01339 100644
--- a/src/visualisers/Akima760Method.h
+++ b/src/visualisers/Akima760Method.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Akima760Method.h
\brief Definition of the Template class Akima760Method.
diff --git a/src/visualisers/Akima761.cc b/src/visualisers/Akima761.cc
index a500b4d..81efa64 100644
--- a/src/visualisers/Akima761.cc
+++ b/src/visualisers/Akima761.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Akima761.cc
Implementation of Akima761 class.
diff --git a/src/visualisers/Akima761Method.cc b/src/visualisers/Akima761Method.cc
index 5528efc..38c0154 100644
--- a/src/visualisers/Akima761Method.cc
+++ b/src/visualisers/Akima761Method.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Akima761Method.cc
\brief Implementation of the Template class Akima761Method.
diff --git a/src/visualisers/Akima761Method.h b/src/visualisers/Akima761Method.h
index 6223b6d..f24c420 100644
--- a/src/visualisers/Akima761Method.h
+++ b/src/visualisers/Akima761Method.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Akima761Method.h
\brief Definition of the Template class Akima761Method.
diff --git a/src/visualisers/ArrowPlotting.cc b/src/visualisers/ArrowPlotting.cc
index f490a6e..abb0205 100644
--- a/src/visualisers/ArrowPlotting.cc
+++ b/src/visualisers/ArrowPlotting.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file WindPlotting.cc
\brief Implementation of the Template class Wind.
diff --git a/src/visualisers/ArrowPlotting.h b/src/visualisers/ArrowPlotting.h
index 8472742..5dd5201 100644
--- a/src/visualisers/ArrowPlotting.h
+++ b/src/visualisers/ArrowPlotting.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ArrowPlotting.h
\brief Definition of the Template class ArrowPlotting.
diff --git a/src/visualisers/AutomaticContourMethod.h b/src/visualisers/AutomaticContourMethod.h
index d84cf22..09a94e6 100644
--- a/src/visualisers/AutomaticContourMethod.h
+++ b/src/visualisers/AutomaticContourMethod.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AutomaticContourMethod.h
\brief Definition of the Template class AutomaticContourMethod.
diff --git a/src/visualisers/Axis.cc b/src/visualisers/Axis.cc
index 0b6fa86..9514be0 100644
--- a/src/visualisers/Axis.cc
+++ b/src/visualisers/Axis.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Axis.cc
\brief Implementation of the Template class Axis.
@@ -370,7 +362,7 @@ void VerticalAxis::label(VerticalAxisVisitor& axis)
if ( count % label_frequency_ ) continue;
- double height = ((*y)->height() == DBL_MIN || (*y)->height() == 0 ) ? label_height_ : (*y)->height();
+ double height = ((*y)->height() == DBL_MIN || (*y)->height() == 0 ) ? label_height_ : (*y)->height();
double pos;
map<int, double>::iterator p = positions.find((*y)->level());
@@ -383,7 +375,7 @@ void VerticalAxis::label(VerticalAxisVisitor& axis)
double newpos = axis.offsetTickLabel(height, p->second);
positions[(*y)->level()] = newpos;
- title_position_ = newpos;
+ title_position_ = axis.offsetTickLabel(height * label.size()/2, p->second);;
}
PaperPoint point(pos, transformation.y((*y)->position()));
diff --git a/src/visualisers/Axis.h b/src/visualisers/Axis.h
index 032f664..25580bd 100644
--- a/src/visualisers/Axis.h
+++ b/src/visualisers/Axis.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Axis.h
\brief Definition of the Template class Axis.
diff --git a/src/visualisers/AxisControl.cc b/src/visualisers/AxisControl.cc
index cd9fd1a..a7fb1cb 100644
--- a/src/visualisers/AxisControl.cc
+++ b/src/visualisers/AxisControl.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisControl.cc
\brief Implementation of the Template class AxisControl.
diff --git a/src/visualisers/AxisControl.h b/src/visualisers/AxisControl.h
index bcb16e7..13852b5 100644
--- a/src/visualisers/AxisControl.h
+++ b/src/visualisers/AxisControl.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisControl.h
\brief Definition of the Template class AxisControl.
diff --git a/src/visualisers/AxisGrid.cc b/src/visualisers/AxisGrid.cc
index 82b7e8a..eb21cd7 100644
--- a/src/visualisers/AxisGrid.cc
+++ b/src/visualisers/AxisGrid.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisGrid.cc
\brief Implementation of the Template class AxisGrid.
diff --git a/src/visualisers/AxisGrid.h b/src/visualisers/AxisGrid.h
index 375df68..db108b0 100644
--- a/src/visualisers/AxisGrid.h
+++ b/src/visualisers/AxisGrid.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisGrid.h
\brief Definition of the Template class AxisGrid.
diff --git a/src/visualisers/AxisItem.cc b/src/visualisers/AxisItem.cc
index 9014ec1..be5b4d6 100644
--- a/src/visualisers/AxisItem.cc
+++ b/src/visualisers/AxisItem.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisItem.cc
\brief Implementation of the Template class AxisItem.
diff --git a/src/visualisers/AxisItem.h b/src/visualisers/AxisItem.h
index c7f8626..daccc9f 100644
--- a/src/visualisers/AxisItem.h
+++ b/src/visualisers/AxisItem.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisItem.h
\brief Definition of the Template class AxisItem.
diff --git a/src/visualisers/AxisLine.cc b/src/visualisers/AxisLine.cc
index e93ff43..12e6f0b 100644
--- a/src/visualisers/AxisLine.cc
+++ b/src/visualisers/AxisLine.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisLine.cc
\brief Implementation of the Template class AxisLine.
diff --git a/src/visualisers/AxisLine.h b/src/visualisers/AxisLine.h
index 578c078..e62678b 100644
--- a/src/visualisers/AxisLine.h
+++ b/src/visualisers/AxisLine.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisLine.h
\brief Definition of the Template class AxisLine.
diff --git a/src/visualisers/AxisMethod.cc b/src/visualisers/AxisMethod.cc
index d4cf3f1..0a1480e 100644
--- a/src/visualisers/AxisMethod.cc
+++ b/src/visualisers/AxisMethod.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisMethod.cc
\brief Implementation of the Template class AxisMethod.
diff --git a/src/visualisers/AxisMethod.h b/src/visualisers/AxisMethod.h
index ce1d794..40edda8 100644
--- a/src/visualisers/AxisMethod.h
+++ b/src/visualisers/AxisMethod.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisMethod.h
\brief Definition of the Template class AxisMethod.
diff --git a/src/visualisers/AxisMinorTick.cc b/src/visualisers/AxisMinorTick.cc
index 7618f2f..43c652a 100644
--- a/src/visualisers/AxisMinorTick.cc
+++ b/src/visualisers/AxisMinorTick.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisMinorTick.cc
\brief Implementation of the Template class AxisMinorTick.
diff --git a/src/visualisers/AxisMinorTick.h b/src/visualisers/AxisMinorTick.h
index ea5825f..cbe157f 100644
--- a/src/visualisers/AxisMinorTick.h
+++ b/src/visualisers/AxisMinorTick.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisMinorTick.h
\brief Definition of the Template class AxisMinorTick.
diff --git a/src/visualisers/AxisTick.cc b/src/visualisers/AxisTick.cc
index 9edba03..7ba08c6 100644
--- a/src/visualisers/AxisTick.cc
+++ b/src/visualisers/AxisTick.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisTick.cc
\brief Implementation of the Template class AxisTick.
diff --git a/src/visualisers/AxisTick.h b/src/visualisers/AxisTick.h
index 675b311..1e1eab1 100644
--- a/src/visualisers/AxisTick.h
+++ b/src/visualisers/AxisTick.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisTick.h
\brief Definition of the Template class AxisTick.
diff --git a/src/visualisers/AxisTickLabelType.cc b/src/visualisers/AxisTickLabelType.cc
index c82ec11..bc480f8 100644
--- a/src/visualisers/AxisTickLabelType.cc
+++ b/src/visualisers/AxisTickLabelType.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisTickLabelType.cc
\brief Implementation of the Template class AxisTickLabelType.
diff --git a/src/visualisers/AxisTickLabelType.h b/src/visualisers/AxisTickLabelType.h
index b98323d..c1d1b64 100644
--- a/src/visualisers/AxisTickLabelType.h
+++ b/src/visualisers/AxisTickLabelType.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisTickLabelType.h
\brief Definition of the Template class AxisTickLabel.
diff --git a/src/visualisers/AxisTip.cc b/src/visualisers/AxisTip.cc
index 4888c70..3441833 100644
--- a/src/visualisers/AxisTip.cc
+++ b/src/visualisers/AxisTip.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file AxisTip.h
\brief Implementation of the Template class NoAxisTip.
diff --git a/src/visualisers/AxisTip.h b/src/visualisers/AxisTip.h
index 99e52a5..5a4b932 100644
--- a/src/visualisers/AxisTip.h
+++ b/src/visualisers/AxisTip.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file AxisTip.h
\brief Definition of the Template class NoAxisTip.
diff --git a/src/visualisers/AxisType.cc b/src/visualisers/AxisType.cc
index 898aadc..fc69ebe 100644
--- a/src/visualisers/AxisType.cc
+++ b/src/visualisers/AxisType.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisType.cc
\brief Implementation of the Template class AxisType.
diff --git a/src/visualisers/AxisType.h b/src/visualisers/AxisType.h
index 5f98e6a..c3ea92b 100644
--- a/src/visualisers/AxisType.h
+++ b/src/visualisers/AxisType.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file AxisType.h
\brief Definition of the Template class AxisType.
diff --git a/src/visualisers/Bar.cc b/src/visualisers/Bar.cc
index c69d623..faf6374 100644
--- a/src/visualisers/Bar.cc
+++ b/src/visualisers/Bar.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Bar.cc
\brief Implementation of the Template class Bar.
diff --git a/src/visualisers/Bar.h b/src/visualisers/Bar.h
index 33818f8..bf28475 100644
--- a/src/visualisers/Bar.h
+++ b/src/visualisers/Bar.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Bar.h
\brief Definition of the Template class Bar.
diff --git a/src/visualisers/BothValuePlotMethod.h b/src/visualisers/BothValuePlotMethod.h
index 2517be8..4062bbd 100644
--- a/src/visualisers/BothValuePlotMethod.h
+++ b/src/visualisers/BothValuePlotMethod.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BothValuePlotMethod.h
\brief Definition of the Template class BothValuePlotMethod.
diff --git a/src/visualisers/Boundaries.cc b/src/visualisers/Boundaries.cc
index a4f0b75..ebf4c09 100644
--- a/src/visualisers/Boundaries.cc
+++ b/src/visualisers/Boundaries.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Boundaries.cc
\brief Implementation of the Template class BoundariesBase.
diff --git a/src/visualisers/Boundaries.h b/src/visualisers/Boundaries.h
index 9f97f9f..88f8506 100644
--- a/src/visualisers/Boundaries.h
+++ b/src/visualisers/Boundaries.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Boundaries.h
\brief Definition of the Template class NoBoundaries.
diff --git a/src/visualisers/BoxPlotBasicItem.h b/src/visualisers/BoxPlotBasicItem.h
index 55287b5..f0d25cf 100644
--- a/src/visualisers/BoxPlotBasicItem.h
+++ b/src/visualisers/BoxPlotBasicItem.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BoxPlotBasicItem.h
\brief Definition of the Template class BoxPlotBasicItem.
diff --git a/src/visualisers/BoxPlotItem.cc b/src/visualisers/BoxPlotItem.cc
index 1532bca..eae3cd7 100644
--- a/src/visualisers/BoxPlotItem.cc
+++ b/src/visualisers/BoxPlotItem.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BoxPlotItem.cc
\brief Implementation of the Template class BoxPlotBox.
diff --git a/src/visualisers/BoxPlotItem.h b/src/visualisers/BoxPlotItem.h
index c79330f..6b46f0d 100644
--- a/src/visualisers/BoxPlotItem.h
+++ b/src/visualisers/BoxPlotItem.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BoxPlotItem.h
\brief Definition of the Template class BoxPlotItem.
diff --git a/src/visualisers/BoxPlotVisualiser.cc b/src/visualisers/BoxPlotVisualiser.cc
index 2eba1da..361c1d6 100644
--- a/src/visualisers/BoxPlotVisualiser.cc
+++ b/src/visualisers/BoxPlotVisualiser.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BoxPlotVisualiser.cc
\brief Implementation of the Template class BoxPlotVisualiser.
diff --git a/src/visualisers/BoxPlotVisualiser.h b/src/visualisers/BoxPlotVisualiser.h
index 8b92e0d..aa32b87 100644
--- a/src/visualisers/BoxPlotVisualiser.h
+++ b/src/visualisers/BoxPlotVisualiser.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BoxPlotVisualiser.h
\brief Definition of the Template class BoxPlotVisualiser.
diff --git a/src/visualisers/CalculateColourTechnique.cc b/src/visualisers/CalculateColourTechnique.cc
index 2674cb7..c1de945 100644
--- a/src/visualisers/CalculateColourTechnique.cc
+++ b/src/visualisers/CalculateColourTechnique.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CalculateColourTechnique.cc
\brief Implementation of the Template class CalculateColourTechnique.
diff --git a/src/visualisers/CalculateColourTechnique.h b/src/visualisers/CalculateColourTechnique.h
index 361a92b..2ff53bc 100644
--- a/src/visualisers/CalculateColourTechnique.h
+++ b/src/visualisers/CalculateColourTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CalculateColourTechnique.h
\brief Definition of the Template class CalculateColourTechnique.
diff --git a/src/visualisers/CalmIndicator.h b/src/visualisers/CalmIndicator.h
index 801dd89..8abcca8 100644
--- a/src/visualisers/CalmIndicator.h
+++ b/src/visualisers/CalmIndicator.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CalmIndicator.h
\brief Definition of the Template class CalmIndicator.
diff --git a/src/visualisers/CellShading.cc b/src/visualisers/CellShading.cc
index 8a73e4f..ad4c2d4 100644
--- a/src/visualisers/CellShading.cc
+++ b/src/visualisers/CellShading.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CellShading.cc
\brief Implementation of the Template class CellShading.
diff --git a/src/visualisers/CellShading.h b/src/visualisers/CellShading.h
index d31cf62..d45e243 100644
--- a/src/visualisers/CellShading.h
+++ b/src/visualisers/CellShading.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CellShading.h
\brief Definition of the Template class CellShading.
diff --git a/src/visualisers/Cities.cc b/src/visualisers/Cities.cc
index f2851bb..24d712a 100644
--- a/src/visualisers/Cities.cc
+++ b/src/visualisers/Cities.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Cities.cc
\brief Implementation of the Template class CitiesBase.
diff --git a/src/visualisers/Cities.h b/src/visualisers/Cities.h
index 24e9c2b..54502a7 100644
--- a/src/visualisers/Cities.h
+++ b/src/visualisers/Cities.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Cities.h
\brief Definition of the Template class NoCities.
diff --git a/src/visualisers/CoastPlotting.cc b/src/visualisers/CoastPlotting.cc
index 5c97d6e..35d8f3b 100644
--- a/src/visualisers/CoastPlotting.cc
+++ b/src/visualisers/CoastPlotting.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CoastPlotting.cc
\brief Implementation of the Template class CoastPlotting.
diff --git a/src/visualisers/CoastPlotting.h b/src/visualisers/CoastPlotting.h
index 1c9de7f..17c4ea5 100644
--- a/src/visualisers/CoastPlotting.h
+++ b/src/visualisers/CoastPlotting.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CoastPlotting.h
\brief Definition of the Template class CoastPlotting.
diff --git a/src/visualisers/Coastlines.cc b/src/visualisers/Coastlines.cc
index 0557f7c..9f8dee4 100644
--- a/src/visualisers/Coastlines.cc
+++ b/src/visualisers/Coastlines.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Coastlines.cc
\brief Implementation of the Template class Coastlines.
diff --git a/src/visualisers/Coastlines.h b/src/visualisers/Coastlines.h
index 2b844cc..cfc982c 100644
--- a/src/visualisers/Coastlines.h
+++ b/src/visualisers/Coastlines.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Coastlines.h
\brief Definition of the Template class Coastlines.
diff --git a/src/visualisers/ColourSelection.cc b/src/visualisers/ColourSelection.cc
index 398cbb6..937efb8 100644
--- a/src/visualisers/ColourSelection.cc
+++ b/src/visualisers/ColourSelection.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourSelection.cc
\brief Implementation of the Template class ColourSelection.
diff --git a/src/visualisers/ColourSelection.h b/src/visualisers/ColourSelection.h
index c218644..fc1c808 100644
--- a/src/visualisers/ColourSelection.h
+++ b/src/visualisers/ColourSelection.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourSelection.h
\brief Definition of the Template class ColourSelection.
diff --git a/src/visualisers/ColourSelectionCount.cc b/src/visualisers/ColourSelectionCount.cc
index c2e79cd..5aeef3a 100644
--- a/src/visualisers/ColourSelectionCount.cc
+++ b/src/visualisers/ColourSelectionCount.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourSelectionCount.cc
\brief Implementation of the Template class ColourSelectionCount.
diff --git a/src/visualisers/ColourSelectionCount.h b/src/visualisers/ColourSelectionCount.h
index 5f3b244..474dab4 100644
--- a/src/visualisers/ColourSelectionCount.h
+++ b/src/visualisers/ColourSelectionCount.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourSelectionCount.h
\brief Definition of the Template class ColourSelectionCount.
diff --git a/src/visualisers/ColourSelectionList.cc b/src/visualisers/ColourSelectionList.cc
index fee682d..fb40a48 100644
--- a/src/visualisers/ColourSelectionList.cc
+++ b/src/visualisers/ColourSelectionList.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourSelectionList.cc
\brief Implementation of the Template class ColourSelectionList.
diff --git a/src/visualisers/ColourSelectionList.h b/src/visualisers/ColourSelectionList.h
index 8dcb65f..85b584d 100644
--- a/src/visualisers/ColourSelectionList.h
+++ b/src/visualisers/ColourSelectionList.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourSelectionList.h
\brief Definition of the Template class ColourSelectionList.
diff --git a/src/visualisers/ColourTechnique.cc b/src/visualisers/ColourTechnique.cc
index b340e5c..ff57140 100644
--- a/src/visualisers/ColourTechnique.cc
+++ b/src/visualisers/ColourTechnique.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTechnique.cc
\brief Implementation of the Template class ColourTechnique.
diff --git a/src/visualisers/ColourTechnique.h b/src/visualisers/ColourTechnique.h
index ddaa93c..1cd3b82 100644
--- a/src/visualisers/ColourTechnique.h
+++ b/src/visualisers/ColourTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ColourTechnique.h
\brief Definition of the Template class ColourTechnique.
diff --git a/src/visualisers/Contour.cc b/src/visualisers/Contour.cc
index 43e3b60..173c26e 100644
--- a/src/visualisers/Contour.cc
+++ b/src/visualisers/Contour.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Contour.cc
\brief Implementation of the Template class Contour.
diff --git a/src/visualisers/Contour.h b/src/visualisers/Contour.h
index 8e71906..2327b75 100644
--- a/src/visualisers/Contour.h
+++ b/src/visualisers/Contour.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Contour.h
\brief Definition of the Template class Contour.
diff --git a/src/visualisers/ContourLibrary.cc b/src/visualisers/ContourLibrary.cc
index ff3583c..744c3ca 100644
--- a/src/visualisers/ContourLibrary.cc
+++ b/src/visualisers/ContourLibrary.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file ContourLibrary.cc
\brief Implementation of the Template class ContourLibrary.
diff --git a/src/visualisers/ContourLibrary.h b/src/visualisers/ContourLibrary.h
index 9de3aab..afb37d7 100644
--- a/src/visualisers/ContourLibrary.h
+++ b/src/visualisers/ContourLibrary.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file ContourLibrary.h
\brief Definition of the Template class ContourLibrary.
diff --git a/src/visualisers/ContourMethod.h b/src/visualisers/ContourMethod.h
index a22bdb9..4e8353e 100644
--- a/src/visualisers/ContourMethod.h
+++ b/src/visualisers/ContourMethod.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ContourMethod.h
\brief Definition of the Template class ContourMethod.
diff --git a/src/visualisers/CountSelectionType.cc b/src/visualisers/CountSelectionType.cc
index 0ebc193..f4734ac 100644
--- a/src/visualisers/CountSelectionType.cc
+++ b/src/visualisers/CountSelectionType.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file
.cc
diff --git a/src/visualisers/CountSelectionType.h b/src/visualisers/CountSelectionType.h
index 3b649ba..ec23039 100644
--- a/src/visualisers/CountSelectionType.h
+++ b/src/visualisers/CountSelectionType.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file CountSelectionType.h
\brief Definition of the Template class CountSelectionType.
diff --git a/src/visualisers/Curve.cc b/src/visualisers/Curve.cc
index c05206b..dcca3e1 100644
--- a/src/visualisers/Curve.cc
+++ b/src/visualisers/Curve.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Curve.cc
\brief Implementation of the Template class Curve.
diff --git a/src/visualisers/Curve.h b/src/visualisers/Curve.h
index 2f45959..f65184c 100644
--- a/src/visualisers/Curve.h
+++ b/src/visualisers/Curve.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Curve.h
\brief Definition of the Template class Curve.
diff --git a/src/visualisers/DateAxis.cc b/src/visualisers/DateAxis.cc
index 5b908ac..821caed 100644
--- a/src/visualisers/DateAxis.cc
+++ b/src/visualisers/DateAxis.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file DateAxisMethod.cc
\brief Implementation of the Template class DateAxisMethod.
diff --git a/src/visualisers/DateAxis.h b/src/visualisers/DateAxis.h
index 0cdd226..35b3f1a 100644
--- a/src/visualisers/DateAxis.h
+++ b/src/visualisers/DateAxis.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file DateAxisMethod.h
\brief Definition of the Template class DateAxisMethod.
diff --git a/src/visualisers/DefinitionTable.h b/src/visualisers/DefinitionTable.h
index 516161d..9183885 100644
--- a/src/visualisers/DefinitionTable.h
+++ b/src/visualisers/DefinitionTable.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef DefinitionTable_H
#define DefinitionTable_H
diff --git a/src/visualisers/DefinitionTable.hcc b/src/visualisers/DefinitionTable.hcc
index 3087c1f..844a276 100644
--- a/src/visualisers/DefinitionTable.hcc
+++ b/src/visualisers/DefinitionTable.hcc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LocalTable.cc
\brief Implementation of the Template class LocalTable.
diff --git a/src/visualisers/DotPolyShadingMethod.h b/src/visualisers/DotPolyShadingMethod.h
index 5d96302..5ac45b9 100644
--- a/src/visualisers/DotPolyShadingMethod.h
+++ b/src/visualisers/DotPolyShadingMethod.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file DotPolyShadingMethod.h
\brief Definition of the Template class DotPolyShadingMethod.
diff --git a/src/visualisers/EpsForecastPlot.h b/src/visualisers/EpsForecastPlot.h
index b73b5d7..6e552fe 100644
--- a/src/visualisers/EpsForecastPlot.h
+++ b/src/visualisers/EpsForecastPlot.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file EpsForecastPlot.h
\brief Definition of the Template class EpsForecastPlot.
diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc
index 7088769..95edd85 100644
--- a/src/visualisers/EpsGraph.cc
+++ b/src/visualisers/EpsGraph.cc
@@ -1,21 +1,12 @@
-
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHvisitor WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file EpsGraph.cc
\brief Implementation of the Template class EpsGraph.
diff --git a/src/visualisers/EpsGraph.h b/src/visualisers/EpsGraph.h
index 3c77f78..5860774 100644
--- a/src/visualisers/EpsGraph.h
+++ b/src/visualisers/EpsGraph.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file EpsGraph.h
\brief Definition of the Template class EpsGraph.
diff --git a/src/visualisers/EquidistantTableMode.cc b/src/visualisers/EquidistantTableMode.cc
index 57f6aff..133aa3d 100644
--- a/src/visualisers/EquidistantTableMode.cc
+++ b/src/visualisers/EquidistantTableMode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file EquidistantTableMode.cc
\brief Implementation of the Template class EquidistantTableMode.
diff --git a/src/visualisers/EquidistantTableMode.h b/src/visualisers/EquidistantTableMode.h
index 062912b..80b5cd4 100644
--- a/src/visualisers/EquidistantTableMode.h
+++ b/src/visualisers/EquidistantTableMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file EquidistantTableMode.h
\brief Definition of the Template class EquidistantTableMode.
diff --git a/src/visualisers/Filter.cc b/src/visualisers/Filter.cc
index 2ea8545..2163fa1 100644
--- a/src/visualisers/Filter.cc
+++ b/src/visualisers/Filter.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Filter.cc
Implementation of Filter class.
diff --git a/src/visualisers/Filter.h b/src/visualisers/Filter.h
index 588bf53..706e1c1 100644
--- a/src/visualisers/Filter.h
+++ b/src/visualisers/Filter.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Filter.h
\brief Definition of the Template class Filter.
diff --git a/src/visualisers/FlagPlotting.cc b/src/visualisers/FlagPlotting.cc
index d16dd04..2eaef19 100644
--- a/src/visualisers/FlagPlotting.cc
+++ b/src/visualisers/FlagPlotting.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file WindPlotting.cc
\brief Implementation of the Template class Wind.
diff --git a/src/visualisers/FlagPlotting.h b/src/visualisers/FlagPlotting.h
index d8c59a6..59b63d5 100644
--- a/src/visualisers/FlagPlotting.h
+++ b/src/visualisers/FlagPlotting.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file FlagPlotting.h
\brief Definition of the Template class FlagPlotting.
diff --git a/src/visualisers/FloatSelection.cc b/src/visualisers/FloatSelection.cc
index cf96072..c58a020 100644
--- a/src/visualisers/FloatSelection.cc
+++ b/src/visualisers/FloatSelection.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file FloatSelection.cc
\brief Implementation of the Template class FloatSelection.
diff --git a/src/visualisers/FloatSelection.h b/src/visualisers/FloatSelection.h
index 38ca374..93f1844 100644
--- a/src/visualisers/FloatSelection.h
+++ b/src/visualisers/FloatSelection.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file FloatSelection.h
\brief Definition of the Template class FloatSelection.
diff --git a/src/visualisers/Graph.h b/src/visualisers/Graph.h
index bbe95f4..8a264a6 100644
--- a/src/visualisers/Graph.h
+++ b/src/visualisers/Graph.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Graph.h
\brief Definition of the Template class Graph.
diff --git a/src/visualisers/GraphPlotting.cc b/src/visualisers/GraphPlotting.cc
index b5c145e..ba7c0b8 100644
--- a/src/visualisers/GraphPlotting.cc
+++ b/src/visualisers/GraphPlotting.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GraphPlotting.cc
\brief Implementation of the Template class GraphPlotting.
diff --git a/src/visualisers/GraphPlotting.h b/src/visualisers/GraphPlotting.h
index a1362a7..633fee7 100644
--- a/src/visualisers/GraphPlotting.h
+++ b/src/visualisers/GraphPlotting.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GraphPlotting.h
\brief Definition of the Template class GraphPlotting.
diff --git a/src/visualisers/GraphShade.cc b/src/visualisers/GraphShade.cc
index 008211c..36b4e8d 100644
--- a/src/visualisers/GraphShade.cc
+++ b/src/visualisers/GraphShade.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GraphShade.cc
\brief Implementation of the Template class GraphShade.
diff --git a/src/visualisers/GraphShade.h b/src/visualisers/GraphShade.h
index 5f7c415..8aac6d0 100644
--- a/src/visualisers/GraphShade.h
+++ b/src/visualisers/GraphShade.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GraphShade.h
\brief Definition of the Template class GraphShade.
diff --git a/src/visualisers/GraphShadeStyle.cc b/src/visualisers/GraphShadeStyle.cc
index 107a306..cefe014 100644
--- a/src/visualisers/GraphShadeStyle.cc
+++ b/src/visualisers/GraphShadeStyle.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GraphShadeStyle.cc
\brief Implementation of the Template class GraphShadeStyle.
diff --git a/src/visualisers/GraphShadeStyle.h b/src/visualisers/GraphShadeStyle.h
index 64d5a39..af40d99 100644
--- a/src/visualisers/GraphShadeStyle.h
+++ b/src/visualisers/GraphShadeStyle.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GraphShadeStyle.h
\brief Definition of the Template class GraphShadeStyle.
diff --git a/src/visualisers/GribTables.h b/src/visualisers/GribTables.h
index 5ef29c1..7744976 100644
--- a/src/visualisers/GribTables.h
+++ b/src/visualisers/GribTables.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GribTables.h
\brief Definition of the Template class GribTables.
diff --git a/src/visualisers/GridPlotting.cc b/src/visualisers/GridPlotting.cc
index 9673fee..8c9d8c7 100644
--- a/src/visualisers/GridPlotting.cc
+++ b/src/visualisers/GridPlotting.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GridPlotting.cc
\brief Implementation of the Template class GridPlotting.
diff --git a/src/visualisers/GridPlotting.h b/src/visualisers/GridPlotting.h
index 6edd6a8..f12c060 100644
--- a/src/visualisers/GridPlotting.h
+++ b/src/visualisers/GridPlotting.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file GridPlotting.h
\brief Definition of the Template class GridPlotting.
diff --git a/src/visualisers/HatchPolyShadingMethod.h b/src/visualisers/HatchPolyShadingMethod.h
index 925660b..3f48fbc 100644
--- a/src/visualisers/HatchPolyShadingMethod.h
+++ b/src/visualisers/HatchPolyShadingMethod.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HatchPolyShadingMethod.h
\brief Definition of the Template class HatchPolyShadingMethod.
diff --git a/src/visualisers/HeightSelection.cc b/src/visualisers/HeightSelection.cc
index 9b50745..acfcf97 100644
--- a/src/visualisers/HeightSelection.cc
+++ b/src/visualisers/HeightSelection.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HeightSelection.cc
\brief Implementation of the Template class HeightSelection.
diff --git a/src/visualisers/HeightSelection.h b/src/visualisers/HeightSelection.h
index 58dbd8f..2f1be49 100644
--- a/src/visualisers/HeightSelection.h
+++ b/src/visualisers/HeightSelection.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HeightSelection.h
\brief Definition of the Template class HeightSelection.
diff --git a/src/visualisers/HeightSelectionCount.h b/src/visualisers/HeightSelectionCount.h
index 054d66d..7961c2e 100644
--- a/src/visualisers/HeightSelectionCount.h
+++ b/src/visualisers/HeightSelectionCount.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HeightSelectionCount.h
\brief Definition of the Template class HeightSelectionCount.
diff --git a/src/visualisers/HeightSelectionList.h b/src/visualisers/HeightSelectionList.h
index ca7d9f6..ee79272 100644
--- a/src/visualisers/HeightSelectionList.h
+++ b/src/visualisers/HeightSelectionList.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HeightSelectionList.h
\brief Definition of the Template class HeightSelectionList.
diff --git a/src/visualisers/HeightTechnique.cc b/src/visualisers/HeightTechnique.cc
index 2a2ef24..5e2d035 100644
--- a/src/visualisers/HeightTechnique.cc
+++ b/src/visualisers/HeightTechnique.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HeightSelection.cc
\brief Implementation of the Template class HeightSelection.
diff --git a/src/visualisers/HeightTechnique.h b/src/visualisers/HeightTechnique.h
index 29db47f..da71f1a 100644
--- a/src/visualisers/HeightTechnique.h
+++ b/src/visualisers/HeightTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HeightSelection.h
\brief Definition of the Template class HeightSelection.
diff --git a/src/visualisers/HiLo.cc b/src/visualisers/HiLo.cc
index 2d779c3..353cc4d 100644
--- a/src/visualisers/HiLo.cc
+++ b/src/visualisers/HiLo.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HiLo.cc
\brief Implementation of the Template class HiLo.
diff --git a/src/visualisers/HiLo.h b/src/visualisers/HiLo.h
index dd9b81e..f87b676 100644
--- a/src/visualisers/HiLo.h
+++ b/src/visualisers/HiLo.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HiLo.h
\brief Definition of the Template class HiLo.
diff --git a/src/visualisers/HiLoBase.h b/src/visualisers/HiLoBase.h
index 4715ecc..0e9c98f 100644
--- a/src/visualisers/HiLoBase.h
+++ b/src/visualisers/HiLoBase.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HiLoBase.h
\brief Definition of the Template class HiLoBase.
diff --git a/src/visualisers/HiLoBoth.h b/src/visualisers/HiLoBoth.h
index 5fa898e..93351c3 100644
--- a/src/visualisers/HiLoBoth.h
+++ b/src/visualisers/HiLoBoth.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HiLoBoth.h
\brief Definition of the Template class HiLoBoth.
diff --git a/src/visualisers/HiLoMarker.h b/src/visualisers/HiLoMarker.h
index c20ab6f..d478ec8 100644
--- a/src/visualisers/HiLoMarker.h
+++ b/src/visualisers/HiLoMarker.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HiLoMarker.h
\brief Definition of the Template class HiLoMarker.
diff --git a/src/visualisers/HiLoMarkerBase.h b/src/visualisers/HiLoMarkerBase.h
index 3b05133..d50197c 100644
--- a/src/visualisers/HiLoMarkerBase.h
+++ b/src/visualisers/HiLoMarkerBase.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HiLoMarkerBase.h
\brief Definition of the Template class HiLoMarkerBase.
diff --git a/src/visualisers/HiLoNumber.h b/src/visualisers/HiLoNumber.h
index 58f3c28..8ac79b9 100644
--- a/src/visualisers/HiLoNumber.h
+++ b/src/visualisers/HiLoNumber.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HiLoNumber.h
\brief Definition of the Template class HiLoNumber.
diff --git a/src/visualisers/HiLoTechnique.h b/src/visualisers/HiLoTechnique.h
index 38dbab0..b39275f 100644
--- a/src/visualisers/HiLoTechnique.h
+++ b/src/visualisers/HiLoTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HiLoTechnique.h
\brief Definition of the Template class HiLoTechnique.
diff --git a/src/visualisers/HiLoText.h b/src/visualisers/HiLoText.h
index 67d93a2..d73571c 100644
--- a/src/visualisers/HiLoText.h
+++ b/src/visualisers/HiLoText.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HiLoText.h
\brief Definition of the Template class HiLoText.
diff --git a/src/visualisers/HistoIndividualMode.h b/src/visualisers/HistoIndividualMode.h
index 47b423e..ad20a63 100644
--- a/src/visualisers/HistoIndividualMode.h
+++ b/src/visualisers/HistoIndividualMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HistoIndividualMode.h
\brief Definition of the Template class HistoIndividualMode.
diff --git a/src/visualisers/HistoMode.h b/src/visualisers/HistoMode.h
index 3ce48e6..02a1d54 100644
--- a/src/visualisers/HistoMode.h
+++ b/src/visualisers/HistoMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HistoMode.h
\brief Definition of the Template class HistoMode.
diff --git a/src/visualisers/HistoTableMode.h b/src/visualisers/HistoTableMode.h
index 2da850d..7ab068b 100644
--- a/src/visualisers/HistoTableMode.h
+++ b/src/visualisers/HistoTableMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HistoTableMode.h
\brief Definition of the Template class HistoTableMode.
diff --git a/src/visualisers/Histogram.cc b/src/visualisers/Histogram.cc
index 238d747..07bcf81 100644
--- a/src/visualisers/Histogram.cc
+++ b/src/visualisers/Histogram.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Histogram.cc
\brief Implementation of the Template class Histogram.
diff --git a/src/visualisers/Histogram.h b/src/visualisers/Histogram.h
index 42771f5..bf31676 100644
--- a/src/visualisers/Histogram.h
+++ b/src/visualisers/Histogram.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Histogram.h
\brief Definition of the Template class Histogram.
diff --git a/src/visualisers/ImageCalculateColourTechnique.h b/src/visualisers/ImageCalculateColourTechnique.h
index bbbac32..a81fafc 100644
--- a/src/visualisers/ImageCalculateColourTechnique.h
+++ b/src/visualisers/ImageCalculateColourTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ImageCalculateColourTechnique.h
\brief Definition of the Template class ImageCalculateColourTechnique.
diff --git a/src/visualisers/ImageListColourTechnique.h b/src/visualisers/ImageListColourTechnique.h
index cfafbd4..189bb1e 100644
--- a/src/visualisers/ImageListColourTechnique.h
+++ b/src/visualisers/ImageListColourTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ImageListColourTechnique.h
\brief Definition of the Template class ImageListColourTechnique.
diff --git a/src/visualisers/ImportPlot.h b/src/visualisers/ImportPlot.h
index 93092e4..b06c463 100644
--- a/src/visualisers/ImportPlot.h
+++ b/src/visualisers/ImportPlot.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ImportPlot.h
\brief Definition of the Template class ImportPlot.
diff --git a/src/visualisers/IntervalSelectionType.cc b/src/visualisers/IntervalSelectionType.cc
index c09877e..6c3cf66 100644
--- a/src/visualisers/IntervalSelectionType.cc
+++ b/src/visualisers/IntervalSelectionType.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file IntervalSelectionType.cc
\brief Implementation of the Template class IntervalSelectionType.
diff --git a/src/visualisers/IntervalSelectionType.h b/src/visualisers/IntervalSelectionType.h
index aaddfcb..2ccfb32 100644
--- a/src/visualisers/IntervalSelectionType.h
+++ b/src/visualisers/IntervalSelectionType.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file IntervalSelectionType.h
\brief Definition of the Template class IntervalSelectionType.
diff --git a/src/visualisers/Intervals.h b/src/visualisers/Intervals.h
index 9965c7c..43677fe 100644
--- a/src/visualisers/Intervals.h
+++ b/src/visualisers/Intervals.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Intervals.h
\brief Definition of the Template class Intervals.
diff --git a/src/visualisers/IsoHelper.cc b/src/visualisers/IsoHelper.cc
index 853893a..741e74a 100644
--- a/src/visualisers/IsoHelper.cc
+++ b/src/visualisers/IsoHelper.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file IsoHelper.cc
\brief Implementation of the Template class IsoHelper.
diff --git a/src/visualisers/IsoHelper.h b/src/visualisers/IsoHelper.h
index 7a74bbc..3bab146 100644
--- a/src/visualisers/IsoHelper.h
+++ b/src/visualisers/IsoHelper.h
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
/*! \file IsoHelper.h
\brief Definition of the Template class IsoHelper.
diff --git a/src/visualisers/IsoHighlight.h b/src/visualisers/IsoHighlight.h
index cafba4f..98845ce 100644
--- a/src/visualisers/IsoHighlight.h
+++ b/src/visualisers/IsoHighlight.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file IsoHighlight.h
\brief Definition of the Template class IsoHighlight.
diff --git a/src/visualisers/IsoLabel.cc b/src/visualisers/IsoLabel.cc
index 2d426a3..9f03e09 100644
--- a/src/visualisers/IsoLabel.cc
+++ b/src/visualisers/IsoLabel.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file IsoLabel.cc
\brief Implementation of the Template class IsoLabel.
diff --git a/src/visualisers/IsoLabel.h b/src/visualisers/IsoLabel.h
index 6092b49..91126bf 100644
--- a/src/visualisers/IsoLabel.h
+++ b/src/visualisers/IsoLabel.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file IsoLabel.h
\brief Definition of the Template class IsoLabel.
diff --git a/src/visualisers/IsoPlot.cc b/src/visualisers/IsoPlot.cc
index 3962028..dfc9fd9 100644
--- a/src/visualisers/IsoPlot.cc
+++ b/src/visualisers/IsoPlot.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file IsoPlot.cc
\brief Implementation of the Template class IsoPlot.
@@ -1344,8 +1336,15 @@ void IsoPlot::isoline(MatrixHandler& data, BasicGraphicsObjectContainer& parent)
void IsoPlot::operator()(MatrixHandler& data, BasicGraphicsObjectContainer& parent)
{
prepare(data);
- if ( legend_only_ ) return;
-
+ if ( legend_only_ ) {
+ if ( rainbow_ ) {
+ rainbowMethod_->set(*this);
+ rainbowMethod_->prepare(*levelSelection_, true);
+ setThicknessAndStyle();
+ }
+ return;
+ }
+
{
Timer timer("contouring", "Time spent in contouring");
isoline(data, parent);
@@ -1471,8 +1470,8 @@ void IsoPlot::visit(Data& data, LegendVisitor& legend) {
line->setColour((*rainbowMethod_)(*level));
line->setLineStyle(line_style(*level));
- line->setThickness(thickness(*level));
- legend.add(new LineEntry(*level, line));
+ line->setThickness(thickness(*level)*5);
+ legend.add(new RainbowEntry(*level, line));
}
break;
}
diff --git a/src/visualisers/IsoPlot.h b/src/visualisers/IsoPlot.h
index e41a10e..5b268b7 100644
--- a/src/visualisers/IsoPlot.h
+++ b/src/visualisers/IsoPlot.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file IsoPlot.h
\brief Definition of the Template class IsoPlot.
diff --git a/src/visualisers/IsoShading.cc b/src/visualisers/IsoShading.cc
index f4d6f51..c45b933 100644
--- a/src/visualisers/IsoShading.cc
+++ b/src/visualisers/IsoShading.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file IsoShading.cc
\brief Implementation of the Template class IsoShading.
diff --git a/src/visualisers/IsoShading.h b/src/visualisers/IsoShading.h
index 8acc959..2fe0302 100644
--- a/src/visualisers/IsoShading.h
+++ b/src/visualisers/IsoShading.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file IsoShading.h
\brief Definition of the Template class IsoShading.
diff --git a/src/visualisers/LabelPlotting.cc b/src/visualisers/LabelPlotting.cc
index 116d4de..f1bf790 100644
--- a/src/visualisers/LabelPlotting.cc
+++ b/src/visualisers/LabelPlotting.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LabelPlotting.cc
\brief Implementation of the Template class LabelPlotting.
diff --git a/src/visualisers/LabelPlotting.h b/src/visualisers/LabelPlotting.h
index 4583d4f..885b196 100644
--- a/src/visualisers/LabelPlotting.h
+++ b/src/visualisers/LabelPlotting.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LabelPlotting.h
\brief Definition of the Template class LabelPlotting.
diff --git a/src/visualisers/LabelPlottingBase.h b/src/visualisers/LabelPlottingBase.h
index 7e3a271..d19b2a9 100644
--- a/src/visualisers/LabelPlottingBase.h
+++ b/src/visualisers/LabelPlottingBase.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LabelPlottingBase.h
\brief Definition of the Template class LabelPlottingBase.
diff --git a/src/visualisers/LegendMethod.cc b/src/visualisers/LegendMethod.cc
index 69b93d6..07ad5f1 100644
--- a/src/visualisers/LegendMethod.cc
+++ b/src/visualisers/LegendMethod.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LegendMethod.cc
\brief Implementation of the Template class LegendMethod.
@@ -79,12 +71,12 @@ void ContinuousLegendMethod::row(LegendEntry& entry, double x, double y, Text& l
entry.notext();
PaperPoint middle(x, y);
entry.rowBox(middle, task);
-
- if ( entry.needContinuousText() ) {
- legend.setJustification(MLEFT);
- middle.y_ -= 0.5;
- legend.push_back(middle); // We attach the text on the top middle of the symbol!
- }
+ if ( labelCount_ % label_frequency_ == 0 )
+ if ( entry.needContinuousText(legend) ) {
+
+ middle.y_ -= 0.5;
+ legend.push_back(middle); // We attach the text on the top middle of the symbol!
+ }
labelCount_++;
}
@@ -94,10 +86,12 @@ void ContinuousLegendMethod::column(LegendEntry& entry, double x, double y, Text
if ( labelCount_ % label_frequency_ != 0 )
entry.notext();
entry.columnBox(PaperPoint(x, y), task);
- if ( entry.needContinuousText() ) {
- legend.setJustification(MLEFT);
- legend.push_back(PaperPoint(x+0.25, y)); // WE attach the text on the right of the sumbol!
- }
+ if ( labelCount_ % label_frequency_ == 0 )
+
+ if ( entry.needContinuousText(legend) ) {
+
+ legend.push_back(PaperPoint(x+0.25, y)); // WE attach the text on the right of the sumbol!
+ }
labelCount_++;
}
void HistogramLegendMethod::row(LegendEntry& entry, double x, double y, Text&, BasicGraphicsObjectContainer& out)
diff --git a/src/visualisers/LegendMethod.h b/src/visualisers/LegendMethod.h
index b8571c4..35961c0 100644
--- a/src/visualisers/LegendMethod.h
+++ b/src/visualisers/LegendMethod.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LegendMethod.h
\brief Definition of the Template class LegendMethod.
diff --git a/src/visualisers/LevelListSelectionType.cc b/src/visualisers/LevelListSelectionType.cc
index e32223c..8c5e29a 100644
--- a/src/visualisers/LevelListSelectionType.cc
+++ b/src/visualisers/LevelListSelectionType.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LevelListSelectionType.cc
\brief Implementation of the Template class LevelListSelectionType.
diff --git a/src/visualisers/LevelListSelectionType.h b/src/visualisers/LevelListSelectionType.h
index a3dd44d..892caa3 100644
--- a/src/visualisers/LevelListSelectionType.h
+++ b/src/visualisers/LevelListSelectionType.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LevelListSelectionType.h
\brief Definition of the Template class LevelListSelectionType.
diff --git a/src/visualisers/LevelSelection.cc b/src/visualisers/LevelSelection.cc
index 02de7e0..71b194b 100644
--- a/src/visualisers/LevelSelection.cc
+++ b/src/visualisers/LevelSelection.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LevelSelection.cc
\brief Implementation of the Template class LevelSelection.
diff --git a/src/visualisers/LevelSelection.h b/src/visualisers/LevelSelection.h
index 5eb8a71..9411bb5 100644
--- a/src/visualisers/LevelSelection.h
+++ b/src/visualisers/LevelSelection.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LevelSelection.h
\brief Definition of the Template class LevelSelection.
diff --git a/src/visualisers/LinearTableMode.cc b/src/visualisers/LinearTableMode.cc
index 1ffec95..84528c5 100644
--- a/src/visualisers/LinearTableMode.cc
+++ b/src/visualisers/LinearTableMode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LinearTableMode.cc
\brief Implementation of the Template class LinearTableMode.
diff --git a/src/visualisers/LinearTableMode.h b/src/visualisers/LinearTableMode.h
index 1193593..25ec063 100644
--- a/src/visualisers/LinearTableMode.h
+++ b/src/visualisers/LinearTableMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LinearTableMode.h
\brief Definition of the Template class LinearTableMode.
diff --git a/src/visualisers/ListColourTechnique.cc b/src/visualisers/ListColourTechnique.cc
index ae47910..680886c 100644
--- a/src/visualisers/ListColourTechnique.cc
+++ b/src/visualisers/ListColourTechnique.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ListColourTechnique.cc
\brief Implementation of the Template class ListColourTechnique.
diff --git a/src/visualisers/ListColourTechnique.h b/src/visualisers/ListColourTechnique.h
index 6fe2c67..2d33d2a 100644
--- a/src/visualisers/ListColourTechnique.h
+++ b/src/visualisers/ListColourTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ListColourTechnique.h
\brief Definition of the Template class ListColourTechnique.
diff --git a/src/visualisers/LookupTableMode.cc b/src/visualisers/LookupTableMode.cc
index 07173c0..2c612e3 100644
--- a/src/visualisers/LookupTableMode.cc
+++ b/src/visualisers/LookupTableMode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LookupTableMode.cc
\brief Implementation of the Template class LookupTableMode.
diff --git a/src/visualisers/LookupTableMode.h b/src/visualisers/LookupTableMode.h
index 61abcc3..76ec427 100644
--- a/src/visualisers/LookupTableMode.h
+++ b/src/visualisers/LookupTableMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file LookupTableMode.h
\brief Definition of the Template class LookupTableMode.
diff --git a/src/visualisers/MarkerSelection.h b/src/visualisers/MarkerSelection.h
index d179178..4435b20 100644
--- a/src/visualisers/MarkerSelection.h
+++ b/src/visualisers/MarkerSelection.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MarkerSelection.h
\brief Definition of the Template class MarkerSelection.
diff --git a/src/visualisers/MarkerSelectionCount.h b/src/visualisers/MarkerSelectionCount.h
index 56fb0a1..3ac83f0 100644
--- a/src/visualisers/MarkerSelectionCount.h
+++ b/src/visualisers/MarkerSelectionCount.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MarkerSelectionCount.h
\brief Definition of the Template class MarkerSelectionCount.
diff --git a/src/visualisers/MarkerSelectionList.h b/src/visualisers/MarkerSelectionList.h
index 1dfc8ed..73ef676 100644
--- a/src/visualisers/MarkerSelectionList.h
+++ b/src/visualisers/MarkerSelectionList.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MarkerSelectionList.h
\brief Definition of the Template class MarkerSelectionList.
diff --git a/src/visualisers/MarkerShadingTechnique.cc b/src/visualisers/MarkerShadingTechnique.cc
index 0bb021d..8d203d8 100644
--- a/src/visualisers/MarkerShadingTechnique.cc
+++ b/src/visualisers/MarkerShadingTechnique.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MarkerShadingTechnique.cc
\brief Implementation of the Template class MarkerShadingTechnique.
diff --git a/src/visualisers/MarkerShadingTechnique.h b/src/visualisers/MarkerShadingTechnique.h
index c16fbd4..5e111f3 100644
--- a/src/visualisers/MarkerShadingTechnique.h
+++ b/src/visualisers/MarkerShadingTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MarkerShadingTechnique.h
\brief Definition of the Template class MarkerShadingTechnique.
diff --git a/src/visualisers/MarkerValuePlotMethod.h b/src/visualisers/MarkerValuePlotMethod.h
index f380da2..f3fd4d0 100644
--- a/src/visualisers/MarkerValuePlotMethod.h
+++ b/src/visualisers/MarkerValuePlotMethod.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MarkerValuePlotMethod.h
\brief Definition of the Template class MarkerValuePlotMethod.
diff --git a/src/visualisers/MetgramGraph.cc b/src/visualisers/MetgramGraph.cc
index f90d976..9b34cef 100644
--- a/src/visualisers/MetgramGraph.cc
+++ b/src/visualisers/MetgramGraph.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MetgramGraph.cc
\brief Implementation of the Template class MetgramGraph.
diff --git a/src/visualisers/MetgramGraph.h b/src/visualisers/MetgramGraph.h
index 3d33c3e..4a29593 100644
--- a/src/visualisers/MetgramGraph.h
+++ b/src/visualisers/MetgramGraph.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MetgramGraph.h
\brief Definition of the Template class MetgramGraph.
diff --git a/src/visualisers/MetgramStyle.cc b/src/visualisers/MetgramStyle.cc
index c802057..8acaf29 100644
--- a/src/visualisers/MetgramStyle.cc
+++ b/src/visualisers/MetgramStyle.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MetgramStyle.cc
\brief Implementation of the Template class MetgramStyle.
diff --git a/src/visualisers/MetgramStyle.h b/src/visualisers/MetgramStyle.h
index 7b4f70a..f4e1a3c 100644
--- a/src/visualisers/MetgramStyle.h
+++ b/src/visualisers/MetgramStyle.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MetgramStyle.h
\brief Definition of the Template class MetgramStyle.
diff --git a/src/visualisers/NormalTableMode.cc b/src/visualisers/NormalTableMode.cc
index d903cfe..7cdebc1 100644
--- a/src/visualisers/NormalTableMode.cc
+++ b/src/visualisers/NormalTableMode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NormalTableMode.h
\brief Implementation of the Template class NormalTableMode.
diff --git a/src/visualisers/NormalTableMode.h b/src/visualisers/NormalTableMode.h
index 2d399f2..9374ce5 100644
--- a/src/visualisers/NormalTableMode.h
+++ b/src/visualisers/NormalTableMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file NormalTableMode.cc
\brief Definition of the Template class NormalTableMode.
diff --git a/src/visualisers/ObsItem.h b/src/visualisers/ObsItem.h
index 37c0dcc..03781e0 100644
--- a/src/visualisers/ObsItem.h
+++ b/src/visualisers/ObsItem.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ObsItem.h
\brief Definition of the Template class ObsItem.
diff --git a/src/visualisers/ObsItemFamily.cc b/src/visualisers/ObsItemFamily.cc
index 51dd06a..03e5633 100644
--- a/src/visualisers/ObsItemFamily.cc
+++ b/src/visualisers/ObsItemFamily.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ObsItemFamily.cc
\brief Implementation of the Template class ObsItemfamily.
@@ -146,7 +138,7 @@ void ObsCloudAndWind::operator()( CustomisedPoint& point, ComplexSymbol& symbol)
origin = marker != origins_.end() ? marker->second : "magics_13";
}
-
+
CustomisedPoint::const_iterator ispeed = point.find("wind_speed");
double speed = ( ispeed == point.end() ) ? 0 : ispeed->second;
CustomisedPoint::const_iterator idirection = point.find("wind_direction");
@@ -164,7 +156,7 @@ void ObsCloudAndWind::operator()( CustomisedPoint& point, ComplexSymbol& symbol)
object->symbol(origin);
- object->height(owner_->ring_size_*.35);
+ object->height(owner_->ring_size_*0.5);
symbol.add(object);
return;
@@ -173,7 +165,7 @@ void ObsCloudAndWind::operator()( CustomisedPoint& point, ComplexSymbol& symbol)
FlagItem* flag = new FlagItem();
flag->setColour(colour);
flag->length(owner_->size_*2.5); // Size to be adjusted later!
-
+ flag->thickness(1.5);
@@ -182,7 +174,7 @@ void ObsCloudAndWind::operator()( CustomisedPoint& point, ComplexSymbol& symbol)
<< "\n\twind_direction: " << point["wind_direction"]
<< "\n\tcloud amount: " << point["total_cloud"]<< "--->" << total_cloud << "--->" << origin << std::endl;
- flag->setOriginHeight(owner_->ring_size_);
+ flag->setOriginHeight(owner_->ring_size_ * 1.75);
flag->setOriginMarker(origin);
flag->x(0);
flag->y(0);
@@ -304,6 +296,7 @@ void ObsPressureTendency::operator()(CustomisedPoint& point, ComplexSymbol& symb
value = point.find("pressure_tendency_characteristic");
if ( value == point.end() ) return;
SymbolItem* tendancy = new SymbolItem();
+
tendancy->x(column_+1);
tendancy->y(row_);
@@ -314,7 +307,7 @@ void ObsPressureTendency::operator()(CustomisedPoint& point, ComplexSymbol& symb
MagLog::debug() << "\tPressure tendency--->" << oss.str() << "\n";
- tendancy->height(owner_->size_*0.2); // A bit too big !
+ tendancy->height(owner_->size_* 0.8); // A bit too big !
symbol.add(tendancy);
}
@@ -712,7 +705,7 @@ void ObsPastWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol)
MagLog::debug() << "\tPast Weather 1-> " << ww->second << "\n";
- object->height(owner_->size_);
+ object->height(owner_->size_*.75);
symbol.add(object);
}
//second past weather
@@ -730,7 +723,7 @@ void ObsPastWeather::operator()(CustomisedPoint& point, ComplexSymbol& symbol)
MagLog::debug() << "\tPast Weather 2-> " << ww->second << "\n";
- object2->height(owner_->size_);
+ object2->height(owner_->size_*.75);
symbol.add(object2);
}
@@ -846,7 +839,7 @@ void ObsCloud::operator()(CustomisedPoint& point, ComplexSymbol& symbol) const
MagFont font;
font.name("sansserif");
font.colour(*owner_->low_colour_);
- font.size(owner_->size_* 0.8);
+ font.size(owner_->size_* 0.9);
MagLog::debug() << "\tLow Cloud--->" << nh.str() << "\n";
object->text(nh.str());
diff --git a/src/visualisers/ObsItemFamily.h b/src/visualisers/ObsItemFamily.h
index fc599dd..e21f239 100644
--- a/src/visualisers/ObsItemFamily.h
+++ b/src/visualisers/ObsItemFamily.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef ObsItemFamily_H
#define ObsItemFamily_H
diff --git a/src/visualisers/ObsPlotting.cc b/src/visualisers/ObsPlotting.cc
index 05e4add..89004cd 100644
--- a/src/visualisers/ObsPlotting.cc
+++ b/src/visualisers/ObsPlotting.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ObsPlotting.cc
\brief Implementation of the Template class ObsPlotting.
diff --git a/src/visualisers/ObsPlotting.h b/src/visualisers/ObsPlotting.h
index d264ce5..afd9a12 100644
--- a/src/visualisers/ObsPlotting.h
+++ b/src/visualisers/ObsPlotting.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ObsPlotting.h
\brief Definition of the Template class ObsPlotting.
diff --git a/src/visualisers/ObsTable.cc b/src/visualisers/ObsTable.cc
index 8d655f3..afc072b 100644
--- a/src/visualisers/ObsTable.cc
+++ b/src/visualisers/ObsTable.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ObsTable.cc
\brief Implementation of the Template class LocalTable.
diff --git a/src/visualisers/ObsTable.h b/src/visualisers/ObsTable.h
index 785f8d0..dca89ae 100644
--- a/src/visualisers/ObsTable.h
+++ b/src/visualisers/ObsTable.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef ObsTable_H
#define ObsTable_H
diff --git a/src/visualisers/OriginMarker.h b/src/visualisers/OriginMarker.h
index 2478c09..f2f2dfc 100644
--- a/src/visualisers/OriginMarker.h
+++ b/src/visualisers/OriginMarker.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file OriginMarker.h
\brief Definition of the Template class OriginMarker.
diff --git a/src/visualisers/OutLayerTechnique.cc b/src/visualisers/OutLayerTechnique.cc
index ee7a97b..0d3ba09 100644
--- a/src/visualisers/OutLayerTechnique.cc
+++ b/src/visualisers/OutLayerTechnique.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HeightSelection.cc
\brief Implementation of the Template class HeightSelection.
diff --git a/src/visualisers/OutLayerTechnique.h b/src/visualisers/OutLayerTechnique.h
index 6872980..f5e3102 100644
--- a/src/visualisers/OutLayerTechnique.h
+++ b/src/visualisers/OutLayerTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file HeightSelection.h
\brief Definition of the Template class HeightSelection.
diff --git a/src/visualisers/PolyShadingMethod.cc b/src/visualisers/PolyShadingMethod.cc
index 0323e00..0f5591a 100644
--- a/src/visualisers/PolyShadingMethod.cc
+++ b/src/visualisers/PolyShadingMethod.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PolyShadingMethod.h
\brief Definition of the Template class PolyShadingMethod.
diff --git a/src/visualisers/PolyShadingMethod.h b/src/visualisers/PolyShadingMethod.h
index b2e6968..bb3738b 100644
--- a/src/visualisers/PolyShadingMethod.h
+++ b/src/visualisers/PolyShadingMethod.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PolyShadingMethod.h
\brief Definition of the Template class PolyShadingMethod.
diff --git a/src/visualisers/PolyShadingTechnique.cc b/src/visualisers/PolyShadingTechnique.cc
index a77999e..247b8dc 100644
--- a/src/visualisers/PolyShadingTechnique.cc
+++ b/src/visualisers/PolyShadingTechnique.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PolyShadingMethod.h
\brief Definition of the Template class PolyShadingMethod.
diff --git a/src/visualisers/PolyShadingTechnique.h b/src/visualisers/PolyShadingTechnique.h
index 679cc9d..4227aab 100644
--- a/src/visualisers/PolyShadingTechnique.h
+++ b/src/visualisers/PolyShadingTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file PolyShadingTechnique.h
\brief Definition of the Template class PolyShadingTechnique.
diff --git a/src/visualisers/SegmentJoiner.cc b/src/visualisers/SegmentJoiner.cc
index 370d6d6..124026b 100644
--- a/src/visualisers/SegmentJoiner.cc
+++ b/src/visualisers/SegmentJoiner.cc
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 1996-2012 ECMWF.
+ * (C) Copyright 1996-2016 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/src/visualisers/SegmentJoiner.h b/src/visualisers/SegmentJoiner.h
index 3307bd1..5e4f7f5 100644
--- a/src/visualisers/SegmentJoiner.h
+++ b/src/visualisers/SegmentJoiner.h
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 1996-2012 ECMWF.
+ * (C) Copyright 1996-2016 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
diff --git a/src/visualisers/ShadingTechnique.h b/src/visualisers/ShadingTechnique.h
index 97a18c4..fbd7314 100644
--- a/src/visualisers/ShadingTechnique.h
+++ b/src/visualisers/ShadingTechnique.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ShadingTechnique.h
\brief Definition of the Template class ShadingTechnique.
diff --git a/src/visualisers/SimplePolylineVisualiser.cc b/src/visualisers/SimplePolylineVisualiser.cc
index 8891361..c04ccb8 100644
--- a/src/visualisers/SimplePolylineVisualiser.cc
+++ b/src/visualisers/SimplePolylineVisualiser.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file BoxPlotVisualiser.cc
\brief Implementation of the Template class BoxPlotVisualiser.
diff --git a/src/visualisers/SimplePolylineVisualiser.h b/src/visualisers/SimplePolylineVisualiser.h
index 4a4b5bb..82092e0 100644
--- a/src/visualisers/SimplePolylineVisualiser.h
+++ b/src/visualisers/SimplePolylineVisualiser.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SimplePolylineVisualiser.h
\brief Definition of the Template class SimplePolylineVisualiser.
diff --git a/src/visualisers/Streamlines.cc b/src/visualisers/Streamlines.cc
index b4c4639..55225a6 100644
--- a/src/visualisers/Streamlines.cc
+++ b/src/visualisers/Streamlines.cc
@@ -1,22 +1,12 @@
-
-
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file WindPlotting.cc
\brief Implementation of the Template class Wind.
diff --git a/src/visualisers/Streamlines.h b/src/visualisers/Streamlines.h
index bbd4686..ec14857 100644
--- a/src/visualisers/Streamlines.h
+++ b/src/visualisers/Streamlines.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Streamlines.h
\brief Definition of the Template class Streamlines.
diff --git a/src/visualisers/SymbolAdvancedTableMode.cc b/src/visualisers/SymbolAdvancedTableMode.cc
index 949fa7b..264a878 100644
--- a/src/visualisers/SymbolAdvancedTableMode.cc
+++ b/src/visualisers/SymbolAdvancedTableMode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SymbolAdvancedTableMode.h
\brief Implementation of the Template class SymbolAdvancedTableMode.
diff --git a/src/visualisers/SymbolAdvancedTableMode.h b/src/visualisers/SymbolAdvancedTableMode.h
index 49cf134..fb884cf 100644
--- a/src/visualisers/SymbolAdvancedTableMode.h
+++ b/src/visualisers/SymbolAdvancedTableMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SymbolAdvancedTableMode.cc
\brief Definition of the Template class SymbolAdvancedTableMode.
diff --git a/src/visualisers/SymbolMode.cc b/src/visualisers/SymbolMode.cc
index fadb41d..65e52ce 100644
--- a/src/visualisers/SymbolMode.cc
+++ b/src/visualisers/SymbolMode.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SymbolMode.cc
\brief Implementation of the Template class SymbolMode.
diff --git a/src/visualisers/SymbolMode.h b/src/visualisers/SymbolMode.h
index d19a9ac..4487df7 100644
--- a/src/visualisers/SymbolMode.h
+++ b/src/visualisers/SymbolMode.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SymbolMode.h
\brief Definition of the Template class SymbolMode.
@@ -134,10 +126,10 @@ public:
virtual void visit(LegendVisitor&);
- void prepare() { update(); }
+ void prepare() { update(); properties();}
void update();
void properties() const;
- SymbolProperties operator()(double) const { properties(); return properties_; }
+ SymbolProperties operator()(double) const { return properties_; }
void visit(Data&, LegendVisitor&);
protected:
diff --git a/src/visualisers/SymbolPlotting.cc b/src/visualisers/SymbolPlotting.cc
index 3649a15..b893722 100644
--- a/src/visualisers/SymbolPlotting.cc
+++ b/src/visualisers/SymbolPlotting.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SymbolPlotting.cc
\brief Implementation of the Template class SymbolPlotting.
diff --git a/src/visualisers/SymbolPlotting.h b/src/visualisers/SymbolPlotting.h
index febb1b0..9768c91 100644
--- a/src/visualisers/SymbolPlotting.h
+++ b/src/visualisers/SymbolPlotting.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file SymbolPlotting.h
\brief Definition of the Template class SymbolPlotting.
diff --git a/src/visualisers/TaylorGrid.cc b/src/visualisers/TaylorGrid.cc
index 00a7895..967e9c6 100644
--- a/src/visualisers/TaylorGrid.cc
+++ b/src/visualisers/TaylorGrid.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expres s or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TaylorGrid.cc
\brief Implementation of the Template class TaylorGrid.
diff --git a/src/visualisers/TaylorGrid.h b/src/visualisers/TaylorGrid.h
index 3c6d447..ddf5668 100644
--- a/src/visualisers/TaylorGrid.h
+++ b/src/visualisers/TaylorGrid.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TaylorGrid.h
\brief Definition of the Template class TaylorGrid.
diff --git a/src/visualisers/TephiGrid.cc b/src/visualisers/TephiGrid.cc
index 02ef583..71966cf 100644
--- a/src/visualisers/TephiGrid.cc
+++ b/src/visualisers/TephiGrid.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expres s or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TephiGrid.cc
\brief Implementation of the Template class TephiGrid.
diff --git a/src/visualisers/TephiGrid.h b/src/visualisers/TephiGrid.h
index db7b1f6..2ee711b 100644
--- a/src/visualisers/TephiGrid.h
+++ b/src/visualisers/TephiGrid.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TephiGrid.h
\brief Definition of the Template class TephiGrid.
diff --git a/src/visualisers/TextOrientation.cc b/src/visualisers/TextOrientation.cc
index cc3f826..79f3a80 100644
--- a/src/visualisers/TextOrientation.cc
+++ b/src/visualisers/TextOrientation.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TextOrientation.cc
\brief Implementation of the Template class TextOrientation.
diff --git a/src/visualisers/TextOrientation.h b/src/visualisers/TextOrientation.h
index 2da7a33..8f2e9c0 100644
--- a/src/visualisers/TextOrientation.h
+++ b/src/visualisers/TextOrientation.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file TextOrientation.h
\brief Definition of the Template class TextOrientation.
diff --git a/src/visualisers/UserDate.cc b/src/visualisers/UserDate.cc
index e365298..ccf6d65 100644
--- a/src/visualisers/UserDate.cc
+++ b/src/visualisers/UserDate.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file UserDate.cc
\brief Implementation of the Template class UserDate.
diff --git a/src/visualisers/UserDate.h b/src/visualisers/UserDate.h
index 22874db..09cdce9 100644
--- a/src/visualisers/UserDate.h
+++ b/src/visualisers/UserDate.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file UserDate.h
\brief Definition of the Template class UserDate.
diff --git a/src/visualisers/ValuePlot.cc b/src/visualisers/ValuePlot.cc
index 34695e3..6b32b36 100644
--- a/src/visualisers/ValuePlot.cc
+++ b/src/visualisers/ValuePlot.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ValuePlot.cc
\brief Implementation of the Template class ValuePlot.
diff --git a/src/visualisers/ValuePlot.h b/src/visualisers/ValuePlot.h
index 8605a4b..06dd297 100644
--- a/src/visualisers/ValuePlot.h
+++ b/src/visualisers/ValuePlot.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ValuePlot.h
\brief Definition of the Template class ValuePlot.
diff --git a/src/visualisers/ValuePlotBase.h b/src/visualisers/ValuePlotBase.h
index dd7e31d..5336417 100644
--- a/src/visualisers/ValuePlotBase.h
+++ b/src/visualisers/ValuePlotBase.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ValuePlotBase.h
\brief Definition of the Template class ValuePlotBase.
diff --git a/src/visualisers/ValuePlotMethod.h b/src/visualisers/ValuePlotMethod.h
index 8832370..12368e7 100644
--- a/src/visualisers/ValuePlotMethod.h
+++ b/src/visualisers/ValuePlotMethod.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ValuePlotMethod.h
\brief Definition of the Template class ValuePlotMethod.
diff --git a/src/visualisers/VisDefInfo.cc b/src/visualisers/VisDefInfo.cc
index 17a4fe7..5e11a4d 100644
--- a/src/visualisers/VisDefInfo.cc
+++ b/src/visualisers/VisDefInfo.cc
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#include <algorithm>
#include "Layer.h"
diff --git a/src/visualisers/VisDefInfo.h b/src/visualisers/VisDefInfo.h
index 169ae16..73f3214 100644
--- a/src/visualisers/VisDefInfo.h
+++ b/src/visualisers/VisDefInfo.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file VisDefInfo.h
\brief Definition of class VisDefInfo.
diff --git a/src/visualisers/Wind.cc b/src/visualisers/Wind.cc
index f78240e..67fbd35 100644
--- a/src/visualisers/Wind.cc
+++ b/src/visualisers/Wind.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Wind.cc
\brief Implementation of the Template class Wind.
diff --git a/src/visualisers/Wind.h b/src/visualisers/Wind.h
index 21d26d8..51abab2 100644
--- a/src/visualisers/Wind.h
+++ b/src/visualisers/Wind.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file Wind.h
\brief Definition of the Template class Wind.
diff --git a/src/visualisers/WindPlotting.cc b/src/visualisers/WindPlotting.cc
index 47d83a0..fd09f85 100644
--- a/src/visualisers/WindPlotting.cc
+++ b/src/visualisers/WindPlotting.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file WindPlotting.cc
\brief Implementation of the Template class Wind.
diff --git a/src/visualisers/WindPlotting.h b/src/visualisers/WindPlotting.h
index 45294a2..234a20a 100644
--- a/src/visualisers/WindPlotting.h
+++ b/src/visualisers/WindPlotting.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file WindPlotting.h
\brief Definition of the Template class WindPlotting.
diff --git a/src/web/GeoJSon.cc b/src/web/GeoJSon.cc
index a452fd9..12b535e 100644
--- a/src/web/GeoJSon.cc
+++ b/src/web/GeoJSon.cc
@@ -1,34 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
-
-/*!
- \brief Implementation of the Template class SpotDecoder.
-
- Magics Team - ECMWF 2005
-
- Started: Mon 19-Sep-2005
-
- Changes:
-
-*/
-
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "GeoJSon.h"
#include "Factory.h"
diff --git a/src/web/GeoJSon.h b/src/web/GeoJSon.h
index cc1295e..be38f0d 100644
--- a/src/web/GeoJSon.h
+++ b/src/web/GeoJSon.h
@@ -1,31 +1,13 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
-/*! \file EpsgramDecoder.h
- \brief Definition of the Template class EpsgramDecoder.
-
- Magics Team - ECMWF 2005
-
- Started: Mon 19-Sep-2005
-
- Changes:
-
-*/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#ifndef GeoJSon_H
#define GeoJSon_H
diff --git a/src/web/MagConfig.cc b/src/web/MagConfig.cc
index a121d3e..20d4065 100644
--- a/src/web/MagConfig.cc
+++ b/src/web/MagConfig.cc
@@ -1,34 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
-
-/*!
- \brief Implementation of the Template class SpotDecoder.
-
- Magics Team - ECMWF 2005
-
- Started: Mon 19-Sep-2005
-
- Changes:
-
-*/
-
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "MagConfig.h"
#include "MagLog.h"
diff --git a/src/web/MagConfig.h b/src/web/MagConfig.h
index 881804b..a886e3e 100644
--- a/src/web/MagConfig.h
+++ b/src/web/MagConfig.h
@@ -1,31 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
-/*! \file EpsgramDecoder.h
- \brief Definition of the Template class EpsgramDecoder.
-
- Magics Team - ECMWF 2005
-
- Started: Mon 19-Sep-2005
-
- Changes:
-
-*/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#ifndef MagConfig_H
#define MagConfig_H
diff --git a/src/web/MagJSon.cc b/src/web/MagJSon.cc
index 20aa5b3..35c82ee 100644
--- a/src/web/MagJSon.cc
+++ b/src/web/MagJSon.cc
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include "MagJSon.h"
diff --git a/src/web/MagJSon.h b/src/web/MagJSon.h
index 660fc5b..347f288 100644
--- a/src/web/MagJSon.h
+++ b/src/web/MagJSon.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file MagJSon.h
\brief Definition of the Template class MagJSon.
diff --git a/src/web/ObsJSon.cc b/src/web/ObsJSon.cc
index 21acfcb..16e3a94 100644
--- a/src/web/ObsJSon.cc
+++ b/src/web/ObsJSon.cc
@@ -1,33 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
-
-/*! \file SpotDecoder.h
- \brief Implementation of the Template class SpotDecoder.
-
- Magics Team - ECMWF 2005
-
- Started: Mon 19-Sep-2005
-
- Changes:
-
-*/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include <locale>
#include "ObsJSon.h"
diff --git a/src/web/ObsJSon.h b/src/web/ObsJSon.h
index ca3e9da..5ec93f9 100644
--- a/src/web/ObsJSon.h
+++ b/src/web/ObsJSon.h
@@ -1,20 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
/*! \file ObsJSon.h
\brief Definition of the Template classBufrJSon.
diff --git a/src/web/WrepJSon.cc b/src/web/WrepJSon.cc
index 2b336b2..ff70012 100644
--- a/src/web/WrepJSon.cc
+++ b/src/web/WrepJSon.cc
@@ -1,33 +1,12 @@
-/******************************** LICENSE ********************************
-
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
-
-/*!
- \brief Implementation of the Template class SpotDecoder.
-
- Magics Team - ECMWF 2005
-
- Started: Mon 19-Sep-2005
-
- Changes:
-
-*/
-
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
#include <locale>
#include "WrepJSon.h"
diff --git a/src/web/WrepJSon.h b/src/web/WrepJSon.h
index a3720bb..293158e 100644
--- a/src/web/WrepJSon.h
+++ b/src/web/WrepJSon.h
@@ -1,31 +1,13 @@
-/******************************** LICENSE ********************************
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
- Copyright 2007 European Centre for Medium-Range Weather Forecasts (ECMWF)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ******************************** LICENSE ********************************/
-
-/*! \file EpsgramDecoder.h
- \brief Definition of the Template class EpsgramDecoder.
-
- Magics Team - ECMWF 2005
-
- Started: Mon 19-Sep-2005
-
- Changes:
-
-*/
#ifndef EpsJSon_H
#define EpsJSon_H
diff --git a/src/web/json_spirit.vcproj b/src/web/json_spirit.vcproj
deleted file mode 100644
index 0cbe0ef..0000000
--- a/src/web/json_spirit.vcproj
+++ /dev/null
@@ -1,213 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="json_spirit_lib"
- ProjectGUID="{BE262A86-CC26-4B25-A877-883ED2688CEC}"
- RootNamespace="json_spirit"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalOptions="
"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- DisableLanguageExtensions="false"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="false"
- FavorSizeOrSpeed="0"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\json_spirit_reader.cpp"
- >
- </File>
- <File
- RelativePath=".\json_spirit_writer.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\json_spirit.h"
- >
- </File>
- <File
- RelativePath=".\json_spirit_error_position.h"
- >
- </File>
- <File
- RelativePath=".\json_spirit_reader.h"
- >
- </File>
- <File
- RelativePath=".\json_spirit_reader_template.h"
- >
- </File>
- <File
- RelativePath=".\json_spirit_stream_reader.h"
- >
- </File>
- <File
- RelativePath=".\json_spirit_utils.h"
- >
- </File>
- <File
- RelativePath=".\json_spirit_value.h"
- >
- </File>
- <File
- RelativePath=".\json_spirit_writer.h"
- >
- </File>
- <File
- RelativePath=".\json_spirit_writer_options.h"
- >
- </File>
- <File
- RelativePath=".\json_spirit_writer_template.h"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/test/bufr.f90 b/test/bufr.f90
index 1e01c54..5130993 100644
--- a/test/bufr.f90
+++ b/test/bufr.f90
@@ -1,3 +1,12 @@
+! (C) Copyright 1996-2016 ECMWF.
+!
+! This software is licensed under the terms of the Apache Licence Version 2.0
+! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+! In applying this licence, ECMWF does not waive the privileges and immunities
+! granted to it by virtue of its status as an intergovernmental organisation nor
+! does it submit to any jurisdiction.
+!
+
program magics
call popen
diff --git a/test/bufr.py b/test/bufr.py
index 0a9de3e..65f94e4 100644
--- a/test/bufr.py
+++ b/test/bufr.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
# importing Magics module
from Magics.macro import *
diff --git a/test/cairo.f90 b/test/cairo.f90
index 943240d..e186f5d 100644
--- a/test/cairo.f90
+++ b/test/cairo.f90
@@ -1,3 +1,12 @@
+! (C) Copyright 1996-2016 ECMWF.
+!
+! This software is licensed under the terms of the Apache Licence Version 2.0
+! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+! In applying this licence, ECMWF does not waive the privileges and immunities
+! granted to it by virtue of its status as an intergovernmental organisation nor
+! does it submit to any jurisdiction.
+!
+
program magics
call popen
diff --git a/test/cairo.py b/test/cairo.py
index 617a835..95fab25 100644
--- a/test/cairo.py
+++ b/test/cairo.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
# importing Magics module
from Magics.macro import *
diff --git a/test/coast.c b/test/coast.c
index 41daede..36952f3 100644
--- a/test/coast.c
+++ b/test/coast.c
@@ -1,3 +1,13 @@
+/*
+ * (C) Copyright 1996-2016 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
+ * granted to it by virtue of its status as an intergovernmental organisation nor
+ * does it submit to any jurisdiction.
+ */
+
#include "magics_api.h"
#include <stdio.h>
diff --git a/test/coast.f90 b/test/coast.f90
index 5402196..bdb8472 100644
--- a/test/coast.f90
+++ b/test/coast.f90
@@ -1,3 +1,12 @@
+! (C) Copyright 1996-2016 ECMWF.
+!
+! This software is licensed under the terms of the Apache Licence Version 2.0
+! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+! In applying this licence, ECMWF does not waive the privileges and immunities
+! granted to it by virtue of its status as an intergovernmental organisation nor
+! does it submit to any jurisdiction.
+!
+
program magics
call popen
diff --git a/test/coast.py b/test/coast.py
index ea8da76..ecda636 100644
--- a/test/coast.py
+++ b/test/coast.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
# importing Magics module
from Magics.macro import *
diff --git a/test/grib.f90 b/test/grib.f90
index 0048238..712ed70 100644
--- a/test/grib.f90
+++ b/test/grib.f90
@@ -1,3 +1,12 @@
+! (C) Copyright 1996-2016 ECMWF.
+!
+! This software is licensed under the terms of the Apache Licence Version 2.0
+! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+! In applying this licence, ECMWF does not waive the privileges and immunities
+! granted to it by virtue of its status as an intergovernmental organisation nor
+! does it submit to any jurisdiction.
+!
+
program magics
call popen
diff --git a/test/grib.py b/test/grib.py
index d7c84d1..c647607 100644
--- a/test/grib.py
+++ b/test/grib.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
# importing Magics module
from Magics.macro import *
diff --git a/test/odb.py b/test/odb.py
index f6925d1..b9d3210 100755
--- a/test/odb.py
+++ b/test/odb.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
from Magics.macro import *
ps = output({'output_formats': ['png','ps'], 'output_name':'myview'});
diff --git a/tools/RPM_build_specs/emoslib/generateRPM.sh b/tools/RPM_build_specs/emoslib/generateRPM.sh
index 0b28fc6..4803abb 100755
--- a/tools/RPM_build_specs/emoslib/generateRPM.sh
+++ b/tools/RPM_build_specs/emoslib/generateRPM.sh
@@ -1,4 +1,12 @@
#!/bin/bash
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
logfile=$0_.log
echo "Log is written in ${logfile}"
diff --git a/tools/axis2doc.py b/tools/axis2doc.py
index 06d590c..31f393f 100644
--- a/tools/axis2doc.py
+++ b/tools/axis2doc.py
@@ -1,4 +1,12 @@
#!/usr/bin/python
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
from xml.sax.handler import ContentHandler
from xml.sax import make_parser
from types import *
diff --git a/tools/beau.py b/tools/beau.py
index 36db2e5..f7d590a 100644
--- a/tools/beau.py
+++ b/tools/beau.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
import xml.dom.minidom
diff --git a/tools/beautify-xml.py b/tools/beautify-xml.py
index bb4294c..892c744 100644
--- a/tools/beautify-xml.py
+++ b/tools/beautify-xml.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
import lxml.etree as etree
import sys
diff --git a/tools/generateDebugLibs.sh b/tools/generateDebugLibs.sh
index 13aa09a..b8b95d3 100755
--- a/tools/generateDebugLibs.sh
+++ b/tools/generateDebugLibs.sh
@@ -1,4 +1,12 @@
#!/bin/bash
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
#scriptdir=`dirname ${0}`
#scriptdir=`(cd ${scriptdir}; pwd)`
diff --git a/tools/magml2json.pl b/tools/magml2json.pl
index 7253310..02a1b19 100755
--- a/tools/magml2json.pl
+++ b/tools/magml2json.pl
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use XML::Parser;
use Data::Dumper;
diff --git a/tools/mergexml.pl b/tools/mergexml.pl
index 58084fe..1d4a705 100755
--- a/tools/mergexml.pl
+++ b/tools/mergexml.pl
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
# *****************************************************************************
# Perl script to automatically merge all the MAGICS++ objects' .xml files
# into one combined .xml file.
diff --git a/tools/metview.py b/tools/metview.py
index d656db0..9ba01e3 100644
--- a/tools/metview.py
+++ b/tools/metview.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
from subprocess import call
diff --git a/tools/newbase.pl b/tools/newbase.pl
index e2b0f3e..77fcd1f 100755
--- a/tools/newbase.pl
+++ b/tools/newbase.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use strict;
use Date::Calc;
diff --git a/tools/newclass.pl b/tools/newclass.pl
index 6b32ecc..75b3b58 100755
--- a/tools/newclass.pl
+++ b/tools/newclass.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use strict;
use Date::Calc;
diff --git a/tools/newdriver.pl b/tools/newdriver.pl
index 242c066..3975b4e 100755
--- a/tools/newdriver.pl
+++ b/tools/newdriver.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use strict;
use Time::localtime;
diff --git a/tools/newfactory.pl b/tools/newfactory.pl
index d5a096d..6b26169 100755
--- a/tools/newfactory.pl
+++ b/tools/newfactory.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use strict;
use Date::Calc;
diff --git a/tools/newprojection.pl b/tools/newprojection.pl
index 0028916..b9b67d4 100755
--- a/tools/newprojection.pl
+++ b/tools/newprojection.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use strict;
use Time::localtime;
diff --git a/tools/newtemplate.pl b/tools/newtemplate.pl
index 6e45718..1f2fb31 100755
--- a/tools/newtemplate.pl
+++ b/tools/newtemplate.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use strict;
use Date::Calc;
diff --git a/tools/xml2cc.pl b/tools/xml2cc.pl
index 88d53fd..47d6053 100755
--- a/tools/xml2cc.pl
+++ b/tools/xml2cc.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
#test juanjo
use XML::Parser;
diff --git a/tools/xml2cc_list.pl b/tools/xml2cc_list.pl
index 14cd02a..8536ab1 100755
--- a/tools/xml2cc_list.pl
+++ b/tools/xml2cc_list.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use XML::Parser;
use Time::localtime;
diff --git a/tools/xml2cc_new.pl b/tools/xml2cc_new.pl
index f764d21..b9ec94f 100755
--- a/tools/xml2cc_new.pl
+++ b/tools/xml2cc_new.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use XML::Parser;
use Time::localtime;
diff --git a/tools/xml2doc.pl b/tools/xml2doc.pl
index 5371812..15aae3b 100755
--- a/tools/xml2doc.pl
+++ b/tools/xml2doc.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use XML::Parser;
use Time::localtime;
diff --git a/tools/xml2doc.py b/tools/xml2doc.py
index e124fa1..b7d92c5 100644
--- a/tools/xml2doc.py
+++ b/tools/xml2doc.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
from xml.sax.handler import ContentHandler
from xml.sax import make_parser
diff --git a/tools/xml2dtd.pl b/tools/xml2dtd.pl
index ef1a0aa..8be0915 100755
--- a/tools/xml2dtd.pl
+++ b/tools/xml2dtd.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use XML::Parser;
diff --git a/tools/xml2html.py b/tools/xml2html.py
index f359620..462f575 100644
--- a/tools/xml2html.py
+++ b/tools/xml2html.py
@@ -1,4 +1,12 @@
#!/usr/bin/python
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
from xml.sax.handler import ContentHandler
from xml.sax import make_parser
from types import *
diff --git a/tools/xml2icon.pl b/tools/xml2icon.pl
index f2f88e7..2fc648a 100755
--- a/tools/xml2icon.pl
+++ b/tools/xml2icon.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use XML::Parser;
diff --git a/tools/xml2mv.pl b/tools/xml2mv.pl
index d3c411b..2eb4306 100755
--- a/tools/xml2mv.pl
+++ b/tools/xml2mv.pl
@@ -1,4 +1,12 @@
#!/usr/bin/perl
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
use XML::Parser;
diff --git a/tools/xml2mv.py b/tools/xml2mv.py
index 5a072fe..863faf3 100755
--- a/tools/xml2mv.py
+++ b/tools/xml2mv.py
@@ -1,4 +1,12 @@
#!/usr/bin/python
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
from xml.sax.handler import ContentHandler
from xml.sax import make_parser
from types import *
diff --git a/tools/xml2odt.py b/tools/xml2odt.py
index b18c509..d4dd609 100644
--- a/tools/xml2odt.py
+++ b/tools/xml2odt.py
@@ -1,4 +1,12 @@
#!/usr/bin/python
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
from xml.sax.handler import ContentHandler
from xml.sax import make_parser
from types import *
diff --git a/tools/xml2odt.sh b/tools/xml2odt.sh
index b531b45..8740f85 100755
--- a/tools/xml2odt.sh
+++ b/tools/xml2odt.sh
@@ -1,4 +1,12 @@
#!/bin/bash
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
set -x
#
# to be run from src/xml/Makefile
diff --git a/tools/xml2split.py b/tools/xml2split.py
index da09d79..09a9e29 100644
--- a/tools/xml2split.py
+++ b/tools/xml2split.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
from xml.sax.handler import ContentHandler
diff --git a/utils/bufrgram.py b/utils/bufrgram.py
index ca0ddec..4a3d37d 100644
--- a/utils/bufrgram.py
+++ b/utils/bufrgram.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
from Magics.macro import *
import datetime
diff --git a/utils/epsgrams.py b/utils/epsgrams.py
index 913edf8..1ce96cf 100644
--- a/utils/epsgrams.py
+++ b/utils/epsgrams.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
import traceback
import sys
diff --git a/utils/input/37.00_35.32_10u.json b/utils/input/37.00_35.32_10u.json
deleted file mode 100644
index 61849a4..0000000
--- a/utils/input/37.00_35.32_10u.json
+++ /dev/null
@@ -1,223 +0,0 @@
-{
- "forecast_location": {
- "latitude": 37.012301461157264,
- "distance": 5.167124375483275,
- "longitude": 35.263852242744065
- },
- "height": 50,
- "location": {
- "lat": 37.0,
- "lon": 35.32
- },
- "time": "00",
- "date": "20160419",
- "output": "37.00_35.32_10u.json",
- "station_name": "Adana",
- "10u": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "10u": [
- -0.656097412109375,
- -0.6875,
- 0.249542236328125,
- -1.839080810546875,
- -2.155181884765625,
- -0.2914581298828125,
- 2.7479095458984375,
- -0.734130859375,
- -0.158233642578125,
- -0.2945404052734375,
- -0.208465576171875,
- -0.87286376953125,
- 0.83441162109375,
- 2.5236663818359375,
- 0.8609161376953125,
- -0.0679473876953125,
- -1.31085205078125,
- -0.466949462890625,
- -0.8086700439453125,
- 0.3325958251953125,
- 2.6600189208984375,
- 1.0920867919921875,
- 1.309234619140625,
- -2.84185791015625,
- 1.5451202392578125,
- -1.59637451171875,
- -2.3056488037109375,
- -0.9296722412109375,
- -1.3208160400390625,
- 3.0722808837890625,
- 2.091644287109375,
- -0.327606201171875,
- -0.7340240478515625,
- -0.46807861328125,
- 0.3505401611328125,
- 0.98321533203125,
- 2.368255615234375,
- 3.6607208251953125,
- 1.883056640625,
- 0.133514404296875,
- -0.3946380615234375,
- -0.8407440185546875,
- -1.099884033203125,
- -0.4441070556640625,
- 1.5653533935546875,
- 2.5539093017578125,
- 1.6402435302734375,
- -0.7368316650390625,
- -0.276885986328125,
- -0.5802154541015625,
- 0.88775634765625,
- 2.4001007080078125,
- -0.7680511474609375,
- -0.520843505859375,
- 0.6084747314453125,
- -1.4952850341796875,
- -1.7485504150390625,
- -2.8776397705078125,
- -0.1529541015625,
- -0.329071044921875,
- -1.4511260986328125,
- -1.42181396484375,
- 1.276824951171875,
- -0.1305694580078125,
- -0.5270538330078125
- ],
- "10v": [
- -1.39080810546875,
- -1.6737213134765625,
- -1.0354766845703125,
- -1.7921295166015625,
- -0.272064208984375,
- 1.3854217529296875,
- -0.00360107421875,
- -0.2913665771484375,
- -1.6612548828125,
- -1.758270263671875,
- -1.0623931884765625,
- 0.9999542236328125,
- 3.6143798828125,
- 2.1895904541015625,
- 1.714599609375,
- -0.6298675537109375,
- -1.5398406982421875,
- -1.8553314208984375,
- 0.619903564453125,
- 3.44122314453125,
- 5.31573486328125,
- 2.1760406494140625,
- -10.150650024414062,
- -5.5760498046875,
- -3.3589019775390625,
- -2.646209716796875,
- -4.5130615234375,
- -5.240478515625,
- -0.8084259033203125,
- 2.0362396240234375,
- 1.3332977294921875,
- -1.5885772705078125,
- -1.3899993896484375,
- -1.496246337890625,
- -0.76519775390625,
- 1.0582275390625,
- 2.2641754150390625,
- 2.0411834716796875,
- 0.441070556640625,
- 1.4689788818359375,
- -0.7352447509765625,
- -1.158447265625,
- 0.103179931640625,
- 1.01373291015625,
- 3.3959503173828125,
- 3.2667388916015625,
- 1.3455963134765625,
- 0.137603759765625,
- -1.5401153564453125,
- -1.4615020751953125,
- 2.3779144287109375,
- 0.4443511962890625,
- -1.1491241455078125,
- -0.2032012939453125,
- 4.7884979248046875,
- 0.64691162109375,
- -0.7286224365234375,
- -0.5706634521484375,
- 1.9560699462890625,
- 1.3690032958984375,
- 0.233795166015625,
- 0.442840576171875,
- 3.9861297607421875,
- 1.4842071533203125,
- -0.2207183837890625
- ]
- },
- "metadata": {
- "points_along_meridian": 2560,
- "deterministic_height": 65.37060546875
- }
-}
diff --git a/utils/input/37.00_35.32_10uv.json b/utils/input/37.00_35.32_10uv.json
deleted file mode 100644
index fa0bba7..0000000
--- a/utils/input/37.00_35.32_10uv.json
+++ /dev/null
@@ -1,223 +0,0 @@
-{
- "forecast_location": {
- "latitude": 37.012301461157264,
- "distance": 5.167124375483275,
- "longitude": 35.263852242744065
- },
- "height": 50,
- "location": {
- "lat": 37.0,
- "lon": 35.32
- },
- "time": "00",
- "date": "20160419",
- "output": "37.00_35.32_10u.json",
- "station_name": "Adana",
- "10uv": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "10u": [
- -0.656097412109375,
- -0.6875,
- 0.249542236328125,
- -1.839080810546875,
- -2.155181884765625,
- -0.2914581298828125,
- 2.7479095458984375,
- -0.734130859375,
- -0.158233642578125,
- -0.2945404052734375,
- -0.208465576171875,
- -0.87286376953125,
- 0.83441162109375,
- 2.5236663818359375,
- 0.8609161376953125,
- -0.0679473876953125,
- -1.31085205078125,
- -0.466949462890625,
- -0.8086700439453125,
- 0.3325958251953125,
- 2.6600189208984375,
- 1.0920867919921875,
- 1.309234619140625,
- -2.84185791015625,
- 1.5451202392578125,
- -1.59637451171875,
- -2.3056488037109375,
- -0.9296722412109375,
- -1.3208160400390625,
- 3.0722808837890625,
- 2.091644287109375,
- -0.327606201171875,
- -0.7340240478515625,
- -0.46807861328125,
- 0.3505401611328125,
- 0.98321533203125,
- 2.368255615234375,
- 3.6607208251953125,
- 1.883056640625,
- 0.133514404296875,
- -0.3946380615234375,
- -0.8407440185546875,
- -1.099884033203125,
- -0.4441070556640625,
- 1.5653533935546875,
- 2.5539093017578125,
- 1.6402435302734375,
- -0.7368316650390625,
- -0.276885986328125,
- -0.5802154541015625,
- 0.88775634765625,
- 2.4001007080078125,
- -0.7680511474609375,
- -0.520843505859375,
- 0.6084747314453125,
- -1.4952850341796875,
- -1.7485504150390625,
- -2.8776397705078125,
- -0.1529541015625,
- -0.329071044921875,
- -1.4511260986328125,
- -1.42181396484375,
- 1.276824951171875,
- -0.1305694580078125,
- -0.5270538330078125
- ],
- "10v": [
- -1.39080810546875,
- -1.6737213134765625,
- -1.0354766845703125,
- -1.7921295166015625,
- -0.272064208984375,
- 1.3854217529296875,
- -0.00360107421875,
- -0.2913665771484375,
- -1.6612548828125,
- -1.758270263671875,
- -1.0623931884765625,
- 0.9999542236328125,
- 3.6143798828125,
- 2.1895904541015625,
- 1.714599609375,
- -0.6298675537109375,
- -1.5398406982421875,
- -1.8553314208984375,
- 0.619903564453125,
- 3.44122314453125,
- 5.31573486328125,
- 2.1760406494140625,
- -10.150650024414062,
- -5.5760498046875,
- -3.3589019775390625,
- -2.646209716796875,
- -4.5130615234375,
- -5.240478515625,
- -0.8084259033203125,
- 2.0362396240234375,
- 1.3332977294921875,
- -1.5885772705078125,
- -1.3899993896484375,
- -1.496246337890625,
- -0.76519775390625,
- 1.0582275390625,
- 2.2641754150390625,
- 2.0411834716796875,
- 0.441070556640625,
- 1.4689788818359375,
- -0.7352447509765625,
- -1.158447265625,
- 0.103179931640625,
- 1.01373291015625,
- 3.3959503173828125,
- 3.2667388916015625,
- 1.3455963134765625,
- 0.137603759765625,
- -1.5401153564453125,
- -1.4615020751953125,
- 2.3779144287109375,
- 0.4443511962890625,
- -1.1491241455078125,
- -0.2032012939453125,
- 4.7884979248046875,
- 0.64691162109375,
- -0.7286224365234375,
- -0.5706634521484375,
- 1.9560699462890625,
- 1.3690032958984375,
- 0.233795166015625,
- 0.442840576171875,
- 3.9861297607421875,
- 1.4842071533203125,
- -0.2207183837890625
- ]
- },
- "metadata": {
- "points_along_meridian": 2560,
- "deterministic_height": 65.37060546875
- }
-}
diff --git a/utils/input/37.00_35.32_10v.json b/utils/input/37.00_35.32_10v.json
deleted file mode 100644
index 2d115e6..0000000
--- a/utils/input/37.00_35.32_10v.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 37.012301461157264,
- "distance": 5.167124375483275,
- "longitude": 35.263852242744065
- },
- "height": 50,
- "location": {
- "lat": 37.0,
- "lon": 35.32
- },
- "time": "00",
- "date": "20160419",
- "output": "37.00_35.32_10v.json",
- "station_name": "Adana",
- "10v": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- -1.39080810546875,
- -1.6737213134765625,
- -1.0354766845703125,
- -1.7921295166015625,
- -0.272064208984375,
- 1.3854217529296875,
- -0.00360107421875,
- -0.2913665771484375,
- -1.6612548828125,
- -1.758270263671875,
- -1.0623931884765625,
- 0.9999542236328125,
- 3.6143798828125,
- 2.1895904541015625,
- 1.714599609375,
- -0.6298675537109375,
- -1.5398406982421875,
- -1.8553314208984375,
- 0.619903564453125,
- 3.44122314453125,
- 5.31573486328125,
- 2.1760406494140625,
- -10.150650024414062,
- -5.5760498046875,
- -3.3589019775390625,
- -2.646209716796875,
- -4.5130615234375,
- -5.240478515625,
- -0.8084259033203125,
- 2.0362396240234375,
- 1.3332977294921875,
- -1.5885772705078125,
- -1.3899993896484375,
- -1.496246337890625,
- -0.76519775390625,
- 1.0582275390625,
- 2.2641754150390625,
- 2.0411834716796875,
- 0.441070556640625,
- 1.4689788818359375,
- -0.7352447509765625,
- -1.158447265625,
- 0.103179931640625,
- 1.01373291015625,
- 3.3959503173828125,
- 3.2667388916015625,
- 1.3455963134765625,
- 0.137603759765625,
- -1.5401153564453125,
- -1.4615020751953125,
- 2.3779144287109375,
- 0.4443511962890625,
- -1.1491241455078125,
- -0.2032012939453125,
- 4.7884979248046875,
- 0.64691162109375,
- -0.7286224365234375,
- -0.5706634521484375,
- 1.9560699462890625,
- 1.3690032958984375,
- 0.233795166015625,
- 0.442840576171875,
- 3.9861297607421875,
- 1.4842071533203125,
- -0.2207183837890625
- ]
- },
- "metadata": {
- "points_along_meridian": 2560,
- "deterministic_height": 65.37060546875
- }
-}
diff --git a/utils/input/37.00_35.32_2t.json b/utils/input/37.00_35.32_2t.json
deleted file mode 100644
index 1ea5bb4..0000000
--- a/utils/input/37.00_35.32_2t.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "2t": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 288.91458129882812,
- 288.54586791992188,
- 296.18618774414062,
- 303.82273864746094,
- 305.10614013671875,
- 301.725341796875,
- 294.60444641113281,
- 295.60850524902344,
- 290.39402770996094,
- 289.45220947265625,
- 298.20748901367188,
- 304.35835266113281,
- 306.15135192871094,
- 301.41152954101562,
- 295.39375305175781,
- 292.74162292480469,
- 288.92292785644531,
- 287.71070861816406,
- 296.14872741699219,
- 301.43095397949219,
- 300.20884704589844,
- 296.97767639160156,
- 293.11671447753906,
- 291.45625305175781,
- 288.75180053710938,
- 286.4984130859375,
- 289.8927001953125,
- 295.88160705566406,
- 298.57060241699219,
- 295.13603210449219,
- 288.06671142578125,
- 287.25543212890625,
- 286.25294494628906,
- 285.35408020019531,
- 293.31047058105469,
- 298.72000122070312,
- 300.40830993652344,
- 296.73867797851562,
- 291.20381164550781,
- 290.82534790039062,
- 290.25811767578125,
- 288.73689270019531,
- 294.11283874511719,
- 298.60238647460938,
- 300.86419677734375,
- 296.46060180664062,
- 290.23733520507812,
- 291.12948608398438,
- 287.91783142089844,
- 295.12501525878906,
- 303.47758483886719,
- 292.45878601074219,
- 287.81675720214844,
- 295.89714050292969,
- 299.05499267578125,
- 291.43338012695312,
- 289.16070556640625,
- 294.25175476074219,
- 301.20860290527344,
- 291.83244323730469,
- 288.42105102539062,
- 293.08377075195312,
- 298.53788757324219,
- 291.06959533691406,
- 290.53083801269531
- ]
- },
- "forecast_location": {
- "latitude": 37.012301461157264,
- "distance": 5.167124375483275,
- "longitude": 35.263852242744065
- },
- "height": 50,
- "location": {
- "lat": 37.0,
- "lon": 35.32
- },
- "time": "00",
- "date": "20160419",
- "output": "37.00_35.32_2t.json",
- "station_name": "Adana",
- "metadata": {
- "points_along_meridian": 2560,
- "deterministic_height": 65.37060546875
- }
-}
diff --git a/utils/input/37.00_35.32_cp.json b/utils/input/37.00_35.32_cp.json
deleted file mode 100644
index 6a57bdd..0000000
--- a/utils/input/37.00_35.32_cp.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 37.012301461157264,
- "distance": 5.167124375483275,
- "longitude": 35.263852242744065
- },
- "height": 50,
- "location": {
- "lat": 37.0,
- "lon": 35.32
- },
- "time": "00",
- "date": "20160419",
- "output": "37.00_35.32_cp.json",
- "station_name": "Adana",
- "cp": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0
- ]
- },
- "metadata": {
- "points_along_meridian": 2560,
- "deterministic_height": 65.37060546875
- }
-}
diff --git a/utils/input/37.00_35.32_msl.json b/utils/input/37.00_35.32_msl.json
deleted file mode 100644
index ab9146b..0000000
--- a/utils/input/37.00_35.32_msl.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 37.012301461157264,
- "distance": 5.167124375483275,
- "longitude": 35.263852242744065
- },
- "height": 50,
- "msl": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 101546.9375,
- 101544.0,
- 101610.3125,
- 101559.375,
- 101383.3125,
- 101285.625,
- 101408.3125,
- 101413.375,
- 101374.9375,
- 101412.75,
- 101525.125,
- 101482.4375,
- 101303.1875,
- 101240.6875,
- 101302.875,
- 101254.5,
- 101146.8125,
- 101096.125,
- 101148.125,
- 101079.0625,
- 100930.25,
- 100880.6875,
- 101061.625,
- 101321.75,
- 101572.0625,
- 101749.5,
- 101873.875,
- 101771.3125,
- 101561.0625,
- 101507.8125,
- 101632.5625,
- 101608.625,
- 101498.1875,
- 101496.4375,
- 101556.5625,
- 101434.1875,
- 101235.0625,
- 101189.4375,
- 101247.4375,
- 101204.9375,
- 101103.875,
- 101085.8125,
- 101151.5625,
- 101089.0,
- 100909.5625,
- 100933.75,
- 101028.1875,
- 101000.3125,
- 100891.8125,
- 100898.25,
- 100709.5,
- 100801.25,
- 100802.75,
- 101021.8125,
- 100988.0625,
- 101165.9375,
- 101144.75,
- 101310.125,
- 101209.0,
- 101336.3125,
- 101306.875,
- 101388.375,
- 101266.75,
- 101382.25,
- 101453.5625
- ]
- },
- "location": {
- "lat": 37.0,
- "lon": 35.32
- },
- "time": "00",
- "date": "20160419",
- "output": "37.00_35.32_msl.json",
- "station_name": "Adana",
- "metadata": {
- "points_along_meridian": 2560,
- "deterministic_height": 65.37060546875
- }
-}
diff --git a/utils/input/37.00_35.32_r.json b/utils/input/37.00_35.32_r.json
deleted file mode 100644
index 52fd3ed..0000000
--- a/utils/input/37.00_35.32_r.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 37.012301461157264,
- "distance": 5.167124375483275,
- "longitude": 35.263852242744065
- },
- "height": 50,
- "r": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 21.959823608398438,
- 21.173563003540039,
- 21.719727516174316,
- 18.941998481750488,
- 24.244024276733398,
- 24.867341041564941,
- 19.520977020263672,
- 15.790532112121582,
- 20.673953056335449,
- 22.477451324462891,
- 24.87923526763916,
- 18.88481616973877,
- 25.713098526000977,
- 17.712313652038574,
- 14.419735908508301,
- 14.220227241516113,
- 19.132566452026367,
- 23.342550277709961,
- 23.422256469726562,
- 28.82038688659668,
- 16.295899391174316,
- 15.807450294494629,
- 60.620522499084473,
- 22.416717529296875,
- 32.967270851135254,
- 28.271215438842773,
- 12.971820831298828,
- 25.443082809448242,
- 30.015945434570312,
- 29.04448413848877,
- 25.20158863067627,
- 26.060318946838379,
- 39.803343772888184,
- 34.084344863891602,
- 19.553410530090332,
- 27.845093727111816,
- 36.661808013916016,
- 22.537065505981445,
- 18.216238021850586,
- 17.214380264282227,
- 20.381645202636719,
- 19.65166187286377,
- 22.899279594421387,
- 23.641171455383301,
- 34.671133041381836,
- 8.8245716094970703,
- 13.548418045043945,
- 18.183538436889648,
- 23.656298637390137,
- 31.788172721862793,
- 31.155279159545898,
- 13.975152015686035,
- 23.565373420715332,
- 26.078520774841309,
- 34.997767448425293,
- 42.122937202453613,
- 39.068507194519043,
- 43.608613014221191,
- 75.04088306427002,
- 57.547206878662109,
- 48.489943504333496,
- 12.80148983001709,
- 57.779317855834961,
- 47.782944679260254,
- 63.67241096496582
- ]
- },
- "location": {
- "lat": 37.0,
- "lon": 35.32
- },
- "time": "00",
- "date": "20160419",
- "output": "37.00_35.32_r.json",
- "station_name": "Adana",
- "metadata": {
- "points_along_meridian": 2560,
- "deterministic_height": 65.37060546875
- }
-}
diff --git a/utils/input/37.00_35.32_t.json b/utils/input/37.00_35.32_t.json
deleted file mode 100644
index 19484bf..0000000
--- a/utils/input/37.00_35.32_t.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 37.012301461157264,
- "distance": 5.167124375483275,
- "longitude": 35.263852242744065
- },
- "time": "00",
- "height": 50,
- "location": {
- "lat": 37.0,
- "lon": 35.32
- },
- "t": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 289.57730102539062,
- 289.42794799804688,
- 289.044677734375,
- 289.59954833984375,
- 290.2451171875,
- 290.52938842773438,
- 290.98216247558594,
- 291.07249450683594,
- 290.62850952148438,
- 290.51359558105469,
- 290.15573120117188,
- 290.54217529296875,
- 291.17530822753906,
- 291.28166198730469,
- 291.00410461425781,
- 290.64161682128906,
- 289.85441589355469,
- 289.26617431640625,
- 288.56072998046875,
- 288.13592529296875,
- 288.22627258300781,
- 286.70130920410156,
- 283.9954833984375,
- 282.929931640625,
- 278.73347473144531,
- 277.6895751953125,
- 279.54631042480469,
- 280.58976745605469,
- 283.07734680175781,
- 284.07853698730469,
- 284.01048278808594,
- 283.79840087890625,
- 283.47695922851562,
- 283.62898254394531,
- 284.26853942871094,
- 284.22848510742188,
- 285.05915832519531,
- 285.98109436035156,
- 286.17326354980469,
- 286.32913208007812,
- 285.37178039550781,
- 285.12944030761719,
- 284.72381591796875,
- 284.87312316894531,
- 285.87753295898438,
- 286.71095275878906,
- 286.56674194335938,
- 286.96063232421875,
- 287.56991577148438,
- 287.60917663574219,
- 288.36334228515625,
- 289.81588745117188,
- 288.3592529296875,
- 287.59007263183594,
- 288.75871276855469,
- 286.91645812988281,
- 286.36129760742188,
- 285.1220703125,
- 285.21644592285156,
- 285.87643432617188,
- 284.5498046875,
- 284.56692504882812,
- 284.30319213867188,
- 284.92333984375,
- 284.5443115234375
- ]
- },
- "date": "20160419",
- "output": "37.00_35.32_t.json",
- "station_name": "Adana",
- "metadata": {
- "points_along_meridian": 2560,
- "deterministic_height": 65.37060546875
- }
-}
diff --git a/utils/input/37.00_35.32_tcc.json b/utils/input/37.00_35.32_tcc.json
deleted file mode 100644
index 3f332ff..0000000
--- a/utils/input/37.00_35.32_tcc.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 37.012301461157264,
- "distance": 5.167124375483275,
- "longitude": 35.263852242744065
- },
- "height": 50,
- "location": {
- "lat": 37.0,
- "lon": 35.32
- },
- "time": "00",
- "date": "20160419",
- "output": "37.00_35.32_tcc.json",
- "station_name": "Adana",
- "tcc": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.8800048828125,
- 0.95001220703125,
- 0.489990234375,
- 0.0,
- 0.0,
- 0.790008544921875,
- 0.57000732421875,
- 0.230010986328125,
- 0.339996337890625,
- 0.0,
- 0.790008544921875,
- 0.829986572265625,
- 0.339996337890625,
- 0.0,
- 0.010009765625,
- 0.040008544921875,
- 0.089996337890625,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.07000732421875,
- 0.0,
- 0.0,
- 0.29998779296875,
- 0.94000244140625,
- 0.989990234375,
- 0.040008544921875,
- 0.170013427734375,
- 0.029998779296875,
- 0.0,
- 0.8900146484375,
- 0.0,
- 0.6099853515625,
- 0.6300048828125,
- 0.6199951171875,
- 0.339996337890625,
- 0.760009765625,
- 0.709991455078125,
- 0.8900146484375,
- 0.1199951171875,
- 0.079986572265625,
- 0.0,
- 0.0,
- 0.0,
- 0.1400146484375,
- 0.260009765625,
- 0.0,
- 0.92999267578125,
- 0.3900146484375,
- 0.079986572265625,
- 0.019989013671875,
- 0.829986572265625
- ]
- },
- "metadata": {
- "points_along_meridian": 2560,
- "deterministic_height": 65.37060546875
- }
-}
diff --git a/utils/input/41.30_10.50_10u.json b/utils/input/41.30_10.50_10u.json
deleted file mode 100644
index 03bd57a..0000000
--- a/utils/input/41.30_10.50_10u.json
+++ /dev/null
@@ -1,225 +0,0 @@
-{
- "forecast_location": {
- "latitude": 41.25731752730698,
- "distance": 6.900076759787546,
- "longitude": 10.44
- },
- "height": 10,
- "location": {
- "lat": 41.3,
- "lon": 10.5
- },
- "time": "00",
- "date": "20160113",
- "output": "41.30_10.50_10u.json",
- "station_name": "point2",
- "10uv": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "10u": [
- 0.4387054443359375,
- 0.329803466796875,
- 0.4198760986328125,
- 0.087188720703125,
- 0.0217132568359375,
- -0.3078765869140625,
- -0.377288818359375,
- 0.4497833251953125,
- -0.46002197265625,
- 0.0933837890625,
- 0.4078521728515625,
- 0.4187774658203125,
- 0.2692108154296875,
- -0.185302734375,
- 0.5159149169921875,
- 0.40985107421875,
- 0.402191162109375,
- 0.7711639404296875,
- 0.6942596435546875,
- 0.744720458984375,
- 0.5816192626953125,
- 0.6935577392578125,
- 0.5261993408203125,
- 0.1998443603515625,
- -0.1970977783203125,
- 0.131072998046875,
- 0.0691680908203125,
- -0.2661285400390625,
- -0.6531219482421875,
- -0.5950469970703125,
- -0.4775848388671875,
- -0.653411865234375,
- -0.7460784912109375,
- -0.93499755859375,
- -0.78021240234375,
- -0.6671142578125,
- -0.3684844970703125,
- -0.27777099609375,
- -0.18316650390625,
- -0.130401611328125,
- 0.018341064453125,
- 0.1101226806640625,
- 0.3078155517578125,
- 0.0615234375,
- -0.0902099609375,
- -0.1082763671875,
- -0.2016448974609375,
- -0.611907958984375,
- -0.257232666015625,
- -1.1170654296875,
- -0.2424774169921875,
- -1.011260986328125,
- -0.1312408447265625,
- 0.7652587890625,
- 0.40728759765625,
- 0.2418975830078125,
- 0.292327880859375,
- 0.7292633056640625,
- 0.2592010498046875,
- 0.1573028564453125,
- 0.0700836181640625,
- 0.5368804931640625,
- 0.0648956298828125,
- 0.3387451171875,
- 0.3949737548828125
- ],
-
-
- "10v": [
- 0.125823974609375,
- -0.0283355712890625,
- -0.0196990966796875,
- -0.052398681640625,
- 0.0368499755859375,
- 0.0312347412109375,
- -0.2501983642578125,
- 0.3714141845703125,
- -0.00421142578125,
- 0.0700531005859375,
- 0.1710357666015625,
- 0.7651519775390625,
- 1.1278533935546875,
- 0.6367034912109375,
- 1.192657470703125,
- 1.0818634033203125,
- 0.65875244140625,
- 0.52130126953125,
- 0.5759735107421875,
- 0.799652099609375,
- 1.08880615234375,
- 1.110809326171875,
- 1.1493377685546875,
- 1.302490234375,
- 1.1849517822265625,
- 0.856292724609375,
- 0.5441741943359375,
- 0.808441162109375,
- 0.7717742919921875,
- 0.6020355224609375,
- 0.4735107421875,
- 0.433990478515625,
- 0.5348968505859375,
- 0.302001953125,
- 0.4048309326171875,
- 0.3337860107421875,
- 0.2388153076171875,
- 0.199981689453125,
- 0.1395263671875,
- 0.151031494140625,
- 0.0992431640625,
- -0.04962158203125,
- -0.13623046875,
- 0.1202545166015625,
- 0.3372802734375,
- 0.374420166015625,
- 0.2035064697265625,
- 0.1859283447265625,
- 0.4132232666015625,
- 0.256256103515625,
- 0.3888092041015625,
- 0.4021453857421875,
- 0.2176361083984375,
- 0.3428192138671875,
- 0.7100372314453125,
- 0.70989990234375,
- 0.7878875732421875,
- 0.6195068359375,
- 0.9668121337890625,
- 1.1561126708984375,
- 1.44989013671875,
- 0.96832275390625,
- 1.3133392333984375,
- 1.1692962646484375,
- 0.9862823486328125
- ]
- },
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": -0.162353515625
- }
-}
diff --git a/utils/input/41.30_10.50_10v.json b/utils/input/41.30_10.50_10v.json
deleted file mode 100644
index 6bf4c7b..0000000
--- a/utils/input/41.30_10.50_10v.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 41.25731752730698,
- "distance": 6.900076759787546,
- "longitude": 10.44
- },
- "height": 10,
- "location": {
- "lat": 41.3,
- "lon": 10.5
- },
- "time": "00",
- "date": "20160113",
- "output": "41.30_10.50_10v.json",
- "station_name": "point2",
- "10v": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 0.125823974609375,
- -0.0283355712890625,
- -0.0196990966796875,
- -0.052398681640625,
- 0.0368499755859375,
- 0.0312347412109375,
- -0.2501983642578125,
- 0.3714141845703125,
- -0.00421142578125,
- 0.0700531005859375,
- 0.1710357666015625,
- 0.7651519775390625,
- 1.1278533935546875,
- 0.6367034912109375,
- 1.192657470703125,
- 1.0818634033203125,
- 0.65875244140625,
- 0.52130126953125,
- 0.5759735107421875,
- 0.799652099609375,
- 1.08880615234375,
- 1.110809326171875,
- 1.1493377685546875,
- 1.302490234375,
- 1.1849517822265625,
- 0.856292724609375,
- 0.5441741943359375,
- 0.808441162109375,
- 0.7717742919921875,
- 0.6020355224609375,
- 0.4735107421875,
- 0.433990478515625,
- 0.5348968505859375,
- 0.302001953125,
- 0.4048309326171875,
- 0.3337860107421875,
- 0.2388153076171875,
- 0.199981689453125,
- 0.1395263671875,
- 0.151031494140625,
- 0.0992431640625,
- -0.04962158203125,
- -0.13623046875,
- 0.1202545166015625,
- 0.3372802734375,
- 0.374420166015625,
- 0.2035064697265625,
- 0.1859283447265625,
- 0.4132232666015625,
- 0.256256103515625,
- 0.3888092041015625,
- 0.4021453857421875,
- 0.2176361083984375,
- 0.3428192138671875,
- 0.7100372314453125,
- 0.70989990234375,
- 0.7878875732421875,
- 0.6195068359375,
- 0.9668121337890625,
- 1.1561126708984375,
- 1.44989013671875,
- 0.96832275390625,
- 1.3133392333984375,
- 1.1692962646484375,
- 0.9862823486328125
- ]
- },
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": -0.162353515625
- }
-}
diff --git a/utils/input/41.30_10.50_2t.json b/utils/input/41.30_10.50_2t.json
deleted file mode 100644
index f621c71..0000000
--- a/utils/input/41.30_10.50_2t.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "2t": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 237.68267822265625,
- 238.19137573242188,
- 238.76434326171875,
- 237.43937683105469,
- 237.21401977539062,
- 236.74372863769531,
- 237.5899658203125,
- 236.947998046875,
- 236.59516906738281,
- 239.68904113769531,
- 238.71287536621094,
- 236.98774719238281,
- 236.031494140625,
- 237.46737670898438,
- 234.06340026855469,
- 233.43736267089844,
- 234.80355834960938,
- 237.37956237792969,
- 236.15843200683594,
- 235.60919189453125,
- 235.67730712890625,
- 237.24421691894531,
- 237.9783935546875,
- 238.81573486328125,
- 239.46421813964844,
- 241.73435974121094,
- 241.92900085449219,
- 240.32963562011719,
- 238.26527404785156,
- 237.21418762207031,
- 236.35598754882812,
- 235.9228515625,
- 235.43728637695312,
- 239.6912841796875,
- 240.39265441894531,
- 239.56777954101562,
- 239.98677062988281,
- 240.92010498046875,
- 241.86697387695312,
- 242.59832763671875,
- 244.48228454589844,
- 246.30194091796875,
- 245.49520874023438,
- 243.35879516601562,
- 241.77095031738281,
- 241.54966735839844,
- 241.49935913085938,
- 241.02452087402344,
- 240.39344787597656,
- 243.34043884277344,
- 241.21380615234375,
- 240.90493774414062,
- 240.73905944824219,
- 239.79878234863281,
- 235.546142578125,
- 235.07405090332031,
- 234.05117797851562,
- 235.9140625,
- 233.71638488769531,
- 233.55561828613281,
- 233.69891357421875,
- 236.93333435058594,
- 236.09690856933594,
- 235.18367004394531,
- 233.94316101074219
- ]
- },
- "forecast_location": {
- "latitude": 41.25731752730698,
- "distance": 6.900076759787546,
- "longitude": 10.44
- },
- "height": 10,
- "location": {
- "lat": 41.3,
- "lon": 10.5
- },
- "time": "00",
- "date": "20160113",
- "output": "41.30_10.50_2t.json",
- "station_name": "point2",
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": -0.162353515625
- }
-}
diff --git a/utils/input/41.30_10.50_cp.json b/utils/input/41.30_10.50_cp.json
deleted file mode 100644
index 66802a6..0000000
--- a/utils/input/41.30_10.50_cp.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 41.25731752730698,
- "distance": 6.900076759787546,
- "longitude": 10.44
- },
- "height": 10,
- "location": {
- "lat": 41.3,
- "lon": 10.5
- },
- "time": "00",
- "date": "20160113",
- "output": "41.30_10.50_cp.json",
- "station_name": "point2",
- "cp": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 0.0,
- 1.1444091796875e-05,
- 5.7220458984375e-05,
- 3.814697265625e-06,
- 7.62939453125e-06,
- 2.6702880859375e-05,
- 7.62939453125e-05,
- 7.62939453125e-06,
- 0.0,
- 0.0,
- 7.62939453125e-06,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 7.62939453125e-06,
- 7.62939453125e-06,
- 0.0001373291015625,
- 0.0002593994140625,
- 0.000213623046875,
- 0.000213623046875,
- 0.0001220703125,
- 4.57763671875e-05,
- 3.0517578125e-05,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 1.52587890625e-05,
- 0.0,
- 0.0,
- 1.52587890625e-05,
- 1.52587890625e-05,
- 3.0517578125e-05,
- 6.103515625e-05,
- 7.62939453125e-05,
- 1.52587890625e-05,
- 1.52587890625e-05,
- 0.0,
- 0.0,
- 0.0,
- 1.52587890625e-05,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 1.52587890625e-05,
- 0.0,
- 1.52587890625e-05,
- 3.0517578125e-05,
- 3.0517578125e-05,
- 3.0517578125e-05,
- 6.103515625e-05,
- 3.0517578125e-05
- ]
- },
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": -0.162353515625
- }
-}
diff --git a/utils/input/41.30_10.50_msl.json b/utils/input/41.30_10.50_msl.json
deleted file mode 100644
index c9badaf..0000000
--- a/utils/input/41.30_10.50_msl.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 41.25731752730698,
- "distance": 6.900076759787546,
- "longitude": 10.44
- },
- "height": 10,
- "msl": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 102177.8125,
- 102249.5,
- 102374.625,
- 102456.6875,
- 102608.5625,
- 102614.1875,
- 102661.75,
- 102801.0625,
- 102847.0625,
- 102964.25,
- 103183.5625,
- 103315.875,
- 103545.375,
- 103592.0625,
- 103695.875,
- 103741.0,
- 103766.9375,
- 103734.8125,
- 103651.5625,
- 103585.625,
- 103458.3125,
- 103256.6875,
- 103108.5625,
- 102934.4375,
- 102865.25,
- 102798.875,
- 102757.5,
- 102816.125,
- 102838.625,
- 102846.375,
- 102882.1875,
- 102960.875,
- 103049.0625,
- 103073.625,
- 103103.5625,
- 103169.375,
- 103231.0625,
- 103252.0625,
- 103284.5625,
- 103307.0625,
- 103399.875,
- 103456.25,
- 103525.875,
- 103644.4375,
- 103746.5625,
- 103826.75,
- 103923.875,
- 103908.1875,
- 104007.25,
- 104018.8125,
- 104122.0,
- 103987.5,
- 103950.1875,
- 104088.875,
- 104256.5625,
- 104317.4375,
- 104353.75,
- 104397.6875,
- 104488.75,
- 104474.25,
- 104452.8125,
- 104349.25,
- 104173.5625,
- 103957.6875,
- 103789.5625
- ]
- },
- "location": {
- "lat": 41.3,
- "lon": 10.5
- },
- "time": "00",
- "date": "20160113",
- "output": "41.30_10.50_msl.json",
- "station_name": "point2",
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": -0.162353515625
- }
-}
diff --git a/utils/input/41.30_10.50_r.json b/utils/input/41.30_10.50_r.json
deleted file mode 100644
index facd8cf..0000000
--- a/utils/input/41.30_10.50_r.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 41.25731752730698,
- "distance": 6.900076759787546,
- "longitude": 10.44
- },
- "height": 10,
- "r": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 74.820910453796387,
- 82.165701866149902,
- 86.360210418701172,
- 80.719925880432129,
- 80.606836318969727,
- 86.761063575744629,
- 81.891765594482422,
- 74.334155082702637,
- 59.696466445922852,
- 45.676423072814941,
- 38.581279754638672,
- 37.144233703613281,
- 35.139017105102539,
- 34.468579292297363,
- 47.286173820495605,
- 51.308355331420898,
- 37.389011383056641,
- 47.671236991882324,
- 51.852482795715332,
- 51.453635215759277,
- 61.616774559020996,
- 82.614348411560059,
- 93.823399543762207,
- 95.339861869812012,
- 95.361287117004395,
- 101.81180000305176,
- 100.05736351013184,
- 95.01722526550293,
- 89.225061416625977,
- 80.016554832458496,
- 75.325366020202637,
- 78.746536254882812,
- 79.828167915344238,
- 79.673000335693359,
- 81.680631637573242,
- 85.887895584106445,
- 90.476388931274414,
- 93.284921646118164,
- 96.474883079528809,
- 98.305143356323242,
- 100.91341876983643,
- 100.25549793243408,
- 98.010522842407227,
- 95.865986824035645,
- 94.254598617553711,
- 92.376155853271484,
- 96.387191772460938,
- 93.535273551940918,
- 88.973620414733887,
- 75.570710182189941,
- 52.098025321960449,
- 34.083334922790527,
- 24.869568824768066,
- 18.12131404876709,
- 21.711441993713379,
- 38.100796699523926,
- 41.021544456481934,
- 45.30150032043457,
- 50.268073081970215,
- 59.412969589233398,
- 67.466923713684082,
- 67.91804027557373,
- 88.512664794921875,
- 96.347413063049316,
- 92.478290557861328
- ]
- },
- "location": {
- "lat": 41.3,
- "lon": 10.5
- },
- "time": "00",
- "date": "20160113",
- "output": "41.30_10.50_r.json",
- "station_name": "point2",
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": -0.162353515625
- }
-}
diff --git a/utils/input/41.30_10.50_t.json b/utils/input/41.30_10.50_t.json
deleted file mode 100644
index 2bb6fe1..0000000
--- a/utils/input/41.30_10.50_t.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 41.25731752730698,
- "distance": 6.900076759787546,
- "longitude": 10.44
- },
- "time": "00",
- "height": 10,
- "location": {
- "lat": 41.3,
- "lon": 10.5
- },
- "t": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 251.04470825195312,
- 251.86993408203125,
- 252.00492858886719,
- 251.78024291992188,
- 252.24755859375,
- 252.76583862304688,
- 254.14599609375,
- 254.87710571289062,
- 255.50410461425781,
- 255.52828979492188,
- 255.78929138183594,
- 255.73924255371094,
- 255.43524169921875,
- 255.55685424804688,
- 255.45576477050781,
- 255.55398559570312,
- 255.72198486328125,
- 255.46746826171875,
- 254.65008544921875,
- 254.50749206542969,
- 253.46942138671875,
- 251.43403625488281,
- 249.90431213378906,
- 248.80636596679688,
- 249.11924743652344,
- 249.43246459960938,
- 249.06684875488281,
- 248.78169250488281,
- 248.77041625976562,
- 248.25601196289062,
- 247.54324340820312,
- 247.00726318359375,
- 246.89073181152344,
- 247.04039001464844,
- 247.50405883789062,
- 247.99824523925781,
- 248.34211730957031,
- 248.77845764160156,
- 249.33538818359375,
- 250.15985107421875,
- 250.69728088378906,
- 250.95294189453125,
- 251.12324523925781,
- 251.51231384277344,
- 251.94697570800781,
- 252.40316772460938,
- 252.6781005859375,
- 253.06692504882812,
- 253.27223205566406,
- 253.89266967773438,
- 255.25028991699219,
- 256.90939331054688,
- 258.67735290527344,
- 259.32391357421875,
- 258.72932434082031,
- 257.258056640625,
- 256.35841369628906,
- 255.32354736328125,
- 254.59709167480469,
- 253.48078918457031,
- 251.99021911621094,
- 250.25819396972656,
- 247.81526184082031,
- 246.00517272949219,
- 246.11082458496094
- ]
- },
- "date": "20160113",
- "output": "41.30_10.50_t.json",
- "station_name": "point2",
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": -0.162353515625
- }
-}
diff --git a/utils/input/41.30_10.50_tcc.json b/utils/input/41.30_10.50_tcc.json
deleted file mode 100644
index d2ae655..0000000
--- a/utils/input/41.30_10.50_tcc.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 41.25731752730698,
- "distance": 6.900076759787546,
- "longitude": 10.44
- },
- "height": 10,
- "location": {
- "lat": 41.3,
- "lon": 10.5
- },
- "time": "00",
- "date": "20160113",
- "output": "41.30_10.50_tcc.json",
- "station_name": "point2",
- "tcc": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 0.9844970703125,
- 1.0,
- 0.962646484375,
- 0.450469970703125,
- 0.66058349609375,
- 1.0,
- 0.637298583984375,
- 0.703277587890625,
- 0.817413330078125,
- 0.27191162109375,
- 0.423828125,
- 0.347381591796875,
- 0.060455322265625,
- 0.076141357421875,
- 0.672698974609375,
- 0.959991455078125,
- 0.987884521484375,
- 0.953338623046875,
- 0.998992919921875,
- 1.0,
- 0.994781494140625,
- 1.0,
- 1.0,
- 1.0,
- 1.0,
- 0.998870849609375,
- 0.97576904296875,
- 0.713653564453125,
- 0.105377197265625,
- 0.06317138671875,
- 0.631195068359375,
- 0.831787109375,
- 0.922332763671875,
- 0.91876220703125,
- 0.707000732421875,
- 0.859527587890625,
- 0.887542724609375,
- 0.9559326171875,
- 0.99676513671875,
- 0.992095947265625,
- 0.99676513671875,
- 0.99676513671875,
- 0.576202392578125,
- 0.310211181640625,
- 0.57757568359375,
- 0.884002685546875,
- 0.77740478515625,
- 0.97113037109375,
- 0.158538818359375,
- 0.0,
- 0.01568603515625,
- 0.356719970703125,
- 0.80047607421875,
- 0.3516845703125,
- 0.3525390625,
- 0.409149169921875,
- 0.42022705078125,
- 0.72412109375,
- 0.671875,
- 0.47271728515625,
- 0.936737060546875,
- 0.988677978515625,
- 0.997772216796875,
- 0.988677978515625,
- 1.0
- ]
- },
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": -0.162353515625
- }
-}
diff --git a/utils/input/43.30_-8.50_10u.json b/utils/input/43.30_-8.50_10u.json
deleted file mode 100644
index 628a4a1..0000000
--- a/utils/input/43.30_-8.50_10u.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 43.225298510798666,
- "distance": 9.721345784605642,
- "longitude": 351.5625
- },
- "height": 50,
- "location": {
- "lat": 43.3,
- "lon": -8.5
- },
- "time": "00",
- "date": "20160113",
- "output": "43.30_-8.50_10u.json",
- "station_name": "point1",
- "10u": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- -2.4900054931640625,
- -1.552032470703125,
- -1.9600067138671875,
- -1.574920654296875,
- -1.4694976806640625,
- -1.2356109619140625,
- -1.353851318359375,
- -1.4955291748046875,
- -1.15142822265625,
- -0.8118896484375,
- -1.0862884521484375,
- -1.3907928466796875,
- -1.2161407470703125,
- -1.044677734375,
- -0.8981475830078125,
- -0.74737548828125,
- -0.700347900390625,
- -0.4553985595703125,
- -0.8477325439453125,
- -1.110748291015625,
- -1.2806854248046875,
- -1.1365203857421875,
- -1.3390350341796875,
- -1.3987884521484375,
- -1.6355743408203125,
- -1.122833251953125,
- -1.5821990966796875,
- -1.2309722900390625,
- -1.2410125732421875,
- -1.3274688720703125,
- -1.2139129638671875,
- -1.111419677734375,
- -1.1972503662109375,
- -0.99945068359375,
- -0.45989990234375,
- -1.1973876953125,
- -1.2464141845703125,
- -1.25335693359375,
- -1.07086181640625,
- -0.881378173828125,
- -0.831268310546875,
- -0.9367523193359375,
- -1.0134735107421875,
- -0.6552734375,
- -0.7855224609375,
- -0.6668701171875,
- -0.5043792724609375,
- -0.799407958984375,
- -1.078521728515625,
- -1.2801513671875,
- -1.6702117919921875,
- -1.506378173828125,
- -1.0843658447265625,
- -0.8958740234375,
- -1.09857177734375,
- -1.0862274169921875,
- -1.087554931640625,
- -0.6867523193359375,
- -1.3677520751953125,
- -1.0292205810546875,
- -0.9767913818359375,
- -1.1164398193359375,
- -1.3657684326171875,
- -1.3409423828125,
- -1.3726043701171875
- ]
- },
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": 225.627197265625
- }
-}
diff --git a/utils/input/43.30_-8.50_10v.json b/utils/input/43.30_-8.50_10v.json
deleted file mode 100644
index 6657808..0000000
--- a/utils/input/43.30_-8.50_10v.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 43.225298510798666,
- "distance": 9.721345784605642,
- "longitude": 351.5625
- },
- "height": 50,
- "location": {
- "lat": 43.3,
- "lon": -8.5
- },
- "time": "00",
- "date": "20160113",
- "output": "43.30_-8.50_10v.json",
- "station_name": "point1",
- "10v": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- -1.883941650390625,
- -1.6757965087890625,
- -1.9054412841796875,
- -2.114898681640625,
- -2.0852203369140625,
- -1.7177886962890625,
- -1.3703155517578125,
- -1.5026092529296875,
- -1.16729736328125,
- -1.3606109619140625,
- -2.4598236083984375,
- -1.6274261474609375,
- -1.4278106689453125,
- -1.5000152587890625,
- -1.776092529296875,
- -1.6290740966796875,
- -1.75628662109375,
- -1.66717529296875,
- -1.6095733642578125,
- -1.308746337890625,
- -0.83697509765625,
- -0.836456298828125,
- -1.0420684814453125,
- -1.109619140625,
- -1.2925872802734375,
- -0.991363525390625,
- -1.5271148681640625,
- -0.844879150390625,
- -0.7711944580078125,
- -1.0454254150390625,
- -1.0216064453125,
- -1.044525146484375,
- -1.2395172119140625,
- -1.822998046875,
- -1.3734893798828125,
- -1.1164093017578125,
- -0.9301300048828125,
- -1.163299560546875,
- -1.1153564453125,
- -0.970062255859375,
- -0.7415771484375,
- -0.69317626953125,
- -0.76318359375,
- -0.4754486083984375,
- -0.4820556640625,
- -0.413665771484375,
- -0.3462982177734375,
- -0.5357513427734375,
- -0.7332611083984375,
- -1.544525146484375,
- -1.6551361083984375,
- -1.4709014892578125,
- -0.9786529541015625,
- -1.6708526611328125,
- -1.9305877685546875,
- -1.74322509765625,
- -1.8429718017578125,
- -2.0826416015625,
- -1.2724456787109375,
- -0.8663482666015625,
- -0.75421142578125,
- -1.15863037109375,
- -1.7413482666015625,
- -1.9996490478515625,
- -1.8672332763671875
- ]
- },
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": 225.627197265625
- }
-}
diff --git a/utils/input/43.30_-8.50_2t.json b/utils/input/43.30_-8.50_2t.json
deleted file mode 100644
index 1f365b4..0000000
--- a/utils/input/43.30_-8.50_2t.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "2t": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 247.16510009765625,
- 250.66403198242188,
- 251.54559326171875,
- 250.51750183105469,
- 250.20425415039062,
- 247.92341613769531,
- 245.6485595703125,
- 245.508544921875,
- 246.18891906738281,
- 250.85700988769531,
- 247.17381286621094,
- 245.36079406738281,
- 245.023681640625,
- 246.70565795898438,
- 249.61613464355469,
- 250.43150329589844,
- 252.16098022460938,
- 254.95182800292969,
- 252.99436950683594,
- 252.11114501953125,
- 250.68902587890625,
- 250.04304504394531,
- 250.0272216796875,
- 248.75714111328125,
- 246.30601501464844,
- 249.50584411621094,
- 245.34696960449219,
- 242.66557312011719,
- 241.46449279785156,
- 243.40950012207031,
- 244.28176879882812,
- 245.0283203125,
- 245.59548950195312,
- 249.4178466796875,
- 249.28132629394531,
- 245.68301391601562,
- 245.35200500488281,
- 247.59979248046875,
- 249.22439575195312,
- 251.25262451171875,
- 251.51158142089844,
- 253.82928466796875,
- 252.29013061523438,
- 250.34902954101562,
- 247.90962219238281,
- 246.04380798339844,
- 245.87435913085938,
- 245.47373962402344,
- 244.21571350097656,
- 247.39122009277344,
- 243.25091552734375,
- 243.17251586914062,
- 243.94999694824219,
- 248.94331359863281,
- 247.313720703125,
- 246.75569152832031,
- 246.79141235351562,
- 248.67578125,
- 245.07966613769531,
- 243.62593078613281,
- 243.27508544921875,
- 246.04075622558594,
- 240.92698669433594,
- 239.12117004394531,
- 238.76347351074219
- ]
- },
- "forecast_location": {
- "latitude": 43.225298510798666,
- "distance": 9.721345784605642,
- "longitude": 351.5625
- },
- "height": 50,
- "location": {
- "lat": 43.3,
- "lon": -8.5
- },
- "time": "00",
- "date": "20160113",
- "output": "43.30_-8.50_2t.json",
- "station_name": "point1",
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": 225.627197265625
- }
-}
diff --git a/utils/input/43.30_-8.50_cp.json b/utils/input/43.30_-8.50_cp.json
deleted file mode 100644
index 9774c6c..0000000
--- a/utils/input/43.30_-8.50_cp.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 43.225298510798666,
- "distance": 9.721345784605642,
- "longitude": 351.5625
- },
- "height": 50,
- "location": {
- "lat": 43.3,
- "lon": -8.5
- },
- "time": "00",
- "date": "20160113",
- "output": "43.30_-8.50_cp.json",
- "station_name": "point1",
- "cp": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 0.0,
- 1.9073486328125e-06,
- 5.7220458984375e-06,
- 1.1444091796875e-05,
- -3.814697265625e-06,
- 0.0,
- 0.0,
- 0.0,
- 7.62939453125e-06,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 3.0517578125e-05,
- 4.57763671875e-05,
- 2.288818359375e-05,
- 1.52587890625e-05,
- 1.52587890625e-05,
- 3.0517578125e-05,
- 3.0517578125e-05,
- 6.103515625e-05,
- 7.62939453125e-05,
- 6.103515625e-05,
- 6.103515625e-05,
- 0.0,
- 1.52587890625e-05,
- 0.0,
- 6.103515625e-05,
- 4.57763671875e-05,
- 3.0517578125e-05,
- 3.0517578125e-05,
- 4.57763671875e-05,
- 9.1552734375e-05,
- 4.57763671875e-05,
- 0.0,
- 6.103515625e-05,
- 9.1552734375e-05,
- 0.00018310546875,
- 0.0001373291015625,
- 7.62939453125e-05,
- 6.103515625e-05,
- 3.0517578125e-05,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 1.52587890625e-05,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0
- ]
- },
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": 225.627197265625
- }
-}
diff --git a/utils/input/43.30_-8.50_msl.json b/utils/input/43.30_-8.50_msl.json
deleted file mode 100644
index cb07e2f..0000000
--- a/utils/input/43.30_-8.50_msl.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 43.225298510798666,
- "distance": 9.721345784605642,
- "longitude": 351.5625
- },
- "height": 50,
- "msl": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 101359.5625,
- 101531.25,
- 101771.375,
- 101918.9375,
- 102128.8125,
- 102233.6875,
- 102425.25,
- 102479.8125,
- 102576.8125,
- 102651.5,
- 102779.3125,
- 102898.125,
- 102975.375,
- 102998.8125,
- 102962.875,
- 102855.0,
- 102709.1875,
- 102489.0625,
- 102259.5625,
- 102129.375,
- 102041.8125,
- 101962.6875,
- 102023.5625,
- 102053.4375,
- 102180.5,
- 102261.625,
- 102325.25,
- 102459.875,
- 102568.625,
- 102650.875,
- 102716.1875,
- 102808.875,
- 102911.5625,
- 102922.625,
- 102912.8125,
- 102968.875,
- 102997.8125,
- 102998.0625,
- 102992.0625,
- 103027.5625,
- 103078.875,
- 103131.5,
- 103194.125,
- 103290.9375,
- 103370.3125,
- 103469.75,
- 103591.125,
- 103675.6875,
- 103715.0,
- 103829.3125,
- 103919.5,
- 103848.25,
- 103803.9375,
- 103651.375,
- 103629.5625,
- 103592.9375,
- 103571.25,
- 103481.6875,
- 103508.25,
- 103411.5,
- 103236.8125,
- 102986.25,
- 102866.8125,
- 102695.9375,
- 102559.0625
- ]
- },
- "location": {
- "lat": 43.3,
- "lon": -8.5
- },
- "time": "00",
- "date": "20160113",
- "output": "43.30_-8.50_msl.json",
- "station_name": "point1",
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": 225.627197265625
- }
-}
diff --git a/utils/input/43.30_-8.50_r.json b/utils/input/43.30_-8.50_r.json
deleted file mode 100644
index ee462a1..0000000
--- a/utils/input/43.30_-8.50_r.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 43.225298510798666,
- "distance": 9.721345784605642,
- "longitude": 351.5625
- },
- "height": 50,
- "r": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 65.434191703796387,
- 63.458670616149902,
- 58.496929168701172,
- 52.887894630432129,
- 40.673242568969727,
- 39.495438575744629,
- 43.317546844482422,
- 57.506030082702637,
- 62.973810195922852,
- 63.555329322814941,
- 63.569561004638672,
- 61.183296203613281,
- 51.412454605102539,
- 50.320141792297363,
- 53.590861320495605,
- 54.991949081420898,
- 53.103855133056641,
- 48.354830741882324,
- 47.985295295715332,
- 52.750510215759277,
- 59.898024559020996,
- 65.688567161560059,
- 65.073399543762207,
- 65.308611869812012,
- 72.169880867004395,
- 73.331331253051758,
- 70.600332260131836,
- 70.25941276550293,
- 70.018030166625977,
- 70.532179832458496,
- 71.141772270202637,
- 72.055130004882812,
- 73.261761665344238,
- 75.340969085693359,
- 75.668912887573242,
- 70.008989334106445,
- 66.527170181274414,
- 74.863046646118164,
- 76.431914329528809,
- 77.434049606323242,
- 69.343106269836426,
- 61.067997932434082,
- 57.604272842407227,
- 53.740986824035645,
- 49.832723617553711,
- 48.657405853271484,
- 50.328598022460938,
- 52.226679801940918,
- 51.403307914733887,
- 49.629303932189941,
- 45.734744071960449,
- 41.798178672790527,
- 42.381287574768066,
- 51.50412654876709,
- 57.777848243713379,
- 62.768765449523926,
- 63.287169456481934,
- 62.86400032043457,
- 61.787604331970215,
- 62.819219589233398,
- 62.763798713684082,
- 66.28132152557373,
- 71.965789794921875,
- 72.691163063049316,
- 74.013446807861328
- ]
- },
- "location": {
- "lat": 43.3,
- "lon": -8.5
- },
- "time": "00",
- "date": "20160113",
- "output": "43.30_-8.50_r.json",
- "station_name": "point1",
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": 225.627197265625
- }
-}
diff --git a/utils/input/43.30_-8.50_t.json b/utils/input/43.30_-8.50_t.json
deleted file mode 100644
index 8754da1..0000000
--- a/utils/input/43.30_-8.50_t.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 43.225298510798666,
- "distance": 9.721345784605642,
- "longitude": 351.5625
- },
- "time": "00",
- "height": 50,
- "location": {
- "lat": 43.3,
- "lon": -8.5
- },
- "t": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 253.53787231445312,
- 252.69219970703125,
- 253.64750671386719,
- 254.42379760742188,
- 255.02294921875,
- 254.84591674804688,
- 254.69873046875,
- 254.53335571289062,
- 254.54512023925781,
- 254.16500854492188,
- 253.86155700683594,
- 253.89549255371094,
- 254.55047607421875,
- 254.69943237304688,
- 254.47529602050781,
- 254.72000122070312,
- 255.60577392578125,
- 256.49969482421875,
- 256.58856201171875,
- 255.98600769042969,
- 255.24481201171875,
- 253.93598937988281,
- 252.63673400878906,
- 251.74191284179688,
- 250.45323181152344,
- 249.46566772460938,
- 248.66841125488281,
- 248.09126281738281,
- 247.91494750976562,
- 248.14077758789062,
- 248.57644653320312,
- 248.84906005859375,
- 249.43565368652344,
- 251.13706970214844,
- 252.44644165039062,
- 253.04902648925781,
- 253.69563293457031,
- 254.24525451660156,
- 254.82562255859375,
- 255.07000732421875,
- 255.19044494628906,
- 255.14532470703125,
- 255.05879211425781,
- 255.33946228027344,
- 255.52705383300781,
- 255.48129272460938,
- 255.1956787109375,
- 254.83255004882812,
- 254.89918518066406,
- 254.97763061523438,
- 255.57841491699219,
- 255.85470581054688,
- 255.49180603027344,
- 255.07684326171875,
- 253.56721496582031,
- 252.527587890625,
- 252.37208557128906,
- 252.63214111328125,
- 253.04826354980469,
- 253.17024230957031,
- 253.30857849121094,
- 252.97694396972656,
- 252.26057434082031,
- 251.86454772949219,
- 251.53465270996094
- ]
- },
- "date": "20160113",
- "output": "43.30_-8.50_t.json",
- "station_name": "point1",
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": 225.627197265625
- }
-}
diff --git a/utils/input/43.30_-8.50_tcc.json b/utils/input/43.30_-8.50_tcc.json
deleted file mode 100644
index 3c9d2ac..0000000
--- a/utils/input/43.30_-8.50_tcc.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 43.225298510798666,
- "distance": 9.721345784605642,
- "longitude": 351.5625
- },
- "height": 50,
- "location": {
- "lat": 43.3,
- "lon": -8.5
- },
- "time": "00",
- "date": "20160113",
- "output": "43.30_-8.50_tcc.json",
- "station_name": "point1",
- "tcc": {
- "steps": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "forecast": [
- 0.074981689453125,
- 0.458099365234375,
- 0.227935791015625,
- 0.40863037109375,
- 0.1627197265625,
- 0.000213623046875,
- 0.0,
- 0.49481201171875,
- 0.372833251953125,
- 0.323394775390625,
- 0.0,
- 0.282623291015625,
- 0.978363037109375,
- 0.922271728515625,
- 0.994537353515625,
- 0.9921875,
- 1.0,
- 1.0,
- 0.998565673828125,
- 1.0,
- 0.9898681640625,
- 1.0,
- 0.967254638671875,
- 0.923675537109375,
- 0.897918701171875,
- 0.85577392578125,
- 0.697601318359375,
- 0.89093017578125,
- 0.976806640625,
- 0.93536376953125,
- 0.959991455078125,
- 0.96185302734375,
- 0.989990234375,
- 1.0,
- 1.0,
- 0.907257080078125,
- 0.970001220703125,
- 0.971435546875,
- 1.0,
- 0.99273681640625,
- 0.989990234375,
- 1.0,
- 0.991302490234375,
- 0.9471435546875,
- 0.77838134765625,
- 0.697479248046875,
- 0.51495361328125,
- 0.48638916015625,
- 0.002166748046875,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.102813720703125,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.0,
- 0.012908935546875
- ]
- },
- "metadata": {
- "points_along_meridian": 1280,
- "deterministic_height": 225.627197265625
- }
-}
diff --git a/utils/input/GRA04190000042900001 b/utils/input/GRA04190000042900001
deleted file mode 100644
index 12b815a..0000000
Binary files a/utils/input/GRA04190000042900001 and /dev/null differ
diff --git a/utils/input/adana.json b/utils/input/adana.json
deleted file mode 100644
index d351676..0000000
--- a/utils/input/adana.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-"stations" : [
-
- { "lat" : 37.00,
- "lon" : 35.32,
- "height" : 50,
- "name" : "Adana",
- "output_formats" : ["png"],
- "output_name" : "Adana"
- }
-]
-}
diff --git a/utils/input/stations_classic.json b/utils/input/stations_classic.json
deleted file mode 100644
index a0fc3ec..0000000
--- a/utils/input/stations_classic.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-"stations" : [
-
- { "lat" : 43.30,
- "lon" : -8.50,
- "height" : 50,
- "name" : "point1",
- "output_formats" : ["ps"],
- "output_name" : "point1"
- },
- { "lat" : 41.30,
- "lon" : 10.50,
- "name" : "point2",
- "height" : 10,
- "output_formats" : ["ps"],
- "output_name" : "point2"
- }
-]
-}
diff --git a/utils/input/tempe.json b/utils/input/tempe.json
deleted file mode 100644
index 1a34d26..0000000
--- a/utils/input/tempe.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "forecast_location": {
- "latitude": 37.012301461157264,
- "distance": 5.167124375483275,
- "longitude": 35.263852242744065
- },
- "time": "00",
- "height": 50,
- "location": {
- "lat": 37.0,
- "lon": 35.32
- },
- "tempe": {
- "x": [
- "0",
- "3",
- "6",
- "9",
- "12",
- "15",
- "18",
- "21",
- "24",
- "27",
- "30",
- "33",
- "36",
- "39",
- "42",
- "45",
- "48",
- "51",
- "54",
- "57",
- "60",
- "63",
- "66",
- "69",
- "72",
- "75",
- "78",
- "81",
- "84",
- "87",
- "90",
- "93",
- "96",
- "99",
- "102",
- "105",
- "108",
- "111",
- "114",
- "117",
- "120",
- "123",
- "126",
- "129",
- "132",
- "135",
- "138",
- "141",
- "144",
- "150",
- "156",
- "162",
- "168",
- "174",
- "180",
- "186",
- "192",
- "198",
- "204",
- "210",
- "216",
- "222",
- "228",
- "234",
- "240"
- ],
- "y": [
- 289.57730102539062,
- 289.42794799804688,
- 289.044677734375,
- 289.59954833984375,
- 290.2451171875,
- 290.52938842773438,
- 290.98216247558594,
- 291.07249450683594,
- 290.62850952148438,
- 290.51359558105469,
- 290.15573120117188,
- 290.54217529296875,
- 291.17530822753906,
- 291.28166198730469,
- 291.00410461425781,
- 290.64161682128906,
- 289.85441589355469,
- 289.26617431640625,
- 288.56072998046875,
- 288.13592529296875,
- 288.22627258300781,
- 286.70130920410156,
- 283.9954833984375,
- 282.929931640625,
- 278.73347473144531,
- 277.6895751953125,
- 279.54631042480469,
- 280.58976745605469,
- 283.07734680175781,
- 284.07853698730469,
- 284.01048278808594,
- 283.79840087890625,
- 283.47695922851562,
- 283.62898254394531,
- 284.26853942871094,
- 284.22848510742188,
- 285.05915832519531,
- 285.98109436035156,
- 286.17326354980469,
- 286.32913208007812,
- 285.37178039550781,
- 285.12944030761719,
- 284.72381591796875,
- 284.87312316894531,
- 285.87753295898438,
- 286.71095275878906,
- 286.56674194335938,
- 286.96063232421875,
- 287.56991577148438,
- 287.60917663574219,
- 288.36334228515625,
- 289.81588745117188,
- 288.3592529296875,
- 287.59007263183594,
- 288.75871276855469,
- 286.91645812988281,
- 286.36129760742188,
- 285.1220703125,
- 285.21644592285156,
- 285.87643432617188,
- 284.5498046875,
- 284.56692504882812,
- 284.30319213867188,
- 284.92333984375,
- 284.5443115234375
- ]
- },
- "date": "20160419",
- "output": "37.00_35.32_t.json",
- "station_name": "Adana",
- "metadata": {
- "points_along_meridian": 2560,
- "deterministic_height": 65.37060546875
- }
-}
diff --git a/utils/metgram.py b/utils/metgram.py
index 6f0bf08..63c50ff 100644
--- a/utils/metgram.py
+++ b/utils/metgram.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
from Magics.macro import *
import datetime
diff --git a/utils/plumes.py b/utils/plumes.py
index 00f96fd..58e7ff0 100644
--- a/utils/plumes.py
+++ b/utils/plumes.py
@@ -1,3 +1,11 @@
+# (C) Copyright 1996-2016 ECMWF.
+#
+# This software is licensed under the terms of the Apache Licence Version 2.0
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
+# granted to it by virtue of its status as an intergovernmental organisation nor
+# does it submit to any jurisdiction.
+
import traceback
import sys
diff --git a/version.sh b/version.sh
deleted file mode 100644
index 4c70c41..0000000
--- a/version.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Package name and versioning information for Magics
-#
-MAGICS_PACKAGE_NAME='MagicsNew'
-MAGICS_PACKAGE_VERSION='2.20.2'
-MAGICS_PACKAGE_COPYRIGHT_YEAR='2013'
-MAGICS_PACKAGE_COPYRIGHT_PERIOD='2007-2013'
-MAGICS_PACKAGE_RELEASE_DATE=`date +%d-%B-%Y`
-#
-#
-# Libtool library revision control info
-# See the libtool documentation under the heading "Libtool's versioning
-# system" in order to understand the meaning of these fields
-#
-# Here are a set of rules to help you update your library version
-# information:
-#
-# 1. Start with version information of `0:0:0' for each libtool library.
-# 2. Update the version information only immediately before a public
-# release of your software. More frequent updates are unnecessary, and
-# only guarantee that the current interface number gets larger faster.
-# 3. If the library source code has changed at all since the last update,
-# then increment revision (`c:r:a' becomes `c:r+1:a').
-# 4. If any interfaces have been added, removed, or changed since the last
-# update, increment current, and set revision to 0.
-# 5. If any interfaces have been added since the last public release, then
-# increment age.
-# 6. If any interfaces have been removed since the last public release,
-# then set age to 0.
-MAGICS_LIBRARY_CURRENT=3
-MAGICS_LIBRARY_REVISION=0
-MAGICS_LIBRARY_AGE=0
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/magics.git
More information about the debian-science-commits
mailing list